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

[libvirt] [PATCH 08/10] qemu: Make qemuMigrationCancelDriveMirror usable without async job



We don't have an async job when reconnecting to existing domains after
libvirtd restart.

Signed-off-by: Jiri Denemark <jdenemar redhat com>
---
 src/qemu/qemu_migration.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index f866ac5..cd08c88 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1837,7 +1837,8 @@ static int
 qemuMigrationCancelOneDriveMirror(virQEMUDriverPtr driver,
                                   virDomainObjPtr vm,
                                   virDomainDiskDefPtr disk,
-                                  bool failNoJob)
+                                  bool failNoJob,
+                                  qemuDomainAsyncJob asyncJob)
 {
     qemuDomainObjPrivatePtr priv = vm->privateData;
     char *diskAlias = NULL;
@@ -1865,8 +1866,7 @@ qemuMigrationCancelOneDriveMirror(virQEMUDriverPtr driver,
                     QEMU_DRIVE_HOST_PREFIX, disk->info.alias) < 0)
         return -1;
 
-    if (qemuDomainObjEnterMonitorAsync(driver, vm,
-                                       QEMU_ASYNC_JOB_MIGRATION_OUT) < 0)
+    if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
         goto cleanup;
 
     rv = qemuMonitorBlockJobCancel(priv->mon, diskAlias, true);
@@ -1897,7 +1897,8 @@ qemuMigrationCancelOneDriveMirror(virQEMUDriverPtr driver,
 static int
 qemuMigrationCancelDriveMirror(virQEMUDriverPtr driver,
                                virDomainObjPtr vm,
-                               bool check)
+                               bool check,
+                               qemuDomainAsyncJob asyncJob)
 {
     virErrorPtr err = NULL;
     int ret = -1;
@@ -1915,7 +1916,8 @@ qemuMigrationCancelDriveMirror(virQEMUDriverPtr driver,
         if (!diskPriv->migrating)
             continue;
 
-        rv = qemuMigrationCancelOneDriveMirror(driver, vm, disk, check);
+        rv = qemuMigrationCancelOneDriveMirror(driver, vm, disk,
+                                               check, asyncJob);
         if (rv != 0) {
             if (rv < 0) {
                 if (!err)
@@ -3593,7 +3595,8 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver,
         virErrorPtr orig_err = virSaveLastError();
 
         /* cancel any outstanding NBD jobs */
-        qemuMigrationCancelDriveMirror(driver, vm, false);
+        qemuMigrationCancelDriveMirror(driver, vm, false,
+                                       QEMU_ASYNC_JOB_MIGRATION_OUT);
 
         virSetError(orig_err);
         virFreeError(orig_err);
@@ -4164,7 +4167,8 @@ qemuMigrationRun(virQEMUDriverPtr driver,
 
     /* cancel any outstanding NBD jobs */
     if (mig && mig->nbd) {
-        if (qemuMigrationCancelDriveMirror(driver, vm, !!ret) < 0)
+        if (qemuMigrationCancelDriveMirror(driver, vm, !!ret,
+                                           QEMU_ASYNC_JOB_MIGRATION_OUT) < 0)
             ret = -1;
     }
 
-- 
2.4.1


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