PR 1261: page the Harvester VM list on the server

Round two (778f1ab) · Round one (d225838)

Your draft PR, reviewed twice at d225838: Cody's process and ours, each by a fresh agent, one after the other, then merged and re-checked by me. Nothing was posted to GitHub and nothing was written to any cluster.

Preview: harvesterpr1261r.mf-created-dashboard.ui.rancher.space, built from d225838; backend .105 (Harvester v1.10.0-rc1 with the master API server, lists from the SQL cache, 9 VMs). Baseline: harvestermainr…, rebuilt from upstream main 97ce1e9 (the PR's base) on the same backend. Login admin, the usual lab password. Also checked: .118 (v1.9, old API) through a dev server, and extension mode in Rancher 2.16 on mf.

Round two at 778f1ab: nothing left to fix

Where it stands

Both passes reviewed the two fix commits (c0f7463, 3de59dc) and the whole PR again, each as a fresh agent. Every round-one finding is addressed or answered. They each found one new regression on their own, from the restart-notice change. It's fixed in 778f1ab, proven live on three builds below, and covered by tests that fail when the fix is undone. CI is green on 778f1ab, and the preview is rebuilt at that commit. The PR is still a draft, waiting for your go.

#Round-one findingPass A (Cody)Pass B (ours)Evidence
1Launcher pods matched by a label many VMs lackAddressedAddressedPods now come by kubevirt.io/created-by (the VMI UID). A: with every vmName label stripped from the responses in the browser, View Logs stayed enabled. B: same in extension mode on mf. Live start of an unlabelled VM earlier: pod found, View Logs on.
2Restart notice covers the page onlyAddressedPartlyDocumented and no longer re-shown on sort/refresh (A: 1 notice over 4 sort clicks vs 5 before). Both found the regression below, now fixed in 778f1ab.
3Tests miss a full reloadAddressedAddressedEach regression from round 1 fails a test (A 3 mutations, B 6).
4Description out of dateAddressedAddressedAll four parts now match the code; B's wording point below is fixed too.
5Console warning on searchAnsweredLeft by decisionComes from a hard-coded field list in the shell (steve-pagination-utils.ts:663) that an extension can't extend.
R1

The restart notice didn't show when you came back to the list

list/kubevirt.io.virtualmachine.vue
Fixed in 778f1ab
Pass A (Cody)Pass B (ours)re-checked by me

c0f7463 compared the VMs needing a restart with the watcher's previous value. Volumes and a VM's detail page load every VM into the store, so on the way back that previous value already held the same VMs, and the notice was skipped. That's the main flow it exists for: edit a VM, go back to the list. 778f1ab remembers what it notified on the component itself, so every visit starts fresh. It also compares by namespace and name, so a same-name VM in another namespace counts as a change (Pass B's second point). Live check: default/andy was marked as needing a restart in the browser only, then the same steps ran on all three builds:

Stepmain 97ce1e9PR 3de59dcfix 778f1ab
Open the listnoticenoticenotice
Sort, same VMs on the pagenonenonenone
Back from Volumesnoticenonenotice
Back from the VM's detail pagenoticenonenotice
Page 1 → page 2 → page 1 (4 rows)not pagednotice on returnnotice on return

Tests: 7 for the notice. Comparing with the watcher's previous value again fails the "new visit" test, and keying by name only fails 3 tests. The full suite passes: 445 tests, 1 skipped.

R2

"Only this UI writes the vmName label" was too strong

comment at the pod request, PR description
Fixed
Pass B (ours)re-checked by me

Harvester's VM importer (vm-import-controller, helper.go:51), restore to a new VM (restore.go:712) and its VM builder set it too. VMs from Forklift or a plain manifest lack it, like the forklift-vm-* on .105. The code comment and the description now say that. The pushed commit message of 3de59dc keeps the old wording.

Round two, FYI

A starting VM's pod

Pass B asked whether the pod now shows one update later. It doesn't: the pods are fetched in the same refresh, right after that refresh's VMIs, and a row can only show a pod through its VMI anyway.

The paged list opens ungrouped

That's the shell's behaviour for every paged list. Paged tables offer namespace grouping as metadata.namespace, and unpaged ones as namespace, so a saved "group by namespace" doesn't match and the table falls back to its first option, none. Same in Rancher's own paged lists.

Edge cases that hold

Pass B checked: during a live migration both launcher pods load and the list keeps the last, as main does; a VMI without a uid sends no request; a refresh racing a page change ends with the newest pods; the old, unpaged list behaves like main.

Housekeeping

All 21 round-two sessions and tokens are logged out; an audit by name on .105, .118 and mf found none left. .105 again shows about 14 admin sessions from someone else (it looks like the session working on PR 1263), left alone. A Playwright Chrome has been running on the Mac since 12 November (PID 3171). It predates this review, so it's left for you to decide.

Round two cost: Pass B 23 min, 92 calls, 222k tokens; Pass A ran in two parts (the usage limit cut it off once), 177k tokens. Round one follows below, unchanged.

Round one at d225838

Where it stands: works as designed, one regression to fix before review

What holds up: 11 of 12 acceptance criteria are met (Pass A). Side by side with main on the same backend, sort, search, the namespace filter, group by namespace, the state/IP/node cells and Add Volume behave the same, apart from the limits the description lists (Pass B). The old API keeps the full list, and extension mode on Rancher 2.16 pages correctly. Both passes ran 48/48 unit tests.

  1. Launcher pods are matched by a label many VMs don't have: running VMs not created in this UI lose View Logs and their pod states. Both passes found it on their own. Fix before marking ready.
  2. The restart warning only knows the current page: fix it or list it as a limit.
  3. A test for "paged mode doesn't load everything".
  4. The description: the backport caveat no longer holds (merge doesn't have to wait for it), and the draft reason is done.
  5. A console warning on each search (optional).

How the two passes compare

FindingPass A (Cody)Pass B (ours)After my re-check
1 Pods matched by a label many VMs lackC1B1 (blocker)Holds. B's "6 of 9" is 5
2 Restart warning covers the page onlyC2S1Holds, smaller than it reads
3 Tests miss a full reload–S2Holds (mutation repeated)
4 Description out of datesummary noteS3 (dialogs)Holds, merged into one
5 Console warning on search–N1Holds, optional
Stale pod page after a socket refresh–Q1FYI
Long filter URL through Rancherchecked standalone, droppedQ2Dropped: 38.9k chars pass through mf

Both found the main regression on their own and agreed on everything else they both looked at: paging, sort, search, the namespace filter, Add Volume and the gate on .118. Only A checked extension mode, built an acceptance table and recorded demos. Only B ran mutation tests, measured the per-page requests over 14 socket rounds and flagged the console warning. A's no-nits rule drops 5, which is why only B has it. Cost: A 24 min, 91 calls, 236k tokens; B 26 min, 107 calls, 276k tokens. B skipped extension mode for time; A did it.

Findings

1

Launcher pods are matched by a label many VMs don't have

pkg/harvester/list/kubevirt.io.virtualmachine.vue:375
Fix before ready
Pass A (Cody)Pass B (ours)re-checked by me

The paged list loads the page's launcher pods with metadata.labels[harvesterhci.io/vmName] IN (…). The VM model then finds a VM's pod by its owner, the VMI. That label is only written by this UI's create/edit form, into the VM template (mixins/harvester-vm/index.js:1062). Harvester's VMI webhook doesn't add it, and neither does KubeVirt.

So a running VM created any other way has no pod on its row: kubectl, Terraform, the VM import, or the lab VM zz1209-nodeselector on .118 (Pass A). That disables View Logs, and the starting and launcher-pod error states never show. Main loads every pod and matches by owner, so it finds them all.

Data: on .105, 5 of the 9 VMs (the forklift-vm-* imports) have no such label in their template (Pass B said 6; I counted 5). All 5 are stopped today, so the broken row only appears once one of them runs, which needs a write. The two running VMs (andy, vm123) carry both harvesterhci.io/vmName and KubeVirt's vm.kubevirt.io/name.

For the fix (ours, since it's our PR): KubeVirt puts vm.kubevirt.io/name on every launcher pod, but it is deprecated and its value is the VMI's hostname, which can differ from the VM name. kubevirt.io/created-by is the VMI's UID, known once the page's VMIs are loaded. Both need checking before picking one.

2

The restart-required warning only knows the current page

pkg/harvester/list/kubevirt.io.virtualmachine.vue:278
Decide: fix or document
Pass A (Cody)Pass B (ours)re-checked by me

vmRestartRequiredNames now reads the page's VMs, so the warning counts and names only VMs on the current page. A VM on page 2 that needs a restart after a hotplug is never mentioned. Main used every VM. The warning also pops up again on each page, sort or search change. Main already re-shows it whenever the VM list updates, so that part isn't new, but the new triggers make it noisier.

The PR description doesn't mention this limit (Pass A is right; the current body has no restart line). Seeing it needs a write: a VM that needs a restart, sitting on another page.

3

The tests don't catch a paged list that loads everything again

pkg/harvester/list/kubevirt.io.virtualmachine.vue:285
Before ready
Pass B (ours)re-checked by me

Removing the paged-mode check in created() makes the paged list load every VMI and migration again, which undoes the point of paging. All 14 list tests still pass; I repeated Pass B's mutation in a throwaway worktree. Pass B found the same for adding a full pod load to fetchSecondaryResources and for hard-coding force to false.

4

The PR description is out of date in two places

PR description
Before ready
Pass A (Cody)Pass B (ours)re-checked by me
5
Optional
Pass B (ours)re-checked by me

The shell warns "Pagination API does not support filtering 'kubevirt.io.virtualmachine' by the requested fields: metadata.annotations[harvesterhci.io/vmDisplayName]" on each search, because the field isn't in the shell's list for that type. The API accepts it, and display-name search works (Pass A AC6). Seen in 4 of 4 searches by Pass B, and in my runs today.

FYI, nothing to do

Long filter URLs are fine, through Rancher too

Pass B asked about the proxy path. Through mf's cluster proxy, PV filters up to 38,869 characters (900 names) returned 200; Pass A saw 13,006 characters pass standalone. The real ceiling is the SQL cache's ~993 values per filter, which a page reaches only if its 100 VMs average 10+ volumes. Even then the other per-page requests still load.

A socket refresh can briefly put back the previous page's pods

Pass B saw it once in 14 rounds: an older pod request landed after a newer one, and the result was a superset (harmless). Same store pattern as the shell's own paged lists; not filed.

Restore is better than before

Main listed backups of any VM with the same name in any namespace. Now it lists only the VM's namespace, where its backups live (Pass A).

422/500 on the side-nav count requests

The PR 1196 nav counts, identical on main (both passes). Not this PR.

Other admin sessions pile up on .105

During the review, 16 short-lived "UI session" tokens appeared on .105 that belong to neither pass nor me. Each was used for 15 to 90 seconds and never logged out, the same pattern as a test browser whose logout lacks the CSRF header. They're left alone; they expire after 16 hours.

Pass A's demos (same backend, same viewport)

Before this change (main)

Opening Virtual Machines sends the full lists (pagesize=100000) for VMs, VMIs, pods, PVCs, PVs, restores, backups and migrations.

With this change (PR)

One VM page per request, then IN-filtered requests for that page's resources; 4 rows per page gives page 2 as "5 - 8 of 9".

Extension mode: Rancher 2.16 on mf, cluster c-fwtnp, page 2

Virtual Machines list inside Rancher 2.16, page 2 of the paged list showing 5 - 8 of 9 Virtual Machines

Pass A's acceptance table (issue 9513 and its thread)

IdCriterionResult
AC1One page of VMs per requestMet
AC2Related resources only for the page, every VM gets what it needsPartly met (finding 1)
AC3Sort, search, namespace filter on the serverMet
AC4CPU, Memory, IP, Node shown but not sortable/searchableMet
AC5State sorts by printable statusMet
AC6Name sort; display name searchableMet
AC7VMIs without a VM dropped and called outMet (open question: called out to users?)
AC8No 422 from the paged requestsMet
AC9Labels filtered with metadata.labels[…]Met
AC10Old API keeps the full listMet (.118, also with v1.10 forced)
AC11Works as an extension in Rancher 2.16Met (mf, c-fwtnp)
AC12List intact after its dialogsMet (Add Volume live; Restore and Migration by unit tests)

11 met, 1 partly met. The slowness itself can't be shown with 9 VMs; the evidence is what each build requests.

What I'd do

One more commit on the branch, then the description

  1. Load the page's launcher pods in a way that works for every VM (1), and check it against a VM without the Harvester label. That check needs one write on .105 (start one forklift-vm-* VM, then stop it), so I'll ask first.
  2. Decide on the restart warning (2): your call between fixing it and listing it as a limit.
  3. Add the test that paged mode doesn't load every VMI, migration or pod (3).
  4. Update the description (4), then mark it ready when you say so.

Not checked

Environment and cleanup