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