Hi Peter,

On Mon, Feb 5, 2024 at 6:45 PM Peter Krempa <pkre...@redhat.com> wrote:
>
> 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

And that disk XML is the secret sauce I was looking for. This worked
perfectly and was surprisingly quick too.

> 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.

It does create the image automatically for you.

Thanks so much!

-- 
Julian Calaby

Email: julian.cal...@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
_______________________________________________
Users mailing list -- users@lists.libvirt.org
To unsubscribe send an email to users-le...@lists.libvirt.org

Reply via email to