コード例 #1
0
ファイル: graphics.py プロジェクト: andrewlukoshko/vdsm
def _getNetworkIp(network):
    try:
        nets = net_api.libvirt_networks()
        device = nets[network].get('iface', network)
        ip, _, _, _ = net_api.ip_addrs_info(device)
    except (libvirt.libvirtError, KeyError, IndexError):
        ip = config.get('addresses', 'guests_gateway_ip')
        if ip == '':
            ip = '0'
        logging.info('network %s: using %s', network, ip)
    return ip
コード例 #2
0
ファイル: graphics.py プロジェクト: yingyun001/vdsm
def _getNetworkIp(network):
    try:
        nets = net_api.libvirt_networks()
        # On a legacy based network, the device is the iface specified in the
        # network report (supporting real bridgeless networks).
        # In case the report or the iface key is missing,
        # the device is defaulted to the network name (i.e. northbound port).
        device = nets[network].get("iface", network) if network in nets else network
        ip, _, _, _ = net_api.ip_addrs_info(device)
    except (libvirt.libvirtError, KeyError, IndexError):
        ip = config.get("addresses", "guests_gateway_ip")
    finally:
        if ip == "":
            ip = "0"
    return ip
コード例 #3
0
ファイル: graphics.py プロジェクト: xin49/vdsm
def _getNetworkIp(network):
    try:
        nets = libvirtnetwork.networks()
        # On a legacy based network, the device is the iface specified in the
        # network report (supporting real bridgeless networks).
        # In case the report or the iface key is missing,
        # the device is defaulted to the network name (i.e. northbound port).
        device = (nets[network].get('iface', network)
                  if network in nets else network)
        ip, _, _, _ = net_api.ip_addrs_info(device)
    except (libvirt.libvirtError, KeyError, IndexError):
        ip = '0'
    finally:
        if ip == '':
            ip = '0'
    return ip
コード例 #4
0
ファイル: graphics.py プロジェクト: EdDev/vdsm
def _getNetworkIp(network):
    try:
        nets = libvirtnetwork.networks()
        # On a legacy based network, the device is the iface specified in the
        # network report (supporting real bridgeless networks).
        # In case the report or the iface key is missing,
        # the device is defaulted to the network name (i.e. northbound port).
        device = (nets[network].get('iface', network)
                  if network in nets else network)
        ip, _, _, _ = net_api.ip_addrs_info(device)
    except (libvirt.libvirtError, KeyError, IndexError):
        ip = '0'
    finally:
        if ip == '':
            ip = '0'
    return ip