On 10/09/2014 03:01 PM, Vasiliy Tolstov wrote:
I have lvm based (thin pool) storage on local disks. I need to move
vps from one vg on one disk to another. Does it possible to migrate to
localhost with blockcopy migration to another vg?
I'm understand that i can move lv from one vg to another, but i don't need that.
So to restate and make sure I understand what you are asking, you have a
running guest that you want to leave running, where the guest is
currently using /path/to/vg1/lv1 (remote), and where you want to alter
it to use /path/to/vg2/lv2 (local).
If I'm correct, libvirt live block migration can do that; however, it
requires that your domain be temporarily marked transient (due to the
fact that the operation cannot be efficiently restarted; we hope to lift
that restriction when some future qemu gives us better control over
persistent dirty bitmaps).
virsh dumpxml $dom > dom.xml
virsh undefine $dom
virsh blockcopy $dom /path/to/vg1/lv1 /path/to/vg2/lv2 --verbose --pivot
edit dom.xml to change /path/to/vg1/lv1 to /path/to/vg2/lv2
virsh define dom.xml
which will use qemu to copy the entire disk contents into a new location
(that third step is potentially slow).
Note that with new enough libvirt and qemu, you can get even fancier and
faster, by using external commands that can move an lv between vgs with
minimal copying time (I don't personally know lvm commands well enough
to say what the sequence is, only that I suspect it can be done without
the overhead of copying the entire lv by instead adjusting bookkeeping
of which vg owns the lv):
virsh snapshot-create-as $dom --no-metadata --disk-only \
--diskspec vda,file=/path/to/wrapper1.qcow2
work your magic to move/copy vg1/lv1 into vg2/lv2
qemu-img create -f qcow2 \
-o backing_file=/path/to/vg2/lv2,backing_fmt=qcow2 \
/path/to/wrapper2.qcow2
virsh dumpxml $dom > dom.xml
virsh undefine $dom
virsh blockcopy $dom vda --reuse-external \
/path/to/wrapper2.qcow2 --shallow --verbose --pivot
edit dom.xml to change wrapper1 to wrapper2
virsh define dom.xml
virsh blockcommit $dom vda --pivot --shallow --verbose
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org