Skip to content

microvm: at a platform restore, read zeros past a shorter image and from an absent fresh scratch #856

Closed

Description

Parent: #835, the OpenVMM stage of the snapshot/restore workstream (#833). Enables: #848.

Goal. One platform template serves images of any length up to its distro capacity, and clones that use a RAM upper restore with no scratch file. The change lands in OpenVMM; a PR here moves NVX's pin with VMM-level snapshot scenarios, as #801 does for #796.

Today (OpenVMM 79a501b6, NVX's pin):

  • A disk's size is its file length (openvmm/openvmm_entry/src/storage_builder/microvm.rs:247), and every snapshot-capable disk needs a nonempty raw file (:190-197, :248-251).
  • Restore compares every disk field exactly, including the access, the length and the block sizes (openvmm/openvmm_helpers/src/snapshot/microvm.rs:1633-1647).
  • A fresh-scratch restore requires a scratch file (openvmm/openvmm_entry/src/microvm/restore.rs:369-374).
  • The logical block size is 512 bytes, and the physical block size is the backing filesystem's on Linux and 4096 on Windows (storage_builder/microvm.rs:252-262).

Expected behavior:

  • distro:
    • A platform restore presents the template's distro capacity, the placeholder's size, before any vCPU runs.
    • Reads inside the image go to the image. Reads past its end return zeros, including a request that crosses the end. Nothing resizes, pads or writes the image file.
    • An image longer than the capacity, or with different logical or physical block sizes, is refused.
  • Scratch:
    • A platform restore may declare its fresh scratch absent, explicitly. OpenVMM then attaches the scratch device with no file, at the captured length and block sizes, taken from the manifest.
    • Reads return zeros, and writes fail with an I/O error. The guest negotiated the device as writable at the template's boot, and restore compares the access, so the device stays writable: its writes are refused, never dropped or kept in host memory.
    • Only a fresh scratch, the platform tier's, may be absent. A scratch file, when given, keeps the exact captured length.
  • Other tiers, and every disk outside a platform restore, keep today's exact rules.

Acceptance:

  • VMM tests: reads within, across and past a shorter image's end; a longer image and a block-size mismatch, refused; an absent scratch that reads zeros and fails writes; an absent scratch refused outside a platform restore.
  • NVX's pin moves to the change, with snapshot scenarios on KVM, MSHV and WHP.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions