Search code examples
resizelocalopenstackopenstack-novaraw

how openstack resize instance with raw format's local disk


Instance using local disk, the configure file: nova-compute/nova.conf

[libvirt]
images_type = qcow2

execute openstack server resize works well.

but when using raw

[libvirt]
images_type = raw

the instance console get:

enter image description here

Is there any method to resize the raw format local disk instance successful ? THX


Solution

  • You may need to set one additional configuration option [1] to enable resize to work with the raw image backend:

    [DEFAULT]
    use_cow_images = False
    
    [libvirt]
    images_type = raw
    

    When use_cow_images = True the libvirt driver will convert raw images to qcow2 when finishing resizes or cold migrations [2][3]. This will break the instance trying to come back up after the resize because the libvirt driver will generate instance XML indicating disk format rawwhile the disk file image has actually been converted to qcow2. The mismatch results in an un-bootable instance.

    Based on this, I think if you want to use raw images, you must also configure:

    [DEFAULT]
    use_cow_images = False
    

    to avoid the image format conversion.

    [1] https://docs.openstack.org/nova/latest/configuration/config.html#DEFAULT.use_cow_images

    [2] https://opendev.org/openstack/nova/commit/61b34ed

    [3] https://opendev.org/openstack/nova/commit/7b15ed3