
On Sun, Feb 04, 2024 at 20:31:33 +1100, Julian Calaby wrote:
Hi,
I have a fancy new Ceph cluster and have configured a storage pool using it in libvirt. I have a bunch of disk images in a "filesystem directory" storage pool. I want to migrate those disk images into the RBD pool.
What is the process for doing this?
[...]
2. virsh blockcopy
This is the proper way to do it for any running VM as it's the only approach which preserves data consistency from VM writes, as well as updates XMLs.
No idea how to actually achieve what I want here as it doesn't seem capable of copying to a non-file destination.
'virsh blockcopy' does in fact support non-file destinations by passing the XML description identical to the <disk> element via the --xml argument. The XML for ceph/rbd should look like: <disk type='network'> <driver name="qemu" type="raw"/> <source protocol="rbd" name="image_name2"> <host name="hostname" port="7000"/> <auth username='myuser'> <secret type='ceph' usage='mypassid'/> </auth> </source> </disk> To run the blockcopy operation and then subsequently switch to the new image after it finishes additional arguments will be needed: virsh blockcopy --domain $VMNAME --path $SOURCEDISKTARGET --xml /path/to/xml --transient-job --verbose --pivot I don't recall now whether you might need to pre-create the properly-sized rbd volume in ceph or qemu can do that for you. For a non-running VM I suggest you either start it, or start it with paused CPUs (if you don't want to run the guest OS) for the duration of the copy.
3. virsh vol-download and virsh vol-upload
# mkfifo tmp # virsh vol-create --pool ceph volume.xml Vol volume created from volume.xml
root@multimedia:~# virsh vol-list ceph Name Path ------------------------------------------ torrentbucket VM_images/volume
root@multimedia:~# virsh vol-download --pool default volume.qcow2 tmp & [1] 2483977 root@multimedia:~# virsh vol-upload --pool ceph volume tmp error: cannot upload to volume volume error: this function is not supported by the connection driver: storage pool doesn't support volume upload
This won't work, as nobody yet volunteered to implement the data operations for the native RBD/ceph libvirt pool type. You'd need to make the rbd volumes available in the host OS as files to be able to use storage driver APIs