1

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

Victor Lee
  • 2,467
  • 3
  • 19
  • 37
  • IIUC this has nothing to do with the `resize` operation. `openstack server resize` just applies a different flavor (more RAM, VCPU etc.) to the same disk image. If your base image is in qcow format you should not change it to raw and the other way around. If you want to reformat an image you should download it `openstack image save...` and then use `qemu-img convert ...` to use a different format and then upload it back to glance with the appropriate format. But then you'll have two different images in your glance store. If I misunderstood your question please clarify. – eblock Aug 11 '21 at 07:24
  • @eblock it's not about image's format, it's only the instance format. no matter about the `image(glance)`'s format, the instance format only dependent on `[libvirt]`'s `image_type`. – Victor Lee Aug 11 '21 at 08:26
  • The instance format is the image format, an instance is launched from a base image, so those are definitely linked. I'm still not sure what you're trying to achieve by changing the libvirt image_type. – eblock Aug 11 '21 at 10:47
  • Check from this: "https://docs.openstack.org/nova/latest/configuration/config.html#libvirt.images_type" or the first comment or this "https://stackoverflow.com/questions/68226802/which-nova-compute-libvirts-images-type-better-for-me-raw-or-qcow2-glance-ima" . – Victor Lee Aug 11 '21 at 13:40
  • Now I understand. If you enable debug logs for nova-compute you should see the exact command and maybe can reproduce manually what’s going wrong. Although since the instance is started successfully there’s nothing going wrong from openstack point of view. – eblock Aug 11 '21 at 15:20

2 Answers2

1

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

melwitt
  • 26
  • 3
0

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).
Victor Lee
  • 2,467
  • 3
  • 19
  • 37