[sdk] creating a blank volume with image properties
John Ratliff
jdratlif at globalnoc.iu.edu
Tue May 3 13:14:41 UTC 2022
We're standing up a second openstack cluster to do a leapfrog migration
upgrade. We are using the same ceph storage backend. I need to create
volumes in the new openstack cluster that use the underlying ceph rbd.
Currently, we are creating a volume in the new openstack cluster,
deleting the rbd created by openstack, and renaming the original rbd to
match the new openstack mapping. This process loses the image properties
from the original volumes. We are using virtio-scsi for the disk block
device, and want to continue doing that in the new cluster. When we
create the server using the new volume in the new openstack cluster, it
reverts to using virtio-blk (/dev/vda).
What can I do to keep using our image properties in the newly created
volume? I thought I could just pass volume_image_metadata as an argument
to create_volume(), but it doesn't work. I end up with an image that has
no image metadata properties.
import openstack
openstack.enable_logging(debug=False)
conn = openstack.connect(cloud="test")
v = conn.create_volume(
name="testvol",
size=5,
wait=True,
bootable=True,
volume_image_metadata={
"hw_scsi_model": "virtio-scsi",
"hw_disk_bus": "scsi",
"hw_qemu_guest_agent": "yes",
"os_require_quiesce": "yes",
"hw_rng_model": "virtio",
"image_id": "00000000-0000-0000-0000-000000000000",
},
)
What can I do to create this openstack volume while preserving my
original volume properties?
Since we don't care about the image, I thought about creating a blank
image that the volume could be based on with those properties, but I'm
looking for suggestions.
Thanks.
--John
More information about the openstack-discuss
mailing list