[libvirt] [PATCH v3 10/18] blockcopy: allow block device destination

Peter Krempa pkrempa at redhat.com
Fri Sep 5 09:23:50 UTC 2014


On 08/31/14 06:02, Eric Blake wrote:
> To date, anyone performing a block copy and pivot ends up with
> the destination being treated as <disk type='file'>.  While this
> works for data access for a block device, it has at least one
> noticeable shortcoming: virDomainGetBlockInfo() reports allocation
> differently for block devices visited as files (the size of the
> device) than for block devices visited as <disk type='block'>
> (the maximum sector used, as reported by qemu); and this difference
> is significant when trying to manage qcow2 format on block devices
> that can be grown as needed.
> 
> Of course, the more powerful virDomainBlockCopy() API can already
> express the ability to set the <disk> type.  But a new API can't
> be backported, while a new flag to an existing API can; and it is
> also rather inconvenient to have to resort to the full power of
> generating XML when just adding a flag to the older call will do
> the trick.  So this patch enhances blockcopy to let the user flag
> when the resulting XML after the copy must list the device as
> type='block'.
> 
> * include/libvirt/libvirt.h.in (VIR_DOMAIN_BLOCK_REBASE_COPY_DEV):
> New flag.
> * src/libvirt.c (virDomainBlockRebase): Document it.
> * tools/virsh-domain.c (opts_block_copy, blockJobImpl): Add
> --blockdev option.
> * tools/virsh.pod (blockcopy): Document it.
> * src/qemu/qemu_driver.c (qemuDomainBlockRebase): Allow new flag.
> (qemuDomainBlockCopy): Remember the flag, and make sure it is only
> used on actual block devices.
> * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: Test it.
> 
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
>  include/libvirt/libvirt.h.in                       |  2 ++
>  src/libvirt.c                                      |  8 +++--
>  src/qemu/qemu_driver.c                             | 36 ++++++++++++++--------
>  .../qemuxml2argvdata/qemuxml2argv-disk-mirror.xml  |  4 +--
>  tools/virsh-domain.c                               |  6 ++++
>  tools/virsh.pod                                    |  7 +++--
>  6 files changed, 45 insertions(+), 18 deletions(-)
> 

ACK

Peter


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140905/207cd0a4/attachment-0001.sig>


More information about the libvir-list mailing list