]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Fix adding ports to OVS bridges without VLAN tags
authorKyle Mestery <kmestery@cisco.com>
Thu, 30 Aug 2012 20:38:06 +0000 (16:38 -0400)
committerDaniel Veillard <veillard@redhat.com>
Fri, 31 Aug 2012 02:57:00 +0000 (10:57 +0800)
The introduction of the new VLAN code, along with the fix
from 5e465df6be8bcb00f0b4bff831e91f4042fae272, caused the
addition of OVS ports to fail with the following message:

ovs-vsctl: 00002|vsctl|ERR|: missing column name

This fix takes into account the VLAN arguments are optional,
and correctly sets up the command line to run the "ovs-vsctl"
command to add ports to the OVS bridge.

Signed-off-by: Kyle Mestery <kmestery@cisco.com>
CC: Eric Blake <eblake@redhat.com>
src/util/virnetdevopenvswitch.c

index 00271a0005cd1a0477724c4ed211a692752bfab2..764f478a6a197948365309f4f5604d1aeee0522b 100644 (file)
@@ -104,9 +104,15 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname,
     }
 
     cmd = virCommandNew(OVSVSCTL);
+
+    virCommandAddArgList(cmd, "--", "--may-exist", "add-port",
+                        brname, ifname, NULL);
+
+    if (virBufferUse(&buf) != 0)
+        virCommandAddArgList(cmd, virBufferCurrentContent(&buf), NULL);
+
     if (ovsport->profileID[0] == '\0') {
-        virCommandAddArgList(cmd, "--", "--may-exist", "add-port",
-                        brname, ifname, virBufferCurrentContent(&buf),
+        virCommandAddArgList(cmd,
                         "--", "set", "Interface", ifname, attachedmac_ex_id,
                         "--", "set", "Interface", ifname, ifaceid_ex_id,
                         "--", "set", "Interface", ifname, vmid_ex_id,
@@ -114,8 +120,7 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname,
                         "external-ids:iface-status=active",
                         NULL);
     } else {
-        virCommandAddArgList(cmd, "--", "--may-exist", "add-port",
-                        brname, ifname, virBufferCurrentContent(&buf),
+        virCommandAddArgList(cmd,
                         "--", "set", "Interface", ifname, attachedmac_ex_id,
                         "--", "set", "Interface", ifname, ifaceid_ex_id,
                         "--", "set", "Interface", ifname, vmid_ex_id,