X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=xenserver%2Fetc_xapi.d_plugins_openvswitch-cfg-update;h=2df838a7e5efbb37124002c7ba3f0c95e0a44ad8;hb=HEAD;hp=60cd7167bfe16bfa8dcb332e6bd6a15b393e7a02;hpb=c1a543a8d6d2847983b6b0defd1e19777da85715;p=sliver-openvswitch.git diff --git a/xenserver/etc_xapi.d_plugins_openvswitch-cfg-update b/xenserver/etc_xapi.d_plugins_openvswitch-cfg-update index 60cd7167b..2df838a7e 100755 --- a/xenserver/etc_xapi.d_plugins_openvswitch-cfg-update +++ b/xenserver/etc_xapi.d_plugins_openvswitch-cfg-update @@ -4,7 +4,7 @@ # ovs-vswitchd configuration that are managed in the xapi database when # integrated with Citrix management tools. -# Copyright (C) 2009, 2010, 2011 Nicira Networks, Inc. +# Copyright (C) 2009, 2010, 2011, 2012, 2013 Nicira, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -86,24 +86,22 @@ def update(session, args): bton = {} - for n in session.xenapi.network.get_all(): - rec = session.xenapi.network.get_record(n) + for rec in session.xenapi.network.get_all_records().values(): try: bton[rec['bridge']] = rec except KeyError: pass - # If new controller, get managagment MAC addresses from XAPI now + # If new controller, get management MAC addresses from XAPI now # in case fail_mode set to secure which may affect XAPI access mgmt_bridge = None host_mgmt_mac = None host_mgmt_device = None pool_mgmt_macs = {} if new_controller: - for n in session.xenapi.PIF.get_all(): - rec = session.xenapi.PIF.get_record(n) - if rec.get('management', False): - pool_mgmt_macs[rec.get('MAC')] = rec.get('device') + recs = session.xenapi.PIF.get_all_records_where('field "management"="true"') + for rec in recs.itervalues(): + pool_mgmt_macs[rec.get('MAC')] = rec.get('device') dib_changed = False fail_mode_changed = False @@ -215,7 +213,7 @@ def setControllerCfg(controller): "--", "set-manager", 'ssl:' + controller + ':6632']) def vswitchCfgQuery(action_args): - cmd = [vsctl, "--timeout=5", "-vANY:console:off"] + action_args + cmd = [vsctl, "-vconsole:off"] + action_args output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate() if len(output) == 0 or output[0] == None: output = "" @@ -224,7 +222,7 @@ def vswitchCfgQuery(action_args): return output def vswitchCfgMod(action_args): - cmd = [vsctl, "--timeout=5", "-vANY:console:off"] + action_args + cmd = [vsctl, "--timeout=5", "-vconsole:off"] + action_args exitcode = subprocess.call(cmd) if exitcode != 0: raise XenAPIPlugin.Failure("VSWITCH_CONFIG_MOD_FAILURE",