Member-only story
Ceph: Moving Virtual Machine Image (Part I)
From a Ceph cluster to another Ceph cluster
This article covers moving VM images in a Ceph cluster as rbd image into another Ceph cluster. We also change the baremetal machine where VMs are running.
We assume that there are two Ceph clusters and each has libvirt-pool rbd pool and an associated client named libvirt.
The first step is to get domain.xml.
virsh dumpxml [vm]
The next step is to get image files from one Ceph cluster and put them into another cluster. Before we do that, we will create two aliases for conciseness.
alias rbd1="sudo rbd --conf ceph1.conf --id libvirt --keyring libvirt1.keyring"
alias rbd2="sudo rbd --conf ceph2.conf --id libvirt --keyring libvirt2.keyring"
Here, ceph1.conf and libvirt1.keyring are ceph.conf and libvirt.keyring for the first cluster. Similarly, ceph2.conf and libvirt2.keyring for the second cluster. This is an arbitrary choice. You can choose any file name.
For completeness, the commands that gives these two files are given below.
sudo ceph config generate-minimal-conf # ceph.conf
sudo ceph auth get client.libvirt -o [file] # libvirt.keyring
Now, let’s get rbd images from Ceph cluster.
rbd1 export --pool libvirt-pool --image [rbd image] [filepath]