[libvirt] [PATCH 3/3] qemu_migration: Transport OVS per-port data during live migration

Kyle Mestery kmestery at cisco.com
Fri Sep 14 19:01:19 UTC 2012


Transport Open vSwitch per-port data during live
migration by using the utility functions
virNetDevOpenvswitchGetMigrateData() and
virNetDevOpenvswitchSetMigrateData().

Signed-off-by: Kyle Mestery <kmestery at cisco.com>
---
 src/qemu/qemu_migration.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 3d89b62..cc81765 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -308,7 +308,7 @@ qemuMigrationCookieNetworkAlloc(struct qemud_driver *driver ATTRIBUTE_UNUSED,
 {
     qemuMigrationCookieNetworkPtr mig;
     int i;
-    virDomainNetDefPtr netptr ATTRIBUTE_UNUSED;
+    virDomainNetDefPtr netptr;
 
     if (VIR_ALLOC(mig) < 0)
         goto no_memory;
@@ -342,7 +342,13 @@ qemuMigrationCookieNetworkAlloc(struct qemud_driver *driver ATTRIBUTE_UNUSED,
                 mig->netdata[i] = NULL;
                 break;
             case VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH:
-                mig->netdata[i] = NULL;
+                if (virNetDevOpenvswitchGetMigrateData(&mig->netdata[i],
+                                                       netptr->ifname) != 0) {
+                    virReportSystemError(VIR_ERR_INTERNAL_ERROR,
+                                         _("Unable to run command to get OVS port data for "
+                                         "interface %s"), netptr->ifname);
+                    goto error;
+                }
                 break;
             default:
                 mig->netdata[i] = NULL;
@@ -351,6 +357,7 @@ qemuMigrationCookieNetworkAlloc(struct qemud_driver *driver ATTRIBUTE_UNUSED,
         }
     }
 
+error:
     return mig;
 
 no_memory:
@@ -1284,7 +1291,7 @@ qemuDomainMigrateOPDRelocate(struct qemud_driver *driver ATTRIBUTE_UNUSED,
                              virDomainObjPtr vm,
                              qemuMigrationCookiePtr cookie)
 {
-    virDomainNetDefPtr netptr ATTRIBUTE_UNUSED;
+    virDomainNetDefPtr netptr;
     int ret = 0;
     int i;
 
@@ -1303,7 +1310,14 @@ qemuDomainMigrateOPDRelocate(struct qemud_driver *driver ATTRIBUTE_UNUSED,
                 cookie->network->netdata[i] = NULL;
                 break;
             case VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH:
-                cookie->network->netdata[i] = NULL;
+                if (virNetDevOpenvswitchSetMigrateData(cookie->network->netdata[i],
+                                                       netptr->ifname) != 0) {
+                    virReportSystemError(VIR_ERR_INTERNAL_ERROR,
+                                         _("Unable to run command to set OVS port data for "
+                                         "interface %s"), netptr->ifname);
+                    ret = -1;
+                    goto error;
+                }
                 break;
             default:
                 cookie->network->netdata[i] = NULL;
@@ -1312,6 +1326,7 @@ qemuDomainMigrateOPDRelocate(struct qemud_driver *driver ATTRIBUTE_UNUSED,
         }
     }
 
+error:
     return ret;
 }
 
-- 
1.7.11.4




More information about the libvir-list mailing list