2016-04-04 15:10:49 |
John Wood |
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: https://github.com/openstack/nova/blob/master/nova/virt/xenapi/vm_utils.py#L901
This error is seen in a deployment using Xen hypervisors with Glance/Swift for image storage. |
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: https://github.com/openstack/nova/blob/master/nova/virt/xenapi/vm_utils.py#L901
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 https://github.com/openstack/nova/blob/master/nova/utils.py#L1229). 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/utils.py call above:
min_disk = instance’s min_disk
if flavor:
if instance’s disk_format == ‘vhd’:
min_disk = resize flavor’s root_gb
else:
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. |
|