From: Ben Pfaff Date: Wed, 13 May 2009 21:15:58 +0000 (-0700) Subject: xenserver: Fix --force up/down behavior in a resource pool. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=696e1e4592a351989ca7653564d2fee84948e49a;p=openvswitch xenserver: Fix --force up/down behavior in a resource pool. The PIFs key of a network lists one PIF for each member of the pool, not one PIF per bond or whatever I had in mind. So we need to iterate over all the PIFs in the network and find the one for our current host. --- diff --git a/xenserver/opt_xensource_libexec_interface-reconfigure b/xenserver/opt_xensource_libexec_interface-reconfigure index 70125374..d30beec2 100755 --- a/xenserver/opt_xensource_libexec_interface-reconfigure +++ b/xenserver/opt_xensource_libexec_interface-reconfigure @@ -315,16 +315,13 @@ class DatabaseCache(object): answer = None for network in networks: nwrec = self.get_network_record(network) - pif_uuids = nwrec['PIFs'] - if len(pif_uuids) != 1: - continue - pif = pif_uuids[0] - pifrec = self.get_pif_record(pif) - if pifrec['host'] != host: - continue - if answer: - raise Error("Multiple PIFs on %s for network %s" % (host, bridge)) - answer = pif + for pif in nwrec['PIFs']: + pifrec = self.get_pif_record(pif) + if pifrec['host'] != host: + continue + if answer: + raise Error("Multiple PIFs on %s for network %s" % (host, bridge)) + answer = pif if not answer: raise Error("No PIF on %s for network %s" % (host, bridge)) return answer