[PATCH 6/8] qemu: driver: Blockdevize qemuDomainBlockJobAbort/Pivot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use job-complete/job-abort instead of the blockjob-* variants for
blockdev.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7a69a0e084..12ae31b9a7 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16981,6 +16981,7 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
 {
     int ret = -1;
     qemuDomainObjPrivatePtr priv = vm->privateData;
+    bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);

     switch ((qemuBlockJobType) job->type) {
     case QEMU_BLOCKJOB_TYPE_NONE:
@@ -17016,7 +17017,10 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
      * that pivot failed, we need to reflect that failure into the
      * overall return value.  */
     qemuDomainObjEnterMonitor(driver, vm);
-    ret = qemuMonitorDrivePivot(priv->mon, job->name);
+    if (blockdev)
+        ret = qemuMonitorJobComplete(priv->mon, job->name);
+    else
+        ret = qemuMonitorDrivePivot(priv->mon, job->name);
     if (qemuDomainObjExitMonitor(driver, vm) < 0) {
         ret = -1;
         goto cleanup;
@@ -17157,6 +17161,8 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
     bool async = !!(flags & VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC);
     qemuBlockJobDataPtr job = NULL;
     virDomainObjPtr vm;
+    qemuDomainObjPrivatePtr priv = NULL;
+    bool blockdev = false;
     int ret = -1;

     virCheckFlags(VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC |
@@ -17183,6 +17189,9 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
         goto endjob;
     }

+    priv = vm->privateData;
+    blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
+
     if (job->state == QEMU_BLOCKJOB_STATE_ABORTING ||
         job->state == QEMU_BLOCKJOB_STATE_PIVOTING) {
         virReportError(VIR_ERR_OPERATION_INVALID,
@@ -17199,7 +17208,10 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
             goto endjob;
     } else {
         qemuDomainObjEnterMonitor(driver, vm);
-        ret = qemuMonitorBlockJobCancel(qemuDomainGetMonitor(vm), job->name);
+        if (blockdev)
+            ret = qemuMonitorJobCancel(priv->mon, job->name, false);
+        else
+            ret = qemuMonitorBlockJobCancel(priv->mon, job->name);
         if (qemuDomainObjExitMonitor(driver, vm) < 0) {
             ret = -1;
             goto endjob;
-- 
2.21.0

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux