Skip to content

Expose host CPU architecture on customer VM status (#210)#211

Merged
v0l merged 2 commits into
masterfrom
feat/210-vm-status-host-cpu-arch
Jul 24, 2026
Merged

Expose host CPU architecture on customer VM status (#210)#211
v0l merged 2 commits into
masterfrom
feat/210-vm-status-host-cpu-arch

Conversation

@v0l

@v0l v0l commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Fixes #210.

Summary

The customer VM status only carried CPU architecture indirectly via template.cpu_arch, an optional template constraint that is omitted when the template doesn't pin an architecture. This adds the host's concrete architecture to the VM status so clients are never architecture-blind.

Changes

  • Add optional cpu_arch ("x86_64" | "arm64") to ApiVmStatus (GET /api/v1/vm/{id}, GET /api/v1/vms), sourced from the host record.
  • vm_to_status reuses the get_host fetch already done for host_sunset_date; the Unknown sentinel maps to None (field omitted).
  • Read-only, additive — no breaking change.
  • Unit test covers x86_64, arm64, and omitted-unknown.
  • Docs + changelog updated.

Lets clients always pass ?arch= when listing OS images for a reinstall (#202), avoiding incompatible images that #183 rejects at provisioning.

Related: #183, #202.

v0l added 2 commits July 24, 2026 10:46
Add an optional cpu_arch string to ApiVmStatus, sourced from the host
record rather than the template constraint, so it is present whenever the
host arch is known. Clients can then always pass ?arch= when listing OS
images for a reinstall (#202) and avoid offering images that would fail
provisioning (#183).

- Reuse the existing get_host fetch in vm_to_status (for host_sunset_date)
  to also derive cpu_arch; the Unknown sentinel maps to None/omitted.
- Unit test covers x86_64, arm64, and the omitted-unknown case.
- Docs + changelog.
vm_to_status now takes the VM's host as a parameter (like the running
state) rather than fetching it internally. GET /api/v1/vms bulk-loads all
hosts once (there are few) and indexes them by id, avoiding one host
query per VM. Single-VM handlers pass a single get_host result. Tests
updated to supply the host.
@v0l
v0l merged commit e5a0f3f into master Jul 24, 2026
7 of 8 checks passed
@v0l
v0l deleted the feat/210-vm-status-host-cpu-arch branch July 24, 2026 10:15
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.

Expose the host's CPU architecture on the customer VM status

1 participant