Skip to content

Derive min_disk from the image's virtual size - #1293

Open
toreanderson wants to merge 1 commit into
osism:mainfrom
toreanderson:min-disk-virtual-size
Open

toreanderson wants to merge 1 commit into
osism:mainfrom
toreanderson:min-disk-virtual-size

Conversation

@toreanderson

Copy link
Copy Markdown
Contributor

Nova refuses to boot an image on a root disk smaller than the image's virtual size. set_properties raises min_disk only to the size of the image data, cloud_image.size rounded up to GiB. For a compressed qcow2 that is a fraction of the virtual disk, so:

  • a definition without min_disk gets 1 GiB, for an image that may need 10;
  • a definition whose min_disk is too small is never corrected, so the image advertises a disk size Nova then refuses.

For example, Ubuntu 24.04's cloud image is 0.6 GiB of qcow2 data, but its virtual disk is 3.5 GiB. AlmaLinux 9's is 0.55 GiB of data and a 10 GiB virtual disk.

Changes

  • The floor becomes the virtual size. After import, min_disk is raised to the virtual size Glance reports, rounded up to whole GiB, and to the size of the image data when Glance reports no virtual_size.
  • A definition's value is used when it is at least that; one below it is overridden, with a warning, so it can be fixed.
  • min_disk becomes optional in the schema. Without it, the manager sets the floor.
  • At most one update_image call for min_disk, instead of up to two.

Testing

  • test_set_properties_min_disk covers:

    • definitions above, at and below the virtual size;
    • no definition;
    • no reported virtual_size;
    • no update when the value is already right.

    The cases that change behaviour fail on main.

  • test_image_min_disk covers rounding; test_schema_min_disk_optional covers the schema.

  • End to end on an OpenStack cloud: a sync of Debian 13, Ubuntu 24.04 Minimal and Rocky 10 from definitions without min_disk set it to 3, 4 and 10 from the virtual_size Glance reported after import, without warnings. Each then booted from a volume of exactly that size.

  • Separately, 14 cloud images (AlmaLinux, CentOS Stream, Debian, Rocky, Ubuntu) were booted from volumes of exactly their rounded-up virtual size, 3–10 GiB, all successfully.

🤖 Generated with Claude Code

Nova refuses to boot an image on a root disk smaller than its virtual
size, but min_disk was only ever raised to the size of the image data.
For a compressed qcow2 that is a fraction of the virtual disk, so a
definition without min_disk got 1 GiB for an image needing 10, and a
too small min_disk in a definition went uncorrected.

Raise min_disk to the virtual size Glance reports once an import has
finished, rounded up to whole GiB, falling back to the size of the
image data when it reports none. A definition may still ask for more;
one asking for less is overridden, with a warning. min_disk becomes
optional in the schema, since the manager can now work it out.

Assisted-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Tore Anderson <tore@redpill-linpro.com>

This branch has not been deployed

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

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

2 participants