From ce1168aff10de1a1172563dad6fb48ababbe9e58 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 16 Jul 2010 09:22:23 -0700 Subject: [PATCH 1/4] xenserver: Kill bond slaves' dhclients when bringing up bond master. This fixes the converse of the problem addressed by commit fe19e820 "xenserver: Kill bond master's dhclient when bringing up bond slave". In that commit's log message, I claimed that the converse was not a problem, but I was wrong. I must have screwed up in testing, because it really is a problem. This commit fixes it. Signed-off-by: Ben Pfaff Acked-by: Ian Campbell CC: Dominic Curran Reported-by: Michael Mao Bug #2668. --- scripts/InterfaceReconfigureVswitch.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/scripts/InterfaceReconfigureVswitch.py b/scripts/InterfaceReconfigureVswitch.py index a8dff539e63..47668504d7c 100644 --- a/scripts/InterfaceReconfigureVswitch.py +++ b/scripts/InterfaceReconfigureVswitch.py @@ -431,17 +431,25 @@ def preconfigure(self, parent): def bring_down_existing(self): # interface-reconfigure is never explicitly called to down a # bond master. However, when we are called to up a slave it - # is implicit that we are destroying the master. + # is implicit that we are destroying the master. Conversely, + # when we are called to up a bond is is implicit that we are + # taking down the slaves. # - # This is (only) important in the case where the bond master - # uses DHCP. We need to kill the dhclient process, otherwise - # bringing the bond master back up later will fail because - # ifup will refuse to start a duplicate dhclient. + # This is (only) important in the case where the device being + # implicitly taken down uses DHCP. We need to kill the + # dhclient process, otherwise performing the inverse operation + # later later will fail because ifup will refuse to start a + # duplicate dhclient. bond_masters = pif_get_bond_masters(self._pif) for master in bond_masters: log("action_up: bring down bond master %s" % (pif_netdev_name(master))) run_command(["/sbin/ifdown", pif_bridge_name(master)]) + bond_slaves = pif_get_bond_slaves(self._pif) + for slave in bond_slaves: + log("action_up: bring down bond slave %s" % (pif_netdev_name(slave))) + run_command(["/sbin/ifdown", pif_bridge_name(slave)]) + def configure(self): # Bring up physical devices. ovs-vswitchd initially enables or # disables bond slaves based on whether carrier is detected From fa47db56ab4cf688a9ff2d91a14b91765731265f Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Tue, 21 Sep 2010 23:57:13 -0700 Subject: [PATCH 2/4] xenserver: Only put the primary XenServer UUID in default bridge-id This patch defensively guarantees that the first id in xs-network-uuids will belong to the primary network (as opposed to a vlan). Given that the primary network id comes first, it parses xs-network-ids and only copies the primary id to bridge-id when monitor-external-ids is run. Feature #3647 Signed-off-by: Ethan Jackson Reviewed-by: Ben Pfaff Signed-off-by: Dominic Curran --- scripts/InterfaceReconfigureVswitch.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/InterfaceReconfigureVswitch.py b/scripts/InterfaceReconfigureVswitch.py index 47668504d7c..1a845ff4ee5 100644 --- a/scripts/InterfaceReconfigureVswitch.py +++ b/scripts/InterfaceReconfigureVswitch.py @@ -342,7 +342,12 @@ def set_br_external_ids(pif): # log("Network PIF %s not currently attached (%s)" % (rec['uuid'],pifrec['uuid'])) # continue nwrec = db().get_network_record(rec['network']) - xs_network_uuids += [nwrec['uuid']] + + uuid = nwrec['uuid'] + if pif_is_vlan(nwpif): + xs_network_uuids.append(uuid) + else: + xs_network_uuids.insert(0, uuid) vsctl_argv = [] vsctl_argv += ['# configure xs-network-uuids'] From cfa81ed0e04c92c10fceeb89a2a81a05df522384 Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Mon, 10 Jan 2011 12:18:50 -0800 Subject: [PATCH 3/4] xenserver: Allow bond_mode configuration in xen. This commit adds bond_mode configuration to Interface Reconfigure so that it may be changed using standard XenServer commands. Signed-off-by: Ethan Jackson Signed-off-by: Dominic Curran --- scripts/InterfaceReconfigureVswitch.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/InterfaceReconfigureVswitch.py b/scripts/InterfaceReconfigureVswitch.py index 1a845ff4ee5..61385b28e30 100644 --- a/scripts/InterfaceReconfigureVswitch.py +++ b/scripts/InterfaceReconfigureVswitch.py @@ -171,6 +171,12 @@ def datapath_configure_bond(pif,slaves): argv += ['bond_%s=%d' % (name, value)] except ValueError: log("bridge %s has invalid %s '%s'" % (bridge, name, value)) + elif name == "mode": + + if val in ['balance-slb', 'active-backup']: + argv += ['bond_%s=%s' % (name, val)] + else: + log("bridge %s has invalid %s '%s'" % (bridge, name, val)) else: # Pass other bond options into other_config. argv += ["other-config:%s=%s" % (vsctl_escape("bond-%s" % name), From f62bb98d5adcffb192d1e6182b10cea33d7c2773 Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Tue, 11 Jan 2011 19:10:28 -0800 Subject: [PATCH 4/4] xenserver: Add miimon configuration support for xenserver. This commit makes necessary changes to Interface Reconfigure to allow miimon bond-detect-mode and bond-miimon-interval to be changed using xapi. Signed-off-by: Ethan Jackson Signed-off-by: Dominic Curran --- scripts/InterfaceReconfigureVswitch.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/InterfaceReconfigureVswitch.py b/scripts/InterfaceReconfigureVswitch.py index 61385b28e30..b380e4582f9 100644 --- a/scripts/InterfaceReconfigureVswitch.py +++ b/scripts/InterfaceReconfigureVswitch.py @@ -171,6 +171,22 @@ def datapath_configure_bond(pif,slaves): argv += ['bond_%s=%d' % (name, value)] except ValueError: log("bridge %s has invalid %s '%s'" % (bridge, name, value)) + elif name in ['miimon', 'use_carrier']: + try: + value = int(val) + if value < 0: + raise ValueError + + if name == 'use_carrier': + if value: + value = "carrier" + else: + value = "miimon" + argv += ["other-config:bond-detect-mode=%s" % value] + else: + argv += ["other-config:bond-miimon-interval=%d" % value] + except ValueError: + log("bridge %s has invalid %s '%s'" % (bridge, name, value)) elif name == "mode": if val in ['balance-slb', 'active-backup']: