From b9b627d543e18618ef64726a8d7d141d1b89bf41 Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Tue, 11 Jan 2011 19:10:28 -0800 Subject: [PATCH] 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 --- tests/interface-reconfigure.at | 4 ++-- ...source_libexec_InterfaceReconfigureVswitch.py | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/interface-reconfigure.at b/tests/interface-reconfigure.at index 7cf6d9ec..5e987d9f 100644 --- a/tests/interface-reconfigure.at +++ b/tests/interface-reconfigure.at @@ -800,7 +800,7 @@ Applying changes to /etc/sysconfig/network-scripts/ifcfg-xapi1 configuration --may-exist add-br xapi1 --with-iface --if-exists del-port bond0 --fake-iface add-bond xapi1 bond0 eth0 eth1 - set Port bond0 MAC="00:22:19:22:4b:af" bond_downdelay=200 other-config:"bond-miimon"=100 other-config:"bond-use_carrier"=1 bond_mode=balance-slb bond_updelay=31000 + set Port bond0 MAC="00:22:19:22:4b:af" bond_downdelay=200 other-config:bond-miimon-interval=100 other-config:bond-detect-mode=carrier bond_mode=balance-slb bond_updelay=31000 set Bridge xapi1 other-config:hwaddr="00:22:19:22:4b:af" br-set-external-id xapi1 xs-network-uuids 45cbbb43-113d-a712-3231-c6463f253cef;99be2da4-6c33-6f8e-49ea-3bc592fe3c85 /sbin/ifup xapi1 @@ -881,7 +881,7 @@ Applying changes to /etc/sysconfig/network-scripts/ifcfg-xapi2 configuration --may-exist add-br xapi1 --with-iface --if-exists del-port bond0 --fake-iface add-bond xapi1 bond0 eth0 eth1 - set Port bond0 MAC="00:22:19:22:4b:af" bond_downdelay=200 other-config:"bond-miimon"=100 other-config:"bond-use_carrier"=1 bond_mode=balance-slb bond_updelay=31000 + set Port bond0 MAC="00:22:19:22:4b:af" bond_downdelay=200 other-config:bond-miimon-interval=100 other-config:bond-detect-mode=carrier bond_mode=balance-slb bond_updelay=31000 set Bridge xapi1 other-config:hwaddr="00:22:19:22:4b:af" br-set-external-id xapi1 xs-network-uuids 45cbbb43-113d-a712-3231-c6463f253cef;99be2da4-6c33-6f8e-49ea-3bc592fe3c85 --if-exists del-br xapi2 diff --git a/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py b/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py index d70baa49..5be7461f 100644 --- a/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py +++ b/xenserver/opt_xensource_libexec_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']: -- 2.30.2