Hello, I use libvirt on machines without shared storage. My VM's have all one qcow2-disk, with the same name as the VM. When I want to migrate a VM, I check if there is an qcow2 image on the other host with that name. When that's not the case, I copy the image using rsync first. If the image excist, I don't do that, and I think that "--copy-storage-inc" will do it. But I don't know how intelligent "--copy-storage-inc" is. I use LVM inside the VM's, and it's possible that I have changed the size of a volume for example. My questions: Is "--copy-storage-inc" intelligent enough for such tasks? Is there documentation what is done during migration? Is it using rsync? Is it possible to make the migration process more verbose? Is what I do a good way? With regards, Paul van der Vlis BTW: this is what I do, sometimes the lines are broken wrong: ----------- # Rsync image when not on the other host: if test `ssh $other "if test -e /data/$vm.qcow2; then echo ja; else echo nee; fi"` = "nee"; then echo "rsync..." rsync /data/$vm.qcow2 $other://data/$vm.qcow2 if test $? = 0; then echo "gelukt"; else echo "niet gelukt"; exit; fi fi # migrate echo "migrate..." virsh migrate --live --p2p --tunnelled --copy-storage-inc --persistent --undefinesource --verbose $vm qemu+ssh://$other/system if test $? = 0; then echo "gelukt"; else echo "niet gelukt"; exit; fi ----------- -- Paul van der Vlis Linux systeembeheer Groningen https://www.vandervlis.nl/
On Sun, Feb 10, 2019 at 12:11:42 +0100, Paul van der Vlis wrote:> Hello, > > I use libvirt on machines without shared storage. My VM's have all one > qcow2-disk, with the same name as the VM. > > When I want to migrate a VM, I check if there is an qcow2 image on the > other host with that name. When that's not the case, I copy the image > using rsync first. If the image excist, I don't do that, and I think > that "--copy-storage-inc" will do it.Note that using the 'inc' or incremental mode will copy only the data in the top level image rather than a full copy. This means that you need to pre-create empty qcow2 files which point to the correct backing store.> But I don't know how intelligent "--copy-storage-inc" is. I use LVM > inside the VM's, and it's possible that I have changed the size of a > volume for example.Non shared storage migration preserves the guest visible state.> > My questions: > Is "--copy-storage-inc" intelligent enough for such tasks?If used with --tunelled you can only use it if you wish to migrate ALL disks in such a VM and need to pre-create the correct files. If you wish to migrate only certain disks you need to stop using --tunelled.> Is there documentation what is done during migration? Is it using rsync?Normally (if --tunneled is not used) it's using blockdev-mirror or drive-mirror in qemu over an NBD connection to destination. In your case it's using the old storage migration protocol.> Is it possible to make the migration process more verbose?What do you mean by this? In case if --tunelled there's nothing we can do though. Everything is done inside qemu.> Is what I do a good way? > > With regards, > Paul van der Vlis > > BTW: this is what I do, sometimes the lines are broken wrong: > ----------- > # Rsync image when not on the other host: > if test `ssh $other "if test -e /data/$vm.qcow2; then echo ja; else echo > nee; fi"` = "nee"; then > echo "rsync..." > rsync /data/$vm.qcow2 $other://data/$vm.qcow2 > if test $? = 0; then echo "gelukt"; else echo "niet gelukt"; exit; fi > fi > > # migrate > echo "migrate..." > virsh migrate --live --p2p --tunnelled --copy-storage-inc --persistentAs said above this implies the old storage migration protocol which transports the data in the migration stream. This stream is then tunelled over the libvirt connection. This is very inefficient and also uses the old storage migration protocol which is obsolete and qemu will attempt to remove it in the future.> --undefinesource --verbose $vm qemu+ssh://$other/system > if test $? = 0; then echo "gelukt"; else echo "niet gelukt"; exit; fi > ----------- > > > -- > Paul van der Vlis Linux systeembeheer Groningen > https://www.vandervlis.nl/ > > _______________________________________________ > libvirt-users mailing list > libvirt-users@redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-users
Paul van der Vlis
2019-Feb-13 10:45 UTC
Re: [libvirt-users] virsh migrate --copy-storage-inc
Op 11-02-19 om 14:31 schreef Peter Krempa:> On Sun, Feb 10, 2019 at 12:11:42 +0100, Paul van der Vlis wrote: >> Hello, >> >> I use libvirt on machines without shared storage. My VM's have all one >> qcow2-disk, with the same name as the VM. >> >> When I want to migrate a VM, I check if there is an qcow2 image on the >> other host with that name. When that's not the case, I copy the image >> using rsync first. If the image excist, I don't do that, and I think >> that "--copy-storage-inc" will do it. > > Note that using the 'inc' or incremental mode will copy only the data in > the top level image rather than a full copy. This means that you need to> pre-create empty qcow2 files which point to the correct backing store.Hmm, I don't know what's a "top level image", I cannot find how to create an empty qcow2 file, and I don't know what's a "backing store". I miss some information, and I don't know where to find this info.>> But I don't know how intelligent "--copy-storage-inc" is. I use LVM >> inside the VM's, and it's possible that I have changed the size of a >> volume for example. > > Non shared storage migration preserves the guest visible state. > >> >> My questions: >> Is "--copy-storage-inc" intelligent enough for such tasks? > > If used with --tunelled you can only use it if you wish to migrate ALL > disks in such a VM and need to pre-create the correct files. > > If you wish to migrate only certain disks you need to stop using > --tunelled. > >> Is there documentation what is done during migration? Is it using rsync? > > Normally (if --tunneled is not used) it's using blockdev-mirror or > drive-mirror in qemu over an NBD connection to destination. > > In your case it's using the old storage migration protocol. > >> Is it possible to make the migration process more verbose? > > What do you mean by this? In case if --tunelled there's nothing we can > do though. Everything is done inside qemu.When I understand you well, it would be better to not-use "tunneled".>> Is what I do a good way? >> >> With regards, >> Paul van der Vlis >> >> BTW: this is what I do, sometimes the lines are broken wrong: >> ----------- >> # Rsync image when not on the other host: >> if test `ssh $other "if test -e /data/$vm.qcow2; then echo ja; else echo >> nee; fi"` = "nee"; then >> echo "rsync..." >> rsync /data/$vm.qcow2 $other://data/$vm.qcow2 >> if test $? = 0; then echo "gelukt"; else echo "niet gelukt"; exit; fi >> fi >> >> # migrate >> echo "migrate..." >> virsh migrate --live --p2p --tunnelled --copy-storage-inc --persistent > > As said above this implies the old storage migration protocol which > transports the data in the migration stream. This stream is then > tunelled over the libvirt connection. This is very inefficient and also > uses the old storage migration protocol which is obsolete and qemu will > attempt to remove it in the future.Thanks for your help, I will test how migration work without "tunneled". I guess I do not need a tunnel, I use allready SSH and a safe network connection. With regards, Paul van der Vlis>> --undefinesource --verbose $vm qemu+ssh://$other/system >> if test $? = 0; then echo "gelukt"; else echo "niet gelukt"; exit; fi >> ----------- >> >> >> -- >> Paul van der Vlis Linux systeembeheer Groningen >> https://www.vandervlis.nl/ >> >> _______________________________________________ >> libvirt-users mailing list >> libvirt-users@redhat.com >> https://www.redhat.com/mailman/listinfo/libvirt-users-- Paul van der Vlis Linux systeembeheer Groningen https://www.vandervlis.nl/