7a3408
From 767c91832fa9f2497a10603153b980932fc472ec Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <767c91832fa9f2497a10603153b980932fc472ec@dist-git>
7a3408
From: Jiri Denemark <jdenemar@redhat.com>
7a3408
Date: Mon, 5 Oct 2015 14:36:15 +0200
7a3408
Subject: [PATCH] qemu: Introduce flags in qemuMigrationCompleted
7a3408
7a3408
The function already has two bool parameters and we will need to add a
7a3408
new one. Let's switch to flags to make the callers readable.
7a3408
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
(cherry picked from commit 2af983f4c42e8f0af95fe1eb464e14ba52bb1145)
7a3408
7a3408
https://bugzilla.redhat.com/show_bug.cgi?id=1265902
7a3408
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/qemu/qemu_migration.c | 23 +++++++++++++++++------
7a3408
 1 file changed, 17 insertions(+), 6 deletions(-)
7a3408
7a3408
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
7a3408
index e04459d..17c1276 100644
7a3408
--- a/src/qemu/qemu_migration.c
7a3408
+++ b/src/qemu/qemu_migration.c
7a3408
@@ -2606,6 +2606,11 @@ qemuMigrationCheckJobStatus(virQEMUDriverPtr driver,
7a3408
 }
7a3408
 
7a3408
 
7a3408
+enum qemuMigrationCompletedFlags {
7a3408
+    QEMU_MIGRATION_COMPLETED_ABORT_ON_ERROR = (1 << 0),
7a3408
+    QEMU_MIGRATION_COMPLETED_CHECK_STORAGE  = (1 << 1),
7a3408
+};
7a3408
+
7a3408
 /**
7a3408
  * Returns 1 if migration completed successfully,
7a3408
  *         0 if the domain is still being migrated,
7a3408
@@ -2617,8 +2622,7 @@ qemuMigrationCompleted(virQEMUDriverPtr driver,
7a3408
                        virDomainObjPtr vm,
7a3408
                        qemuDomainAsyncJob asyncJob,
7a3408
                        virConnectPtr dconn,
7a3408
-                       bool abort_on_error,
7a3408
-                       bool storage)
7a3408
+                       unsigned int flags)
7a3408
 {
7a3408
     qemuDomainObjPrivatePtr priv = vm->privateData;
7a3408
     qemuDomainJobInfoPtr jobInfo = priv->job.current;
7a3408
@@ -2627,10 +2631,11 @@ qemuMigrationCompleted(virQEMUDriverPtr driver,
7a3408
     if (qemuMigrationCheckJobStatus(driver, vm, asyncJob) < 0)
7a3408
         goto error;
7a3408
 
7a3408
-    if (storage && qemuMigrationDriveMirrorReady(driver, vm) < 0)
7a3408
+    if (flags & QEMU_MIGRATION_COMPLETED_CHECK_STORAGE &&
7a3408
+        qemuMigrationDriveMirrorReady(driver, vm) < 0)
7a3408
         goto error;
7a3408
 
7a3408
-    if (abort_on_error &&
7a3408
+    if (flags & QEMU_MIGRATION_COMPLETED_ABORT_ON_ERROR &&
7a3408
         virDomainObjGetState(vm, &pauseReason) == VIR_DOMAIN_PAUSED &&
7a3408
         pauseReason == VIR_DOMAIN_PAUSED_IOERROR) {
7a3408
         virReportError(VIR_ERR_OPERATION_FAILED, _("%s: %s"),
7a3408
@@ -2677,11 +2682,17 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver,
7a3408
     qemuDomainObjPrivatePtr priv = vm->privateData;
7a3408
     qemuDomainJobInfoPtr jobInfo = priv->job.current;
7a3408
     bool events = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT);
7a3408
+    unsigned int flags = 0;
7a3408
     int rv;
7a3408
 
7a3408
+    if (abort_on_error)
7a3408
+        flags |= QEMU_MIGRATION_COMPLETED_ABORT_ON_ERROR;
7a3408
+    if (storage)
7a3408
+        flags |= QEMU_MIGRATION_COMPLETED_CHECK_STORAGE;
7a3408
+
7a3408
     jobInfo->type = VIR_DOMAIN_JOB_UNBOUNDED;
7a3408
-    while ((rv = qemuMigrationCompleted(driver, vm, asyncJob, dconn,
7a3408
-                                        abort_on_error, storage)) != 1) {
7a3408
+    while ((rv = qemuMigrationCompleted(driver, vm, asyncJob,
7a3408
+                                        dconn, flags)) != 1) {
7a3408
         if (rv < 0)
7a3408
             return rv;
7a3408
 
7a3408
-- 
7a3408
2.6.1
7a3408