Created an Ubuntu Server 14.04 image by making a new VM in Hyper-V, installing from an attached ISO image, saving. Hyper-V disk size was set to 20Gibytes. After installing and turning off this VM, I've uploaded VHD file to glance.

Trying to launch an instance from this image on my Hyper-V machine, I get this:

VHDResizeException: Cannot resize a VHD to a smaller size, the original size is 21474836480, the newer size is 21441282048

in my nova-compute log. Now, 21474836480 is exaclty 20 * 2 * 30 or 20Gibytes. And 21441282048 is exactly 32 * 2 * 20 less than that. Where are the missing 32 Mibytes going? Is this a Glance issue?

Any possible workarounds? Like create the VM by hand with a 19Gibyte VHD, upload that to Glance, then create instances from it? Manually change my instance sizes, adding 32Mibytes to the disk somewhere?

1 answer

You have to use a slightly bigger flavor than the image size as the VHD/VHDX format has a small overhead because of the internal metadata. e.g. For a 20GB image to be on safe side you should use a 21GB flavor.