summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xenserver/README5
-rw-r--r--xenserver/automake.mk1
-rw-r--r--xenserver/openvswitch-xen.spec9
-rwxr-xr-xxenserver/usr_sbin_brctl136
4 files changed, 2 insertions, 149 deletions
diff --git a/xenserver/README b/xenserver/README
index 3110aabc8..058014e94 100644
--- a/xenserver/README
+++ b/xenserver/README
@@ -67,11 +67,6 @@ files are:
used to control Open vSwitch when integrated with Citrix
management tools.
- usr_sbin_brctl
-
- wrapper for /usr/sbin/brctl that provides some additional
- bridge compatibility
-
usr_sbin_xen-bugtool
Open vSwitch-aware replacement for Citrix script of the same name.
diff --git a/xenserver/automake.mk b/xenserver/automake.mk
index fc23a7636..24b12035f 100644
--- a/xenserver/automake.mk
+++ b/xenserver/automake.mk
@@ -22,7 +22,6 @@ EXTRA_DIST += \
xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py \
xenserver/opt_xensource_libexec_interface-reconfigure \
xenserver/usr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py \
- xenserver/usr_sbin_brctl \
xenserver/usr_sbin_xen-bugtool \
xenserver/usr_share_openvswitch_scripts_ovs-external-ids \
xenserver/usr_share_openvswitch_scripts_refresh-xs-network-uuids \
diff --git a/xenserver/openvswitch-xen.spec b/xenserver/openvswitch-xen.spec
index 9a050907d..ba4fc11a9 100644
--- a/xenserver/openvswitch-xen.spec
+++ b/xenserver/openvswitch-xen.spec
@@ -79,8 +79,6 @@ install -m 755 xenserver/usr_share_openvswitch_scripts_refresh-xs-network-uuids
$RPM_BUILD_ROOT/usr/share/openvswitch/scripts/refresh-xs-network-uuids
install -m 755 xenserver/usr_sbin_xen-bugtool \
$RPM_BUILD_ROOT/usr/share/openvswitch/scripts/xen-bugtool
-install -m 755 xenserver/usr_sbin_brctl \
- $RPM_BUILD_ROOT/usr/share/openvswitch/scripts/brctl
install -m 755 xenserver/usr_share_openvswitch_scripts_sysconfig.template \
$RPM_BUILD_ROOT/usr/share/openvswitch/scripts/sysconfig.template
install -m 755 utilities/ovs-save \
@@ -259,8 +257,7 @@ for f in \
/opt/xensource/libexec/InterfaceReconfigureBridge.py \
/opt/xensource/libexec/InterfaceReconfigureVswitch.py \
/etc/xensource/scripts/vif \
- /usr/sbin/xen-bugtool \
- /usr/sbin/brctl
+ /usr/sbin/xen-bugtool
do
s=$(basename "$f")
t=$(readlink "$f")
@@ -328,8 +325,7 @@ if [ "$1" = "0" ]; then # $1 = 1 for upgrade
/opt/xensource/libexec/InterfaceReconfigureBridge.py \
/opt/xensource/libexec/InterfaceReconfigureVswitch.py \
/etc/xensource/scripts/vif \
- /usr/sbin/xen-bugtool \
- /usr/sbin/brctl
+ /usr/sbin/xen-bugtool
do
s=$(basename "$f")
if [ ! -f "/usr/lib/openvswitch/xs-original/$s" ]; then
@@ -402,7 +398,6 @@ fi
/usr/share/openvswitch/scripts/InterfaceReconfigureVswitch.py
/usr/share/openvswitch/scripts/vif
/usr/share/openvswitch/scripts/xen-bugtool
-/usr/share/openvswitch/scripts/brctl
/usr/share/openvswitch/scripts/sysconfig.template
/usr/share/openvswitch/scripts/ovs-save
/usr/share/openvswitch/vswitch.ovsschema
diff --git a/xenserver/usr_sbin_brctl b/xenserver/usr_sbin_brctl
deleted file mode 100755
index 5cf0b88ac..000000000
--- a/xenserver/usr_sbin_brctl
+++ /dev/null
@@ -1,136 +0,0 @@
-#! /usr/bin/python
-#
-# Copyright (c) 2009, 2010 Nicira Networks.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at:
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import getopt
-import os
-import re
-import subprocess
-import sys
-
-argv0 = sys.argv[0]
-
-BRCTL = "/usr/lib/openvswitch/xs-original/brctl"
-VSCTL = "/usr/bin/ovs-vsctl"
-OVSDB_SERVER = "unix:/var/run/openvswitch/db.sock"
-
-# Execute the real brctl program, passing the same arguments that were passed
-# to us.
-def delegate():
- os.execl(BRCTL, BRCTL, *sys.argv[1:])
- # execl should never return. We only arrive here if brctl failed to exec.
- sys.exit(1)
-
-def call_vsctl(cmd, arg=""):
- database = '--db=' + OVSDB_SERVER
- command = [VSCTL, '--timeout=30', database, cmd]
- if (arg):
- command.append(arg)
- return subprocess.Popen(command, stdout=subprocess.PIPE).communicate()[0].split()
-
-# Returns a list of all the bridges
-def get_bridges():
- return call_vsctl('list-br')
-
-# Returns a list of all ports on 'bridge'
-def get_bridge_ports(bridge):
- return call_vsctl('list-ports', bridge)
-
-# Returns a list of all interfaces on 'bridge'
-def get_bridge_ifaces(bridge):
- return call_vsctl('list-ifaces', bridge)
-
-# Returns the parent of 'bridge'. If 'bridge' does not have a parent,
-# 'bridge' is returned.
-def get_bridge_parent(bridge):
- return call_vsctl('br-to-parent', bridge)
-
-# Returns the first line of the file named 'name', with the trailing new-line
-# (if any) stripped off.
-def read_first_line_of_file(name):
- file = None
- try:
- file = open(name, 'r')
- return file.readline().rstrip('\n')
- finally:
- if file != None:
- file.close()
-
-# Returns a bridge ID constructed from the MAC address of network device
-# 'netdev', in the format "8000.000102030405".
-def get_bridge_id(netdev):
- try:
- hwaddr = read_first_line_of_file("/sys/class/net/%s/address" % netdev)
- return "8000.%s" % (hwaddr.replace(":", ""))
- except:
- return "8000.002320ffffff"
-
-def cmd_show():
- print "bridge name\tbridge id\t\tSTP enabled\tinterfaces"
-
- # Find all the bridges.
- bridges = get_bridges()
-
- # Find all the interfaces on each bridge.
- for bridge in bridges:
- bridge_ports = get_bridge_ports(bridge)
- parent = get_bridge_parent(bridge)
- if parent in bridge_ports:
- bridge_ports.remove(parent)
- bridge_ports.sort()
- bridge_id = get_bridge_id(bridge)
- first_port = ""
- if bridge_ports:
- first_port = bridge_ports[0]
- print "%s\t\t%s\t%s\t\t%s" % (bridge, bridge_id, "no", first_port)
- for port in bridge_ports[1:]:
- print "\t\t\t\t\t\t\t%s" % port
-
-def main():
- # Check the network configuration mode.
- try:
- network_mode = read_first_line_of_file('/etc/xensource/network.conf')
- if network_mode == 'bridge':
- delegate()
- except:
- # File probably doesn't exist
- pass
-
- # Parse the command line.
- try:
- options, args = getopt.gnu_getopt(sys.argv[1:],
- "hV", ["help", "version"])
- except getopt.GetoptError, msg:
- sys.stderr.write("%s: %s (use --help for help)\n" % (argv0, msg))
- sys.exit(1)
-
- # Handle command-line options.
- for opt, optarg in options:
- if opt == "-h" or opt == "--help":
- delegate()
- elif opt == "-V" or opt == "--version":
- subprocess.call([BRCTL, "--version"])
- print "Open vSwitch brctl wrapper"
- sys.exit(0)
-
- # Execute commands. Most commands are delegated to the brctl binary that
- # we are wrapping, but we implement the "show" command ourselves.
- if args and args[0] == "show":
- cmd_show()
- else:
- delegate()
-
-if __name__ == "__main__":
- main()