[libvirt-users] Using virsh blockcopy -- what's it supposed to accomplish?

Eric Blake eblake at redhat.com
Mon Dec 22 22:50:58 UTC 2014


On 12/22/2014 03:27 PM, Gary R Hook wrote:
> I am experimenting with the blockcopy command, and after figuring out
> how to integrate qemu-nbd, nbd-client and
> dumpxml/undefine/blockcopy/define/et. al. I have one remaining question:
> 
> What's the point?

Among other uses, live storage migration.

Let's say you are running on a cluster, where your VM is running locally
but was booted from network-accessed storage.  You don't want any guest
downtime, but you want to have the faster performance made possible by
accessing local storage instead of the network-accessed storage.  virsh
blockcopy can be used to change qemu's notion of where the active layer
of the disk lives without any guest time, by copying then pivoting to a
local file.

> 
> The "replication" disk file is not, from what I can ascertain, bootable.

Correct in the current implementation, if you don't manually freeze
guest I/O prior to the point where you abort the copy (whether you do a
straight abort, leaving the copy as the point in time, or whether you do
a pivot, leaving the original as the point in time).  But I would like
to add a --quiesce option to blockcopy, similar to what is already
available for snapshot-create --quiesce.  The idea is that just before
breaking sync, you tell the guest to freeze all I/O, so that when you do
break sync, the disk you are no longer using _is_ a consistent image
(and depending on how well your guest is able to freeze I/O, it may well
be bootable).  But until that is implemented, you can use 'virsh
domfsfreeze' as the manual access to freezing guest I/O, if you have new
enough qemu and also have qemu-guest-agent wired up in your guest.

> I expect this operation to create a pristine copy of my source qcow2
> file (at a given point in time) which implies that I can swap that copy
> in and use it just like the original.
> 
> Neither using --finish nor --pivot (both appear successful) give me a
> mirror that seems to serve any purpose. It seems especially pointless if
> I use --pivot because anything that happens after the pivot ends up lost
> if I don't actually have a usable qcow2 file.

How is it not usable?  When you break sync at the conclusion of a
blockcopy, the image that you no longer use is an accurate snapshot of
the state of the disk at the time you broke sync; but whether or not
that is useful to a guest depends on how much influence unflushed I/O
that was still in guest memory at the time you broke sync will have on
your data.

> 
> I find lots of discussion online about getting the steps to work, but as
> yet find nothing about using the resulting file.
> 
> What am I missing here?
> 
> libvirt (1.2.2) and qemu (2.2.0) as distributed with Ubuntu Trusty.
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20141222/b61aed26/attachment.sig>


More information about the libvirt-users mailing list