diff mbox

[1/2] qemu: More usage of qemuDomainDiskBlockJobIsActive

Message ID d90bb7044e17197abf9ce86a5808a0a4b6fda647.1465474475.git.crobinso@redhat.com
State Accepted
Commit b732704f49ab46d31bd18b2fa370bdd6fbf39d21
Headers show

Commit Message

Cole Robinson June 9, 2016, 12:15 p.m. UTC
qemuDomainDiskBlockJobIsActive already checks if a disk has a
blockjob, and if so, raises an error
---
 src/qemu/qemu_driver.c  | 7 +------
 src/qemu/qemu_hotplug.c | 6 +-----
 2 files changed, 2 insertions(+), 11 deletions(-)

-- 
2.7.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff mbox

Patch

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e70d3ce..e251194 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13716,15 +13716,10 @@  qemuDomainSnapshotPrepare(virConnectPtr conn,
     for (i = 0; i < def->ndisks; i++) {
         virDomainSnapshotDiskDefPtr disk = &def->disks[i];
         virDomainDiskDefPtr dom_disk = vm->def->disks[i];
-        qemuDomainDiskPrivatePtr dom_diskPriv = QEMU_DOMAIN_DISK_PRIVATE(dom_disk);
 
         if (disk->snapshot != VIR_DOMAIN_SNAPSHOT_LOCATION_NONE &&
-            dom_diskPriv->blockjob) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("disk '%s' has an active block job"),
-                           disk->name);
+            qemuDomainDiskBlockJobIsActive(dom_disk))
             goto cleanup;
-        }
 
         switch ((virDomainSnapshotLocation) disk->snapshot) {
         case VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL:
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 6ce0a84..8c9e7ed 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -3429,12 +3429,8 @@  qemuDomainDetachDiskDevice(virQEMUDriverPtr driver,
     int ret = -1;
     qemuDomainObjPrivatePtr priv = vm->privateData;
 
-    if (detach->mirror) {
-        virReportError(VIR_ERR_BLOCK_COPY_ACTIVE,
-                       _("disk '%s' is in an active block job"),
-                       detach->dst);
+    if (qemuDomainDiskBlockJobIsActive(detach))
         goto cleanup;
-    }
 
     qemuDomainMarkDeviceForRemoval(vm, &detach->info);