feat: add CPU architecture (cpu_arch) to VM OS images#201
Merged
Conversation
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
force-pushed
the
feat/183-os-image-cpu-arch
branch
from
July 23, 2026 14:11
7fbc15d to
cddabce
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
VmHost,VmTemplateandVmCustomTemplateall carrycpu_arch(x86_64 / arm64), butVmOsImagedid 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
vm_os_image.cpu_arch SMALLINT UNSIGNED NOT NULL DEFAULT 1(x86_64), correct for all existing images.cpu_archtoVmOsImage(lnvps_db) and persist it in the create/update SQL.provisionandprovision_customnow reject an image whose architecture is incompatible with the chosen template.Unknown/unspecified on either side means "any", so legacy images/templates keep working.cpu_arch(optional string, omitted when unspecified) onGET /api/v1/image(VmOsImage).POST /api/admin/v1/vm_os_images(defaults tox86_64when omitted), nullable-resettable onPATCH /api/admin/v1/vm_os_images/{id}(sendnullto reset), and returned on the admin image info responses.API_DOCUMENTATION.md,ADMIN_API_ENDPOINTS.md,API_CHANGELOG.md.Tests
ensure_image_arch_compatible— matching / "any" / mismatch cases.cpu_archparsing (explicit + default) and update nullable (null/ value / absent).Closes #183