Skip to content

Feature/replicas and media - #24

Merged
wvcollenburg merged 9 commits into
masterfrom
feature/replicas-and-media
Nov 22, 2026
Merged

wvcollenburg merged 9 commits into
masterfrom
feature/replicas-and-media

Conversation

@wvcollenburg

@wvcollenburg wvcollenburg commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

What this is

Two features found while using 1.8.1 day to day, plus a fix and a speed-up:

  • Replicas are recognised in the VM list instead of showing as stopped VMs.
  • Media management: ISOs and disk images per cluster, owned by a layer of the tenant tree.
  • New VM with an ISO works (it failed on the CD-ROM step).
  • A VM change made in HCM shows within seconds instead of minutes.

One commit per change. The CHANGELOG has the full list under 1.9.0.

Replicas

HyperCore marks a replication target with sourceVirDomainUUID. The collector records it, and the VM list shows replicas in their own Replicas section, always last whatever the grouping, with a replica badge instead of shutoff. When the user may see the source cluster in full, the line says replica of <VM> on <cluster>.

Media management

HyperCore keeps ISOs and disk images per cluster and knows nothing of tenants: every customer on a cluster saw every ISO in the New VM and Edit dialogs. Now each item has an owner layer:

  • What you upload belongs to your highest layer (MSP, customer or folder) that holds the new permission Manage ISOs and disk images (media.manage) over that cluster. That layer sees it, and a customer's or folder's upload is seen in its folders too. The layers above do not see it.
  • An MSP's upload stays the MSP's until it gives it to one of its own customers, down the cluster's branch.
  • Everything already on a cluster, or put there outside HCM, belongs to the top-level administrators, who see everything.
  • The owner layer (or the top) gives an item away and deletes it. An ISO still in a CD-ROM cannot be deleted.
  • New VM and Edit offer, and the server accepts, only media the user may see.

There's a new Media tab in the Infraviewer. Upload ISO and Upload disk image stream the file from the browser through the dashboard and the backup service into the cluster, with a progress bar per upload.

HyperCore converts qcow2/vmdk/vhd(x) images to its own SCRIBE format after the upload. Meanwhile the image is listed as uploading-<name>, the upload request may end in a 502 or get no answer, and the converted image gets a new uuid. HCM waits for the conversion and keeps the uploader's ownership. media.manage is in the built-in Admin and Engineer roles; migration 059 adds config.media.

Fixes and speed

  • New VM with an ISO failed after creating the VM and its disk (One or more required properties missing: capacity): HyperCore wants a capacity for every new block device, CD-ROM drives included. Adding a CD-ROM drive in VM edit had the same fault.
  • A VM change made in HCM shows within seconds:
    • When a VM change set or a restore finishes, the backup service sends a PostgreSQL notification.
    • The collector polls that cluster at once, and once more after 5 s.
    • The VM list drops a VM the newest poll no longer reports.
    • The open list follows a running change every 4 s.

Upgrade notes

  • Behind nginx, uploads need client_max_body_size 0, proxy_request_buffering off and a long proxy_read_timeout on /api/media/upload. Installing and updating has the block.
  • Custom roles copied from Engineer before 1.9.0 do not get media.manage by themselves.

Testing

  • Unit: 1108 passed in a clean python:3.12 with only tests/requirements.txt (as CI runs it).
  • Live on a lab cluster:
    • Replicas and their Lab241 sources in the VM list, under every grouping.
    • Uploads by a folder admin and a top-level admin: owners, who sees what, the New VM dialog offering only visible media, giving an item down the tree, delete rights. A qcow2 through HyperCore's conversion; an upload through the Media tab in a browser.
    • New VM with an ISO, and a CD-ROM drive added through edit.
    • A new and a deleted VM showing in the VM list 0.3 to 1.2 s after their change finished, twice each.

Known limitations

  • VMs created or deleted in HyperCore's own UI still show at the next regular poll (up to 30 s).
  • A near-empty large qcow2 (1 GB virtual, 200 kB file) stayed in HyperCore's conversion for over 25 minutes and never finished; normal images converted in seconds.

William David van Collenburg added 9 commits November 22, 2026 21:20
…ion at the bottom

A replication target (a VM HyperCore keeps up to date from a source VM on another cluster)
was shown as an ordinary stopped VM, mixed in with the real ones. HyperCore marks one with
sourceVirDomainUUID; the collector now records it on the VM's inventory, and the VM list puts
replicas in a Replicas section that always comes last, whatever the grouping, with a
'replica' badge instead of 'shutoff' and, when the user may see the source cluster in full,
'replica of <VM> on <cluster>' (4 languages, manual).
HyperCore keeps ISOs and uploaded disk images per cluster and knows nothing of tenants: every
customer on a cluster saw every ISO and disk image in the New VM and VM edit dialogs. They now
have an owner layer (config.media, migration 059):

- an upload through HCM belongs to the uploader's highest layer that holds the new permission
  media.manage over that cluster (in the built-in Admin and Engineer roles);
- what was on the cluster before, or came in another way, belongs to the top-level admins;
- the owner layer sees an item, and below it within the same tenant (a customer's folders),
  never the layers above; an MSP's upload stays the MSP's until it assigns it to one of its own
  customers, down the cluster's branch; top-level admins see everything;
- the owner layer (or the top) assigns and deletes.

The backup service lists a cluster's media (with the VMs whose CD-ROM holds each ISO), streams
an upload into it (an ISO is created, filled and made ready; a disk image becomes a
VirtualDisk; a half-uploaded ISO is removed) and deletes one (not while it is inserted).
The dashboard's /api/media routes apply the rules, and the VM edit and New VM dialogs only
offer, and the server only accepts, media the user may see.
…k images

Next to VMs, Nodes, VM performance and Cluster events, for whoever may use media on the
selected cluster (media.manage, vm.create or vm.edit): the ISOs (with the VMs whose CD-ROM
holds each) and disk images this user may see, their owner layer and who they are given to.
Upload ISO / Upload disk image stream the file as it is read, with a progress bar per upload
that survives refreshes, a cancel button, and a warning before leaving the page mid-upload.
The owner layer (or the top) gives an item to layers down the cluster's branch and deletes it
(typing its name). 4 languages.

Also: the per-cluster tabs are checked again once the clusters are known (on a fresh sign-in
the first check ran before a cluster was selected and hid the tab), and an unreachable backup
service is a 503 on the media list, not a 500.
…angelog

The Infraviewer chapter explains the Media tab (who owns, sees, gives and deletes an ISO or
disk image) and the Replicas section; Settings names the new permission and that custom roles
copied before do not have it; the installing chapter gives the nginx block uploads need (no
body limit, no request buffering, a long read timeout); the changelog has an Unreleased entry.
…ormat

Live on WDvCN11 (9.8): HyperCore converts an uploaded qcow2 (and vmdk, vhd) to its own SCRIBE
format after receiving it. Meanwhile it lists the image as 'uploading-<name>', the upload
request ends in a 502 from HyperCore's nginx or gets no answer at all, and the converted image
has a new uuid. A raw .img is taken at once.

The backup service now treats a 502/504 or a timeout after the whole body went out as
'accepted' when the image is on the cluster, waits up to 15 minutes for the converted image and
answers 201 with its new uuid (202 'still converting' after that). The dashboard keeps the
uploader's ownership under the file name until the converted image appears, and the Media tab
shows a converting image to its owner as 'converting on the cluster' (deletable, not given
away yet). The give-to dialog names each layer's level (an MSP and a customer can share a name).
…ated

HyperCore requires a capacity for every new block device, CD-ROM drives included. New VM sent
none for its CD-ROM, so a New VM with an ISO failed with 'One or more required properties
missing: capacity' after the VM and its disks had been created (William, 2026-11-22); adding
a CD-ROM drive in VM edit had the same fault. Both send capacity 0 now: the inserted ISO gives
the drive its size. Verified on WDvCN11: a New VM with the Fedora ISO gets its CD-ROM with
the ISO in it and the boot order set, and an empty drive can be added.
…n seconds

A deleted VM stayed listed for minutes: the collector only noticed at its next poll, and the
dashboard kept a VM until its last performance sample was older than the stale threshold.

- the backup service sends a PostgreSQL notification (hcm_inventory, the cluster id) when a VM
  change set (delete, New VM, edit, power, clone, snapshot) or a restore finishes;
- the collector listens for it and polls that cluster at once, and once more 5 s later;
- the VM list keeps only the VMs of the newest inventory poll (one poll's points share one
  timestamp), so a deleted VM goes with the first poll that no longer lists it;
- while a change set runs, the list refreshes every 4 s, and once more after it ends.

Measured on WDvCN11: a new VM and a deleted VM show 0.3 to 1.2 s after their change finished.
@wvcollenburg
wvcollenburg merged commit d360288 into master Nov 22, 2026
3 checks passed
@wvcollenburg
wvcollenburg deleted the feature/replicas-and-media branch November 23, 2026 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant