diff options
Diffstat (limited to 'plugins')
3 files changed, 27 insertions, 27 deletions
diff --git a/plugins/xenserver/networking/etc/xensource/scripts/ovs_configure_base_flows.py b/plugins/xenserver/networking/etc/xensource/scripts/ovs_configure_base_flows.py index 010c7673a..5f6f93c88 100755 --- a/plugins/xenserver/networking/etc/xensource/scripts/ovs_configure_base_flows.py +++ b/plugins/xenserver/networking/etc/xensource/scripts/ovs_configure_base_flows.py @@ -24,21 +24,21 @@ This script is used to configure base openvswitch flows for XenServer hosts. import os import sys - -from novalib import execute, execute_get_output +import novalib def main(command, phys_dev_name): - ovs_ofctl = lambda *rule: execute('/usr/bin/ovs-ofctl', *rule) + ovs_ofctl = lambda *rule: novalib.execute('/usr/bin/ovs-ofctl', *rule) bridge_name = \ - execute_get_output('/usr/bin/ovs-vsctl', 'iface-to-br', phys_dev_name) + novalib.execute_get_output('/usr/bin/ovs-vsctl', + 'iface-to-br', phys_dev_name) # always clear all flows first ovs_ofctl('del-flows', bridge_name) if command in ('online', 'reset'): - pnic_ofport = execute_get_output('/usr/bin/ovs-vsctl', 'get', + pnic_ofport = novalib.execute_get_output('/usr/bin/ovs-vsctl', 'get', 'Interface', phys_dev_name, 'ofport') # these flows are lower priority than all VM-specific flows. @@ -51,8 +51,8 @@ def main(command, phys_dev_name): # Allow traffic from dom0 if there is a management interface # present (its IP address is on the bridge itself) bridge_addr = \ - execute_get_output('/sbin/ip', '-o', '-f', 'inet', 'addr', 'show', - bridge_name) + novalib.execute_get_output('/sbin/ip', '-o', '-f', 'inet', 'addr', + 'show', bridge_name) if bridge_addr != '': ovs_ofctl('add-flow', bridge_name, "priority=2,in_port=LOCAL,actions=normal") diff --git a/plugins/xenserver/networking/etc/xensource/scripts/ovs_configure_vif_flows.py b/plugins/xenserver/networking/etc/xensource/scripts/ovs_configure_vif_flows.py index f5b188e8c..c2a029de3 100755 --- a/plugins/xenserver/networking/etc/xensource/scripts/ovs_configure_vif_flows.py +++ b/plugins/xenserver/networking/etc/xensource/scripts/ovs_configure_vif_flows.py @@ -21,13 +21,12 @@ This script is used to configure openvswitch flows on XenServer hosts. """ import os +import simplejson as json import sys # This is written to Python 2.4, since that is what is available on XenServer import netaddr -import simplejson as json - -from novalib import execute, execute_get_output +import novalib OVS_OFCTL = '/usr/bin/ovs-ofctl' @@ -39,10 +38,11 @@ class OvsFlow(object): self.params = params def add(self, rule): - execute(OVS_OFCTL, 'add-flow', self.bridge, rule % self.params) + novalib.execute(OVS_OFCTL, 'add-flow', self.bridge, rule % self.params) def clear_flows(self, ofport): - execute(OVS_OFCTL, 'del-flows', self.bridge, "in_port=%s" % ofport) + novalib.execute(OVS_OFCTL, 'del-flows', + self.bridge, "in_port=%s" % ofport) def main(command, vif_raw, net_type): @@ -52,14 +52,15 @@ def main(command, vif_raw, net_type): vif_name, dom_id, vif_index = vif_raw.split('-') vif = "%s%s.%s" % (vif_name, dom_id, vif_index) - bridge = execute_get_output('/usr/bin/ovs-vsctl', 'iface-to-br', vif) + bridge = novalib.execute_get_output('/usr/bin/ovs-vsctl', + 'iface-to-br', vif) - xsls = execute_get_output('/usr/bin/xenstore-ls', + xsls = novalib.execute_get_output('/usr/bin/xenstore-ls', '/local/domain/%s/vm-data/networking' % dom_id) macs = [line.split("=")[0].strip() for line in xsls.splitlines()] for mac in macs: - xsread = execute_get_output('/usr/bin/xenstore-read', + xsread = novalib.execute_get_output('/usr/bin/xenstore-read', '/local/domain/%s/vm-data/networking/%s' % (dom_id, mac)) data = json.loads(xsread) @@ -71,10 +72,10 @@ def main(command, vif_raw, net_type): phys_dev = "eth1" if vif == this_vif: - vif_ofport = execute_get_output('/usr/bin/ovs-vsctl', 'get', - 'Interface', vif, 'ofport') - phys_ofport = execute_get_output('/usr/bin/ovs-vsctl', 'get', - 'Interface', phys_dev, 'ofport') + vif_ofport = novalib.execute_get_output('/usr/bin/ovs-vsctl', + 'get', 'Interface', vif, 'ofport') + phys_ofport = novalib.execute_get_output('/usr/bin/ovs-vsctl', + 'get', 'Interface', phys_dev, 'ofport') params = dict(VIF_NAME=vif, MAC=data['mac'], diff --git a/plugins/xenserver/networking/etc/xensource/scripts/vif_rules.py b/plugins/xenserver/networking/etc/xensource/scripts/vif_rules.py index fea9849f1..157ecc298 100755 --- a/plugins/xenserver/networking/etc/xensource/scripts/vif_rules.py +++ b/plugins/xenserver/networking/etc/xensource/scripts/vif_rules.py @@ -24,20 +24,19 @@ XenServer hosts. import os import sys +import novalib + # This is written to Python 2.4, since that is what is available on XenServer import simplejson as json -from novalib import execute, execute_get_output - - def main(dom_id, command, only_this_vif=None): - xsls = execute_get_output('/usr/bin/xenstore-ls', + xsls = novalib.execute_get_output('/usr/bin/xenstore-ls', '/local/domain/%s/vm-data/networking' % dom_id) macs = [line.split("=")[0].strip() for line in xsls.splitlines()] for mac in macs: - xsread = execute_get_output('/usr/bin/xenstore-read', + xsread = novalib.execute_get_output('/usr/bin/xenstore-read', '/local/domain/%s/vm-data/networking/%s' % (dom_id, mac)) data = json.loads(xsread) @@ -60,7 +59,7 @@ def main(dom_id, command, only_this_vif=None): def apply_iptables_rules(command, params): - iptables = lambda *rule: execute('/sbin/iptables', *rule) + iptables = lambda *rule: novalib.execute('/sbin/iptables', *rule) iptables('-D', 'FORWARD', '-m', 'physdev', '--physdev-in', params['VIF'], @@ -74,7 +73,7 @@ def apply_iptables_rules(command, params): def apply_arptables_rules(command, params): - arptables = lambda *rule: execute('/sbin/arptables', *rule) + arptables = lambda *rule: novalib.execute('/sbin/arptables', *rule) arptables('-D', 'FORWARD', '--opcode', 'Request', '--in-interface', params['VIF'], @@ -99,7 +98,7 @@ def apply_arptables_rules(command, params): def apply_ebtables_rules(command, params): - ebtables = lambda *rule: execute("/sbin/ebtables", *rule) + ebtables = lambda *rule: novalib.execute("/sbin/ebtables", *rule) ebtables('-D', 'FORWARD', '-p', '0806', '-o', params['VIF'], '--arp-ip-dst', params['IP'], |