Skip to content

nvx-rs: images shorter than a template's capacity, and tmpfs clones without a scratch #848

Closed

Description

Parent: #836 (#833). Needs: stage 1 (#834), and zero fill (#856) in NVX's OpenVMM pin. Removes: the exact image length, and the sparse scratch files.

Goal. One template serves images of any length up to its capacity, in either format, and tmpfs clones restore with no scratch file at all.

Today, after stage 1: the host library refuses any image whose length isn't exactly the placeholder's, and gives each tmpfs clone a sparse scratch file of the template's scratch length.

Implementation:

  1. Images: the host library admits an image no longer than the template's distro capacity, with the same logical and physical block sizes, and refuses a longer one before launch. OpenVMM presents the capacity, and reads zeros past the image's end. On Linux the physical block size is the backing filesystem's, so an image must sit on a filesystem with the placeholder's block size.
  2. Absent scratch: a tmpfs clone's restore declares the fresh scratch absent, through zero fill's restore option. OpenVMM attaches the device with no file, reads zeros, and fails writes. The host library stops creating sparse files.
  3. Guest: no change. The guest already rereads the partition table (nvx-rs: activate a clone's root for GPT images and either upper, with its export, network settings and workload view #845), and a shorter GPT image passes nvx::gpt, which only requires the backup header to lie inside the disk (nvx-rs/src/gpt/mod.rs:591-593). A tmpfs clone never writes to the scratch.

Tests, in the test adapter's CI hook on KVM, MSHV and WHP:

  • shorter EROFS and GPT images, both formats from one template;
  • longer images, and images on a filesystem with another block size, refused before launch;
  • tmpfs clones with no scratch file.

Guide (#591's numbering): 2.1.3 and 3.4.4 (the presented capacity, apart from the image's length), 3.4.5 and 5.5.2 (an absent scratch read as zeros), 5.4.7 (attachments at restore). The interim rule leaves the guide.

Done when: merged, with the interim rule's tests replaced by these.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions