From 3b3289fcb969fa3eab708b55d1b7d24d32644d1b Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 21 Apr 2010 10:49:12 -0700 Subject: [PATCH] xenserver: Rewrite refresh-network-uuids script for decent performance. Calling "interface-reconfigure up" can take a couple of seconds, but all we have to do here, really, is fetch the network UUIDs and invoke ovs-vsctl, which is much faster. So rewrite this script in Python and make it do just that. --- ..._openvswitch_scripts_refresh-network-uuids | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/xenserver/usr_share_openvswitch_scripts_refresh-network-uuids b/xenserver/usr_share_openvswitch_scripts_refresh-network-uuids index 34fe1e7e..55a8ba8b 100755 --- a/xenserver/usr_share_openvswitch_scripts_refresh-network-uuids +++ b/xenserver/usr_share_openvswitch_scripts_refresh-network-uuids @@ -1,12 +1,21 @@ -#! /bin/sh - -. /etc/xensource-inventory - -for pif in $(xe pif-list --minimal host-uuid=${INSTALLATION_UUID} currently-attached=true VLAN=-1 | sed 's/,/ /g'); do - printf "Refreshing PIF %s... " $pif - if /opt/xensource/libexec/interface-reconfigure --pif-uuid=$pif up; then - printf "done\n" - else - printf "error!\n" - fi -done +#! /usr/bin/python + +import sys +sys.path.insert(0, "/opt/xensource/libexec") +from InterfaceReconfigure import * +from InterfaceReconfigureVswitch import * + +db_init_from_xenapi(None) + +vsctl_argv = [] +for pif in db().get_all_pifs(): + pifrec = db().get_pif_record(pif) + if not pif_is_vlan(pif) and pifrec['currently_attached']: + vsctl_argv += set_br_external_ids(pif) + +#log("modifying configuration:") +#for c in vsctl_argv: +# log(" %s" % c) + +if vsctl_argv != []: + datapath_modify_config(vsctl_argv) -- 2.30.2