[libvirt] [PATCHv9 6/9] blockjob: implement block copy for qemu

Eric Blake eblake at redhat.com
Sat Oct 27 13:29:37 UTC 2012


On 10/26/2012 07:21 AM, Peter Krempa wrote:
> On 10/23/12 04:10, Eric Blake wrote:
>> Minimal patch to wire up all the pieces in the previous patches
>> to actually enable a block copy job.  By minimal, I mean that
>> qemu creates the file (that is, no REUSE_EXT flag support yet),
>> SELinux must be disabled, a lock manager is not informed, and the
>> audit logs aren't updated.  But those will be added as
>> improvements in future patches.
>>
>> This patch is designed so that if we ever add a future API
>> virDomainBlockCopy with more bells and whistles (such as letting
>> the user specify a destination image format different than the
>> source), where virDomainBlockRebase is a wrapper around the
>> simpler portions of the new functionality, then the new API can
>> just reuse the new qemuDomainBlockCopy function and already
>> support _SHALLOW and _REUSE_EXT flags.  Also note that libvirt.c
>> already filtered the new flags if _COPY is not present, so that
>> we are not impacting the case of BlockRebase being a wrapper
>> around BlockPull.
>>
>> * src/qemu/qemu_driver.c (qemuDomainBlockCopy): New function.
>> (qemuDomainBlockRebase): Call it when appropriate.
>> ---
>>
>> v9: fix bug with driver locking
>>
> 
> ACK as-is, but some parts will need to be dropped without the RHEL support.

Yep.  Here's what I squashed in:

diff --git i/src/qemu/qemu_driver.c w/src/qemu/qemu_driver.c
index 111922d..bd52631 100644
--- i/src/qemu/qemu_driver.c
+++ w/src/qemu/qemu_driver.c
@@ -12860,7 +12860,6 @@ qemuDomainBlockCopy(virDomainPtr dom, const char
*path,
     virDomainDiskDefPtr disk;
     int ret = -1;
     int idx;
-    bool reopen;

     /* Preliminaries: find the disk we are editing, sanity checks */
     virCheckFlags(VIR_DOMAIN_BLOCK_REBASE_SHALLOW, -1);
@@ -12887,7 +12886,6 @@ qemuDomainBlockCopy(virDomainPtr dom, const char
*path,
         goto cleanup;
     }

-    reopen = qemuCapsGet(priv->caps, QEMU_CAPS_DRIVE_REOPEN);
     if (!(qemuCapsGet(priv->caps, QEMU_CAPS_DRIVE_MIRROR) &&
           qemuCapsGet(priv->caps, QEMU_CAPS_BLOCKJOB_ASYNC))) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -12950,7 +12948,7 @@ qemuDomainBlockCopy(virDomainPtr dom, const char
*path,
     /* Actually start the mirroring */
     qemuDomainObjEnterMonitor(driver, vm);
     ret = qemuMonitorDriveMirror(priv->mon, device, dest, format,
bandwidth,
-                                 reopen, flags);
+                                 flags);
     qemuDomainObjExitMonitor(driver, vm);

 endjob:

-- 
Eric Blake   eblake at 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: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121027/0b1cc171/attachment-0001.sig>


More information about the libvir-list mailing list