Esempio n. 1
0
def create_attachment(network, i):
    ip_assign = netattachlib.StaticIpAssignment(addr='192.168.125.' +
                                                str(i + 2),
                                                mask='255.255.255.0')
    att_datum = netattachlib.NetworkAttachmentData(network, ETH2,
                                                   (ip_assign, ))
    return att_datum
Esempio n. 2
0
def test_non_mgmt_display_network_over_ipv6(system, default_data_center,
                                            default_cluster, host_0_up,
                                            host0_eth1_ipv6, host0_eth2_ipv6,
                                            engine_storage_ipv6):
    """
    This test verifies that:
     * it is possible to create a display role over an ipv6 only network
     * it is possible to connect with a graphic display to a VM over this
       network
    Note: host0_eth1_ipv6 fixture is mandatory because if there is no ipv6
          address on eth1 of the host, connection with the storage server
          cannot be maintained
    """
    assert host0_eth1_ipv6 != ''
    with netlib.new_network('ipv6-disp_net', default_data_center) as net:
        with clusterlib.network_assignment(default_cluster, net) as cl_net:
            cl_net.set_usages((netlib.NetworkUsage.DISPLAY, ))
            no_v4 = netattachlib.NoIpAssignment()
            v6_no_gw = netattachlib.StaticIpAssignment(
                version=netattachlib.IpVersion.V6,
                addr=host0_eth2_ipv6,
                mask='64',
            )
            attach_data = netattachlib.NetworkAttachmentData(
                net, 'eth2', (no_v4, v6_no_gw))
            with hostlib.setup_networks(host_0_up, (attach_data, )):
                host_0_up.wait_for_networks_in_sync()
                VM0 = 'vm_non_mgmt_display_net_over_ipv6'
                DSK = 'disk_non_mgmt_display_net_over_ipv6'
                with vm_powering_up(system, default_data_center,
                                    default_cluster, host_0_up,
                                    engine_storage_ipv6, VM0, DSK) as vm:
                    _try_spice_console_connect(vm)
Esempio n. 3
0
def host_1_with_mig_net(migration_network, host_1_up):
    ip_config = netattachlib.StaticIpAssignment(addr=MIG_NET_IPv4_ADDR_2,
                                                mask=MIG_NET_IPv4_MASK)
    mig_att_data = netattachlib.NetworkAttachmentData(migration_network, ETH1,
                                                      [ip_config])
    host_1_up.setup_networks([mig_att_data])
    yield host_1_up
    host_1_up.remove_networks((migration_network, ))
Esempio n. 4
0
def display_network_attached_to_host_0(host_0_up, display_network):
    ETH1 = 'eth1'
    DISP_NET_IPv4_ADDR_1 = '192.0.3.1'
    DISP_NET_IPv4_MASK = '255.255.255.0'

    ip_assign = netattachlib.StaticIpAssignment(addr=DISP_NET_IPv4_ADDR_1,
                                                mask=DISP_NET_IPv4_MASK)
    disp_att_data = netattachlib.NetworkAttachmentData(display_network, ETH1,
                                                       [ip_assign])
    host_0_up.setup_networks([disp_att_data])
    yield host_0_up
    host_0_up.remove_networks([display_network])
def cluster_hosts_net_setup(cluster_hosts_up, req_net, cluster_net):
    try:
        for i, host in enumerate(cluster_hosts_up):
            ip_assign = netattachlib.StaticIpAssignment(
                addr=REQ_NET_IPv4_ADDR_PREFIX + str(i + 2),
                mask=REQ_NET_IPv4_MASK)
            req_att_data = netattachlib.NetworkAttachmentData(
                req_net, ETH1, [ip_assign])
            host.setup_networks([req_att_data])
    except Exception as e:
        # if setup fails for some of the hosts roll it back before aborting
        remove_net_from_hosts(cluster_hosts_up, req_net)
        raise e
    yield cluster_hosts_up
    remove_net_from_hosts(cluster_hosts_up, req_net)
Esempio n. 6
0
def _create_net_attachment_data(qos_net):
    ip_assign = netattachlib.StaticIpAssignment(
        addr=QOS_NET_IPv4_ADDR, mask=QOS_NET_IPv4_MASK
    )
    att_data = netattachlib.NetworkAttachmentData(qos_net, ETH2, (ip_assign,))
    return att_data