Resized instance doesn't track new flavor, leading to possible instance-from-snapshot creation failures

Bug #1565590 reported by John Wood on 2016-04-04
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)

Bug Description

To reproduce the issue, follow these steps:
1) Create s small instance
2) Resize to a larger instance
3) Create a snapshot image from the resized instance
4) Create an instance from this snapshot image, selecting the smallest flavor based on the snapshot image’s ‘min_disk’ value

The expected result is that in step #4 the image’s ‘min_disk’ value can be used to select a minimum sized flavor for a new instance, leading to a successful instance creation.

The actual result is that the minimum sized flavor suggested by ‘min_disk’ is too small for the snapshot image, so instance creation fails with a 'VM too large for selected flavor' error here:

This error is seen in a deployment using Xen hypervisors with Glance/Swift for image storage.

For more detailed information:

When an instance is created information about it’s image is placed into the instance’s system metadata. One image property is specially treated however: min_disk. The instance’s ‘min_disk’ value is set based on the re-size flavor’s ‘root_gb’ (see When a snapshot image is created from the instance, the instance’s ‘min_disk’ value is added to image’s properties. This ‘min_disk’ setting can then be used as per step #4 above.

When the instance is resized (typically to a larger flavor) the instance’s ‘min_disk’ is *not* updated with the new flavor’s ‘root_gb’ (however the instance’s ‘root_gb’ is updated from the flavor). Hence when a snapshot image is created from this instance, the resultant image’s ‘min_disk’ is also set to the pre-resized value. For resize ups then, this value is then too small for the virtual disk size the snapshot will consume when instances are created from it.

A proposed fix for this issue then is to set the snapshot image’s ‘min_disk’ property in a similar way to the nova/ call above:

     min_disk = instance’s min_disk
     if flavor:
         if instance’s disk_format == ‘vhd’:
             min_disk = resize flavor’s root_gb
             min_disk = max(min_disk, resize flavor’s root_gb)

The instance’s ‘min_disk’ could stay set to the original image properties for historical purposes.

John Wood (john-wood-w) on 2016-04-04
Changed in nova:
assignee: nobody → John Wood (john-wood-w)
tags: added: xen
John Wood (john-wood-w) on 2016-04-04
description: updated
Matt Riedemann (mriedem) on 2016-04-04
tags: added: resize
Changed in nova:
status: New → Triaged
importance: Undecided → Medium

Fix proposed to branch: master

Changed in nova:
status: Triaged → In Progress

Change abandoned by Michael Still (<email address hidden>) on branch: master
Reason: This patch has been sitting unchanged for more than 12 weeks. I am therefore going to abandon it to keep the nova review queue sane. Please feel free to restore the change if you're still working on it.

Sean Dague (sdague) wrote :

There are no currently open reviews on this bug, changing the status back to the previous state and unassigning. If there are active reviews related to this bug, please include links in comments.

Changed in nova:
status: In Progress → Triaged
assignee: John Wood (john-wood-w) → nobody
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers