

@classmethod
def find_network_with_bridge(cls, session, bridge):
    "\n        Return the network on which the bridge is attached, if found.\n        The bridge is defined in the nova db and can be found either in the\n        'bridge' or 'name_label' fields of the XenAPI network record.\n        "
    expr = ('field "name__label" = "%s" or field "bridge" = "%s"' % (bridge, bridge))
    networks = session.call_xenapi('network.get_all_records_where', expr)
    if (len(networks) == 1):
        return networks.keys()[0]
    elif (len(networks) > 1):
        raise Exception((_('Found non-unique network for bridge %s') % bridge))
    else:
        raise Exception((_('Found no network for bridge %s') % bridge))

dataset/ETHPy150Open nii-cloud/dodai-compute/nova/virt/xenapi/network_utils.py NetworkHelper.find_network_with_bridge/original