Esempio n. 1
0
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
Esempio n. 2
0
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
Esempio n. 3
0
def upgrade():
    rconfig = RunningConfig()
    pconfig = PersistentConfig()

    libvirt_networks = libvirtnetwork.networks()

    _upgrade_volatile_running_config(rconfig)

    if rconfig.config_exists() or pconfig.config_exists():
        _upgrade_unified_configuration(rconfig)
        _upgrade_unified_configuration(pconfig)
    else:
        # In case unified config has not existed before, it is assumed that
        # the networks existance have been persisted in libvirt db.
        vdsmnets = libvirt_vdsm_nets(libvirt_networks)
        _create_unified_configuration(rconfig, NetInfo(netinfo(vdsmnets)))

    _cleanup_libvirt_networks(libvirt_networks)
Esempio n. 4
0
def upgrade():
    rconfig = RunningConfig()
    pconfig = PersistentConfig()

    libvirt_networks = libvirtnetwork.networks()

    _upgrade_volatile_running_config(rconfig)

    if rconfig.config_exists() or pconfig.config_exists():
        _upgrade_unified_configuration(rconfig)
        _upgrade_unified_configuration(pconfig)
    else:
        # In case unified config has not existed before, it is assumed that
        # the networks existance have been persisted in libvirt db.
        vdsmnets = libvirt_vdsm_nets(libvirt_networks)
        _create_unified_configuration(rconfig, NetInfo(netinfo(vdsmnets)))

    _cleanup_libvirt_networks(libvirt_networks)