Skip to content

feat: add CPU architecture (cpu_arch) to VM OS images#201

Merged
v0l merged 1 commit into
masterfrom
feat/183-os-image-cpu-arch
Jul 23, 2026
Merged

feat: add CPU architecture (cpu_arch) to VM OS images#201
v0l merged 1 commit into
masterfrom
feat/183-os-image-cpu-arch

Conversation

@v0l

@v0l v0l commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Problem

VmHost, VmTemplate and VmCustomTemplate all carry cpu_arch (x86_64 / arm64), but VmOsImage did not — the image catalog was architecture-blind, so nothing stopped an x86_64 cloud image being provisioned onto an arm64 host (or vice versa).

Change

  • Migrationvm_os_image.cpu_arch SMALLINT UNSIGNED NOT NULL DEFAULT 1 (x86_64), correct for all existing images.
  • Model — add cpu_arch to VmOsImage (lnvps_db) and persist it in the create/update SQL.
  • Provisioningprovision and provision_custom now reject an image whose architecture is incompatible with the chosen template. Unknown/unspecified on either side means "any", so legacy images/templates keep working.
  • User API — expose cpu_arch (optional string, omitted when unspecified) on GET /api/v1/image (VmOsImage).
  • Admin API — settable on POST /api/admin/v1/vm_os_images (defaults to x86_64 when omitted), nullable-resettable on PATCH /api/admin/v1/vm_os_images/{id} (send null to reset), and returned on the admin image info responses.
  • DocsAPI_DOCUMENTATION.md, ADMIN_API_ENDPOINTS.md, API_CHANGELOG.md.

Tests

  • ensure_image_arch_compatible — matching / "any" / mismatch cases.
  • Admin create cpu_arch parsing (explicit + default) and update nullable (null / value / absent).

Closes #183

VmHost, VmTemplate and VmCustomTemplate all carry cpu_arch, but
VmOsImage did not, so the image catalog was architecture-blind and
nothing stopped an x86_64 image being provisioned onto an arm64 host
(or vice versa).

- Migration adds vm_os_image.cpu_arch SMALLINT UNSIGNED NOT NULL
  DEFAULT 1 (x86_64), correct for all existing images.
- Add cpu_arch to VmOsImage (lnvps_db) and persist it in the create/
  update queries.
- Provisioning (standard + custom) rejects an image whose architecture
  is incompatible with the chosen template (Unknown on either side ==
  any, preserving legacy behaviour).
- Expose cpu_arch as an optional string on the public GET /api/v1/image
  (ApiVmOsImage) and the admin VM OS image endpoints: settable on create
  (defaults to x86_64), nullable-resettable on update, and returned on
  info responses.
- Docs: API_DOCUMENTATION.md, ADMIN_API_ENDPOINTS.md, API_CHANGELOG.md.

Unit tests cover the arch-compatibility helper and the admin
create/update cpu_arch parsing.

Closes #183
@v0l
v0l force-pushed the feat/183-os-image-cpu-arch branch from 7fbc15d to cddabce Compare July 23, 2026 14:11
@v0l
v0l merged commit e014bf5 into master Jul 23, 2026
8 checks passed
@v0l
v0l deleted the feat/183-os-image-cpu-arch branch July 23, 2026 20:18
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.

Add CPU architecture (cpu_arch) to VM OS images

1 participant