Victor Lee
Victor Lee

Reputation: 2658

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

Upvotes: 1

Views: 802

Answers (2)

melwitt
melwitt

Reputation: 26

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

Upvotes: 1

Victor Lee
Victor Lee

Reputation: 2658

In my test, there is one stupid method but it works:

  • 1, openstack server stop original_instance and openstack server remove port original_instance original_port.
  • 2, openstack image create with the original instance's raw format's disk file (image named disk_img in the below).
  • 3, openstack server create new_instance --image **disk_img** with original_port and new_flavor(disk capability can't smaller than original).

Upvotes: 0

Related Questions