openvswitch fix
authorAnsgar Jazdzewski <ajaz@spreadshirt.net>
Fri, 16 May 2014 05:50:49 +0000 (07:50 +0200)
committerKlaus Aehlig <aehlig@google.com>
Fri, 16 May 2014 09:19:48 +0000 (11:19 +0200)
 * fix unhandled nic.mode in config.py
   "Unhandled Ganeti error: NIC mode 'openvswitch' not handled" (Issue 804)
 * handle link-changes for the virtual NIC
   a instance will readd the tap interface to the openviswitch so that
   changes of the instance-link (VLAN) will be considered.
   "gnt-instance modfy -net 0:link=newlink"

Signed-off-by: Ansgar Jazdzewski <a.jazdzewski@googlemail.com>
Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

lib/config.py
tools/net-common.in

index 15707da..de803a8 100644 (file)
@@ -853,6 +853,8 @@ class ConfigWriter(object):
           link = "bridge:%s" % nic_link
         elif nic_mode == constants.NIC_MODE_ROUTED:
           link = "route:%s" % nic_link
+        elif nic_mode == constants.NIC_MODE_OVS:
+          link = "ovs:%s" % nic_link
         else:
           raise errors.ProgrammerError("NIC mode '%s' not handled" % nic_mode)
 
index 7305875..6758555 100644 (file)
@@ -60,6 +60,11 @@ function setup_bridge {
 
 function setup_ovs {
   if [ "$MODE" = "openvswitch" ]; then
+    # Remove stale port
+    ovs-vsctl del-port $INTERFACE || true
+    # Bring interface up
+    ip link set $INTERFACE up
+    # Add port
     ovs-vsctl add-port ${LINK} $INTERFACE
   fi
 }