Esempio n. 1
0
def configured_hosts(request, host_scenarios, host_0_up, host_1_up):
    source_attach_data = host_scenarios[request.param[0]]
    destination_attach_data = host_scenarios[request.param[1]]

    with hostlib.setup_networks(host_0_up,
                                source_attach_data), hostlib.setup_networks(
                                    host_1_up, destination_attach_data):
        yield (host_0_up, host_1_up)
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 test_bond_active_slave(system, default_data_center, default_cluster,
                           host_0_up):
    bond_data = netattachlib.ActiveSlaveBonding(
        BOND_NAME, slave_names=(SLAVE1, SLAVE2)
    )
    with hostlib.setup_networks(host_0_up, bonding_data=(bond_data,)):
        bond = hostlib.Bond(host_0_up)
        bond.import_by_name(BOND_NAME)
        bond.wait_for_up_status()
        initial_active_slave = bond.active_slave
        inactive_slave = bond.inactive_slaves[0]
        sshlib.Node(
            host_0_up.address, host_0_up.root_password
        ).change_active_slave(BOND_NAME, inactive_slave.name)
        try:
            syncutil.sync(
                exec_func=lambda: bond.active_slave,
                exec_func_args=(),
                success_criteria=lambda active_slave:
                    active_slave.id != initial_active_slave.id,
                timeout=10
            )
        except syncutil.Timeout:
            raise ActiveSlaveNotChangedError(
                'active slave: {} initial active slave: {}'.format(
                    bond.active_slave.name, initial_active_slave.name
                )
            )
def port_isolation_network(default_data_center, default_cluster, host_1_up):
    with clusterlib.new_assigned_network(PORT_ISOLATION_NET,
                                         default_data_center,
                                         default_cluster,
                                         port_isolation=True) as network:
        attach_data = netattachlib.NetworkAttachmentData(network, ETH1)
        with hostlib.setup_networks(host_1_up, attach_data=(attach_data, )):
            yield network
Esempio n. 5
0
def port_isolation_network(default_data_center, default_cluster, host_1_up,
                           af):
    with clusterlib.new_assigned_network(
            PORT_ISOLATION_NET,
            default_data_center,
            default_cluster,
            port_isolation=True,
    ) as network:
        attach_data = netattachlib.NetworkAttachmentData(
            network, ETH1, (netattachlib.DYNAMIC_IP_ASSIGN[af.family], ))
        with hostlib.setup_networks(host_1_up, attach_data=(attach_data, )):
            yield network
Esempio n. 6
0
def test_sync_across_cluster(default_data_center, default_cluster, host_0_up,
                             host_1_up):

    cluster_hosts_up = (host_0_up, host_1_up)
    with clusterlib.new_assigned_network('sync-net', default_data_center,
                                         default_cluster) as sync_net:
        with contextlib2.ExitStack() as stack:
            for i, host in enumerate(cluster_hosts_up):
                att_datum = create_attachment(sync_net, i)
                stack.enter_context(hostlib.setup_networks(
                    host, (att_datum, )))
                stack.enter_context(unsynced_host_network(host))
            default_cluster.sync_all_networks()
            for host in cluster_hosts_up:
                host.wait_for_networks_in_sync()
Esempio n. 7
0
def running_cirros_vm(
    system,
    default_data_center,
    default_cluster,
    default_storage_domain,
    ovirtmgmt_vnic_profile,
    host_0_up,
    host_1_up,
    cirros_template,
):
    with clusterlib.new_assigned_network(NET1, default_data_center,
                                         default_cluster) as net_1:
        attach_data_1 = netattachlib.NetworkAttachmentData(net_1, ETH1)
        with clusterlib.new_assigned_network(NET2, default_data_center,
                                             default_cluster) as net_2:
            attach_data_2 = netattachlib.NetworkAttachmentData(net_2, ETH2)
            with hostlib.setup_networks(host_0_up,
                                        attach_data=(attach_data_1,
                                                     attach_data_2)):
                with hostlib.setup_networks(host_1_up,
                                            attach_data=(attach_data_1,
                                                         attach_data_2)):
                    with virtlib.vm_pool(system, size=1) as (vm, ):
                        vm.create(
                            vm_name=VM_CIRROS,
                            cluster=default_cluster,
                            template=cirros_template,
                        )
                        vm.create_vnic(NIC_NAMES[0], ovirtmgmt_vnic_profile)
                        vm.create_vnic(NIC_NAMES[1], net_1.vnic_profile())
                        vm.create_vnic(NIC_NAMES[2], net_2.vnic_profile())
                        vm.wait_for_down_status()
                        vm.run()
                        vm.wait_for_up_status()
                        joblib.AllJobs(system).wait_for_done()
                        yield vm
Esempio n. 8
0
def configured_hosts(request, host_config, host_0_up, host_1_up):
    SRC_CONF = request.param[0]
    DEST_CONF = request.param[1]

    setup_host_0 = hostlib.setup_networks(
        host_0_up,
        attach_data=host_config[SRC_CONF].attachments,
        bonding_data=host_config[SRC_CONF].bonds)

    setup_host_1 = _setup_destination_host(
        host_1_up,
        attach_data=host_config[DEST_CONF].attachments,
        bonding_data=host_config[DEST_CONF].bonds)

    with setup_host_0, setup_host_1:
        yield (host_0_up, host_1_up)
def test_sync_across_cluster(default_data_center, default_cluster,
                             host_0_up, host_1_up):

    cluster_hosts_up = (host_0_up, host_1_up)
    with netlib.new_network('sync-net', default_data_center) as sync_net:
        with clusterlib.network_assignment(default_cluster, sync_net):
            with contextlib2.ExitStack() as stack:
                for i, host in enumerate(cluster_hosts_up):
                    att_datum = create_attachment(sync_net, i)
                    stack.enter_context(
                        hostlib.setup_networks(host, (att_datum,))
                    )
                    stack.enter_context(unsynced_host_network(host))
                default_cluster.sync_all_networks()
                for host in cluster_hosts_up:
                    host.wait_for_networks_in_sync()
Esempio n. 10
0
def test_setup_net_with_qos(system, default_data_center, default_cluster,
                            default_storage_domain, cluster_host_up,
                            qos_net, vm_qos):

    qos_configs = default_data_center.list_qos()
    assert len([qos for qos in qos_configs if qos.name in QOS_NAMES]) == 2

    with clusterlib.network_assignment(default_cluster, qos_net):
        attach_data = _create_net_attachment_data(qos_net)
        with hostlib.setup_networks(cluster_host_up, (attach_data,)):
            with netlib.create_vnic_profile(
                    system, QOS_VP, qos_net, vm_qos) as profile:
                with vm_down(
                        system, default_cluster, default_storage_domain) as vm:
                    vm.create_vnic(NIC2, profile)
                    vm.run()
                    vm.wait_for_powering_up_status()
def test_setup_net_with_qos(system, default_data_center, default_cluster,
                            default_storage_domain, cluster_host_up,
                            qos_net, vm_qos):

    qos_configs = default_data_center.list_qos()
    assert len([qos for qos in qos_configs if qos.name in QOS_NAMES]) == 2

    with clusterlib.network_assignment(default_cluster, qos_net):
        attach_data = _create_net_attachment_data(qos_net)
        with hostlib.setup_networks(cluster_host_up, (attach_data,)):
            with netlib.create_vnic_profile(
                    system, QOS_VP, qos_net, vm_qos) as profile:
                with vm_down(
                        system, default_cluster, default_storage_domain) as vm:
                    vm.create_vnic(NIC2, profile)
                    vm.run()
                    vm.wait_for_powering_up_status()
def test_sync_across_cluster(default_data_center, default_cluster, host_0_up,
                             host_1_up):

    cluster_hosts_up = (host_0_up, host_1_up)
    with clusterlib.new_assigned_network('sync-net', default_data_center,
                                         default_cluster) as sync_net:
        with contextlib.ExitStack() as stack:
            for host in cluster_hosts_up:
                net_attachment = netattachlib.NetworkAttachmentData(
                    sync_net, ETH2, (netattachlib.NO_V4, netattachlib.NO_V6))
                stack.enter_context(
                    hostlib.setup_networks(host, (net_attachment, )))
                stack.enter_context(unsynced_host_network(host))
            for host in cluster_hosts_up:
                host.wait_for_networks_out_of_sync((sync_net, ))
            default_cluster.sync_all_networks()
            for host in cluster_hosts_up:
                host.wait_for_networks_in_sync()