pohanhuang’s fix for harvester/harvester#12384 (a sub-issue of #12129, run Harvester without a Longhorn data disk). Reviewed in two passes, Cody’s process and ours, each by a fresh agent, one after the other, then merged and re-checked by me.
Preview: harvesterpr1271r.mf-created-dashboard.ui.rancher.space, built from 8db93eb (the head; Pass B ran on fc7d1b6, whose image code is identical). Baseline harvestermainr…, rebuilt from upstream main e66b61d (the PR’s base). Backend .105 (v1.10.0-rc1 with the master API, harvester-longhorn default plus longhorn). Login admin, the usual lab password.
The issue’s own case works: with no default and no longhorn, both forms now pick a class that exists, where main sent a longhorn that isn’t there. But the PR tries longhorn before the cluster default, so on every stock cluster Create Image and Create Volume switch from harvester-longhorn to longhorn, and a custom default is skipped. Both passes found it on their own. The rest is about the new message.
Pending review 5993855990 is on GitHub, not submitted: the intro plus the 7 comments below, anchored at 8db93eb, with 4 screenshots. CI is green; Copilot’s two threads are fixed in 8db93eb.
Thanks for picking this up. The issue's case works now: with no default and no longhorn, both forms pick a class that exists. The main thing is the new order, which puts longhorn ahead of the cluster default on every stock cluster. The rest is about the new message.
| Finding | Pass A (Cody) | Pass B (ours) | Outcome |
|---|---|---|---|
1. longhorn before the default | ✓ Major | ✓ Blocker | Posted (blocker) |
| 2. Encrypt message asks for the wrong class | Saw it; called the selection an improvement | ✓ Suggestion | Posted |
| 3. Message on Edit pages | ✓ Minor | ✓ Suggestion | Posted |
| 4. Tests miss the filters / keep-existing / loaded flag | — | ✓ Suggestion (mutations) | Posted |
| 5. Wording “selectable”, no link | — | ✓ Nit | Posted, optional |
6. data() alignment | Dropped (no-nit rule) | ✓ Nit | Posted, optional |
| 7. What to preselect with no default | ✓ Open question | ✓ Question | Posted (question) |
| Image message only on the Storage tab; Create sends an empty class | Dropped: main is no better there | ✓ Suggestion | Your call, not posted |
'longhorn' literal vs LONGHORN constant; rule written twice | Dropped (no-nit / simplify) | — | Not posted |
Shared Banner not announced, tabindex on a div | Dropped (on master) | — | Not posted (pre-existing) |
| Copilot’s two threads | Fixed at 8db93eb | Confirmed live on fc7d1b6; fixed at 8db93eb | Nothing to add |
Only A: the parent issue #12129, the acceptance table, 7 clips. Only B: the backend’s own fallback rule (EnsureTargetSC), the Encrypt message, the mutation run, Create payloads for images. A: 27 min, 104 tool calls, ~271k tokens. B: 24 min, 147 calls, ~271k tokens.
longhorn now wins over the cluster default StorageClassThis tries longhorn before the cluster's default StorageClass. A stock cluster has both harvester-longhorn (the default) and longhorn, so Create Image and Create Volume now preselect and send longhorn where main sends harvester-longhorn. The volume form does the same at harvesterhci.io.volume.vue:86. A default the admin set on purpose, like a third-party class, is skipped too, and an image's class can't be changed after it's created.
The issue only covers clusters with no default, and its parent harvester/harvester#12129 asks for the cluster default instead of a hard-coded class. The backend also uses the default class when an image doesn't name one, and every other StorageClass picker in the extension starts from the default (Restore Snapshot, Export Image, VM volumes, vm-import-controller, the upgrade repository picker).
main / this PR, same cluster:
Live on both previews with Create payloads from the write net (stock cluster and a simulated custom default), API read of .105, backend EnsureTargetSC source, the parent issue harvester/harvester#12129, and the five other pickers in the repo.
With Encrypt selected on a cluster that has no encrypted StorageClass, this shows "No selectable StorageClasses are available. Create a StorageClass before creating an image." while harvester-longhorn, longhorn and lvm-backup-test exist. What's missing is an encrypted class, so the message sends the user to create the wrong thing.
Live on the real cluster (no encrypted class). Pass A saw the same banner on Encrypt and judged the new <i>selection</i> an improvement, which it is (main preselected a non-encrypted default that isn’t in the encrypted list). The comment is about the text only.
mode !== 'view' lets the message show on the Edit page too. Editing an existing image on a cluster with nothing selectable says "Create a StorageClass before creating an image" under the locked Storage Class field, though nothing is being created. The volume form does the same for an existing blank volume (harvesterhci.io.volume.vue:263). Main shows nothing there.
Live with a simulated “nothing selectable” list: edit of image default/image-p7c4z and of a blank volume. Main shows nothing there. Pass A filed it as Minor with a clip. It’s what is left of Copilot’s first thread after 8db93eb.
These tests still pass if the internal-class filter is removed from either form, if the image form stops keeping an existing selection, or if storageClassesLoaded is never set, which means the message can never show. Those are what this PR adds besides the order, so a later change could break them without a test failing.
Mutation runs in a separate worktree: 9 of 12 mutations still pass (internal-class filter removed, keep-existing dropped, loaded flag never set, LVM and encryption filters dropped). Reverting both .vue files makes 11 of 13 fail, so the tests do pin the order.
Optional: "selectable" isn't a word the UI uses anywhere else, and "Create a StorageClass" doesn't say where. The VM form's persistent-state message links to the Storage Classes page, and the upgrade repository picker's empty state says "No StorageClasses are available." The volume message at line 1196 is the same.
Code reading. Existing patterns: the VM form’s persistent-state banner links to the Storage Classes page; the upgrade picker’s empty state says “No StorageClasses are available.”
data() alignmentOptional: the data() values now start in three different columns.
Code reading. Lint passes (key-spacing is in minimum mode). Pass A dropped it under its no-nit rule.
With no default, both forms still preselect longhorn when it exists, otherwise the first class in the list, which can be an LVM class nobody picked. The issue's title asks not to default to longhorn when there's no default. Is a preselection wanted in that case? The upgrade repository picker leaves the field empty and required there, and the backend only ever falls back to the default class.
Both passes raised it: Pass A as an open question about the issue title (“don’t default to Longhorn when no default exists”, yet both main and the PR pick longhorn there), Pass B as Q1 (the first class can be an LVM class nobody picked). Upgrade picker: default or empty, required. Backend: default class only.
Pass B: the form opens on Basics, Create stays enabled and sends an empty class; the backend then uses the default class or fails with “missing default storage class”. Pass A dropped it because main sends a longhorn that isn’t there in the same state, so it’s no worse, and that state needs a cluster with no usable class at all. I left it out for the same reason; it fits your form rule (Save blocked, tab marked) if you want it.
longhorn preselected, not on the clusterharvester-longhorn (Default) on both formslonghorn on both formsThe before/after pair can go in the review body if you want it; the pending review has none.
| # | Criterion | Source | PR (8db93eb) | main |
|---|---|---|---|---|
| AC1 | Image create, no default and no longhorn: an existing class is preselected | Issue body | Met | Not met (longhorn) |
| AC2 | Image create with a default: the default is preselected | Implied; parent #12129 | Not met (longhorn) | Met |
| AC3 | Volume create follows AC1 and AC2 | PR test step 1 | Partly (AC1 yes, AC2 no) | Partly (AC2 yes, AC1 no) |
| AC4 | Fallback never picks an internal or per-image class | PR summary | Met | Not met |
| AC5 | An existing selection is kept on edit | PR test step 2 | Met | Met |
| AC6 | Nothing selectable: a per-form info message | PR test step 4; Copilot | Met | Not met (no message) |
| AC7 | No volume message when Source = VM image | Copilot thread | Met at 8db93eb | Met |
| StorageClass set | Case | main | PR |
|---|---|---|---|
| Stock cluster (.105) | Image create | harvester-longhorn (Default) | longhorn |
| Stock cluster (.105) | Volume create | harvester-longhorn (Default) | longhorn |
Custom default fast next to longhorn | Image / Volume create | fast (Default) | longhorn |
Issue’s case: no default, no longhorn | Image / Volume create | longhorn (not on the cluster) | fast (first usable) |
Default fast, no longhorn | Image / Volume create | fast (Default) | fast (Default) |
Default is encrypted, no longhorn | Image create | longhorn (not on the cluster) | fast |
| Stock cluster, Encrypt selected | Image create | empty, no message | empty + “Create a StorageClass” message |
| Nothing usable (internal + backing-image only) | Image create | internal default, no message | empty + message on the Storage tab only; Create sends an empty class |
| Nothing usable | Volume create, source VM image | no message | no message at 8db93eb (Copilot’s thread, fixed) |
| Nothing usable | Image / Volume edit | no message | message under the locked field |
Lists rewritten in the browser, the Steve socket filtered, store contents asserted before reading the form. 19 cases per preview over 6 sets. Unit tests: 13/13 on both heads, all of pkg/harvester green; lint clean.
/v3/tokens (checked by name). Pass B left one open after a crash (token-rntd5, its own, created 13:12:53Z); I revoked it by name.