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

[libvirt] [PATCHv3 2/6] flags: simplify qemu migration flags



* src/qemu/qemu_driver.c (QEMU_MIGRATION_FLAGS): New define.
Simplify all migration callbacks.
---

v3: new patch

 src/qemu/qemu_driver.c |  101 ++++++++++--------------------------------------
 1 files changed, 21 insertions(+), 80 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c0acf52..54292e1 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -112,6 +112,17 @@

 #define QEMU_NB_BLKIO_PARAM  1

+/* All supported qemu migration flags.  */
+#define QEMU_MIGRATION_FLAGS                    \
+    (VIR_MIGRATE_LIVE |                         \
+     VIR_MIGRATE_PEER2PEER |                    \
+     VIR_MIGRATE_TUNNELLED |                    \
+     VIR_MIGRATE_PERSIST_DEST |                 \
+     VIR_MIGRATE_UNDEFINE_SOURCE |              \
+     VIR_MIGRATE_PAUSED |                       \
+     VIR_MIGRATE_NON_SHARED_DISK |              \
+     VIR_MIGRATE_NON_SHARED_INC)
+
 static void processWatchdogEvent(void *data, void *opaque);

 static int qemudShutdown(void);
@@ -6625,14 +6636,7 @@ qemudDomainMigratePrepareTunnel(virConnectPtr dconn,
     struct qemud_driver *driver = dconn->privateData;
     int ret = -1;

-    virCheckFlags(VIR_MIGRATE_LIVE |
-                  VIR_MIGRATE_PEER2PEER |
-                  VIR_MIGRATE_TUNNELLED |
-                  VIR_MIGRATE_PERSIST_DEST |
-                  VIR_MIGRATE_UNDEFINE_SOURCE |
-                  VIR_MIGRATE_PAUSED |
-                  VIR_MIGRATE_NON_SHARED_DISK |
-                  VIR_MIGRATE_NON_SHARED_INC, -1);
+    virCheckFlags(QEMU_MIGRATION_FLAGS, -1);

     qemuDriverLock(driver);

@@ -6686,14 +6690,7 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn,
     struct qemud_driver *driver = dconn->privateData;
     int ret = -1;

-    virCheckFlags(VIR_MIGRATE_LIVE |
-                  VIR_MIGRATE_PEER2PEER |
-                  VIR_MIGRATE_TUNNELLED |
-                  VIR_MIGRATE_PERSIST_DEST |
-                  VIR_MIGRATE_UNDEFINE_SOURCE |
-                  VIR_MIGRATE_PAUSED |
-                  VIR_MIGRATE_NON_SHARED_DISK |
-                  VIR_MIGRATE_NON_SHARED_INC, -1);
+    virCheckFlags(QEMU_MIGRATION_FLAGS, -1);

     *uri_out = NULL;

@@ -6751,14 +6748,7 @@ qemudDomainMigratePerform (virDomainPtr dom,
     int ret = -1;
     const char *dconnuri = NULL;

-    virCheckFlags(VIR_MIGRATE_LIVE |
-                  VIR_MIGRATE_PEER2PEER |
-                  VIR_MIGRATE_TUNNELLED |
-                  VIR_MIGRATE_PERSIST_DEST |
-                  VIR_MIGRATE_UNDEFINE_SOURCE |
-                  VIR_MIGRATE_PAUSED |
-                  VIR_MIGRATE_NON_SHARED_DISK |
-                  VIR_MIGRATE_NON_SHARED_INC, -1);
+    virCheckFlags(QEMU_MIGRATION_FLAGS, -1);

     qemuDriverLock(driver);
     if (virLockManagerPluginUsesState(driver->lockManager)) {
@@ -6813,14 +6803,7 @@ qemudDomainMigrateFinish2 (virConnectPtr dconn,
     virDomainObjPtr vm;
     virDomainPtr dom = NULL;

-    virCheckFlags(VIR_MIGRATE_LIVE |
-                  VIR_MIGRATE_PEER2PEER |
-                  VIR_MIGRATE_TUNNELLED |
-                  VIR_MIGRATE_PERSIST_DEST |
-                  VIR_MIGRATE_UNDEFINE_SOURCE |
-                  VIR_MIGRATE_PAUSED |
-                  VIR_MIGRATE_NON_SHARED_DISK |
-                  VIR_MIGRATE_NON_SHARED_INC, NULL);
+    virCheckFlags(QEMU_MIGRATION_FLAGS, NULL);

     qemuDriverLock(driver);
     vm = virDomainFindByName(&driver->domains, dname);
@@ -6861,14 +6844,7 @@ qemuDomainMigrateBegin3(virDomainPtr domain,
     virDomainObjPtr vm;
     char *xml = NULL;

-    virCheckFlags(VIR_MIGRATE_LIVE |
-                  VIR_MIGRATE_PEER2PEER |
-                  VIR_MIGRATE_TUNNELLED |
-                  VIR_MIGRATE_PERSIST_DEST |
-                  VIR_MIGRATE_UNDEFINE_SOURCE |
-                  VIR_MIGRATE_PAUSED |
-                  VIR_MIGRATE_NON_SHARED_DISK |
-                  VIR_MIGRATE_NON_SHARED_INC, NULL);
+    virCheckFlags(QEMU_MIGRATION_FLAGS, NULL);

     qemuDriverLock(driver);
     vm = virDomainFindByUUID(&driver->domains, domain->uuid);
@@ -6904,14 +6880,7 @@ qemuDomainMigratePrepare3(virConnectPtr dconn,
     struct qemud_driver *driver = dconn->privateData;
     int ret = -1;

-    virCheckFlags(VIR_MIGRATE_LIVE |
-                  VIR_MIGRATE_PEER2PEER |
-                  VIR_MIGRATE_TUNNELLED |
-                  VIR_MIGRATE_PERSIST_DEST |
-                  VIR_MIGRATE_UNDEFINE_SOURCE |
-                  VIR_MIGRATE_PAUSED |
-                  VIR_MIGRATE_NON_SHARED_DISK |
-                  VIR_MIGRATE_NON_SHARED_INC, -1);
+    virCheckFlags(QEMU_MIGRATION_FLAGS, -1);

     *uri_out = NULL;

@@ -6958,14 +6927,7 @@ qemuDomainMigratePrepareTunnel3(virConnectPtr dconn,
     struct qemud_driver *driver = dconn->privateData;
     int ret = -1;

-    virCheckFlags(VIR_MIGRATE_LIVE |
-                  VIR_MIGRATE_PEER2PEER |
-                  VIR_MIGRATE_TUNNELLED |
-                  VIR_MIGRATE_PERSIST_DEST |
-                  VIR_MIGRATE_UNDEFINE_SOURCE |
-                  VIR_MIGRATE_PAUSED |
-                  VIR_MIGRATE_NON_SHARED_DISK |
-                  VIR_MIGRATE_NON_SHARED_INC, -1);
+    virCheckFlags(QEMU_MIGRATION_FLAGS, -1);

     if (!dom_xml) {
         qemuReportError(VIR_ERR_INTERNAL_ERROR,
@@ -7012,14 +6974,7 @@ qemuDomainMigratePerform3(virDomainPtr dom,
     virDomainObjPtr vm;
     int ret = -1;

-    virCheckFlags(VIR_MIGRATE_LIVE |
-                  VIR_MIGRATE_PEER2PEER |
-                  VIR_MIGRATE_TUNNELLED |
-                  VIR_MIGRATE_PERSIST_DEST |
-                  VIR_MIGRATE_UNDEFINE_SOURCE |
-                  VIR_MIGRATE_PAUSED |
-                  VIR_MIGRATE_NON_SHARED_DISK |
-                  VIR_MIGRATE_NON_SHARED_INC, -1);
+    virCheckFlags(QEMU_MIGRATION_FLAGS, -1);

     qemuDriverLock(driver);
     vm = virDomainFindByUUID(&driver->domains, dom->uuid);
@@ -7058,14 +7013,7 @@ qemuDomainMigrateFinish3(virConnectPtr dconn,
     virDomainObjPtr vm;
     virDomainPtr dom = NULL;

-    virCheckFlags(VIR_MIGRATE_LIVE |
-                  VIR_MIGRATE_PEER2PEER |
-                  VIR_MIGRATE_TUNNELLED |
-                  VIR_MIGRATE_PERSIST_DEST |
-                  VIR_MIGRATE_UNDEFINE_SOURCE |
-                  VIR_MIGRATE_PAUSED |
-                  VIR_MIGRATE_NON_SHARED_DISK |
-                  VIR_MIGRATE_NON_SHARED_INC, NULL);
+    virCheckFlags(QEMU_MIGRATION_FLAGS, NULL);

     qemuDriverLock(driver);
     vm = virDomainFindByName(&driver->domains, dname);
@@ -7096,14 +7044,7 @@ qemuDomainMigrateConfirm3(virDomainPtr domain,
     virDomainObjPtr vm;
     int ret = -1;

-    virCheckFlags(VIR_MIGRATE_LIVE |
-                  VIR_MIGRATE_PEER2PEER |
-                  VIR_MIGRATE_TUNNELLED |
-                  VIR_MIGRATE_PERSIST_DEST |
-                  VIR_MIGRATE_UNDEFINE_SOURCE |
-                  VIR_MIGRATE_PAUSED |
-                  VIR_MIGRATE_NON_SHARED_DISK |
-                  VIR_MIGRATE_NON_SHARED_INC, -1);
+    virCheckFlags(QEMU_MIGRATION_FLAGS, -1);

     qemuDriverLock(driver);
     vm = virDomainFindByUUID(&driver->domains, domain->uuid);
-- 
1.7.4.4


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