def _create_vnic(vm, vnic_name, ovirtmgmt_vnic_profile, mac_addr=None):
    vnic = netlib.Vnic(vm)
    vnic.create(name=vnic_name,
                vnic_profile=ovirtmgmt_vnic_profile,
                mac_addr=mac_addr)
    with vm.wait_for_down_status():
        pass
示例#2
0
def test_connect_vm_to_external_network(ovirt_external_network, system,
                                        default_cluster,
                                        default_ovn_provider_client,
                                        default_storage_domain):
    cluster_network = clusterlib.ClusterNetwork(default_cluster)
    cluster_network.assign(ovirt_external_network)
    with virtlib.vm_pool(system, size=1) as (vm_0, ):
        vm_0.create(vm_name=VM0_NAME,
                    cluster=default_cluster,
                    template=templatelib.TEMPLATE_BLANK)
        disk = default_storage_domain.create_disk('disk1')
        vm_0.attach_disk(disk=disk)

        vnic_profile0 = netlib.VnicProfile(system)
        vnic_profile0.import_by_name(ovirt_external_network.name)

        assert not vnic_profile0.filter_id()

        vm0_vnic_0 = netlib.Vnic(vm_0)
        vm0_vnic_0.create(name=VNIC0_NAME,
                          vnic_profile=vnic_profile0,
                          mac_addr=VNIC0_MAC)
        vm_0.wait_for_down_status()

        vm_0.run()
        vm_0.wait_for_up_status()

        ovn_port = _lookup_port_by_device_id(vm0_vnic_0.id,
                                             default_ovn_provider_client)
        assert ovn_port
        assert vm0_vnic_0.mac_address == ovn_port.mac_address
示例#3
0
def vnic_attached_to_ovn_network(system, vm_in_ovs_cluster_down,
                                 ovn_physnet_small_mtu):
    vnic_profile = netlib.VnicProfile(system)
    vnic_profile.import_by_name(ovn_physnet_small_mtu.name)
    vm_vnic = netlib.Vnic(vm_in_ovs_cluster_down)
    vm_vnic.create(name=VNIC0_NAME, vnic_profile=vnic_profile)
    return vm_vnic
示例#4
0
 def get_vnic(self, vnic_name):
     vnic = netlib.Vnic(self)
     vnic.import_by_name(vnic_name)
     return vnic
def _attach_new_vnic(vm, vnic_profile):
    vnic = netlib.Vnic(vm)
    vnic.create(name=NIC_NAME, vnic_profile=vnic_profile)
    vm.wait_for_down_status()
示例#6
0
def _attach_new_vnic(vm, vnic_profile):
    NIC_NAME = 'nic1'
    vnic = netlib.Vnic(vm)
    vnic.create(name=NIC_NAME, vnic_profile=vnic_profile)
    with vm.wait_for_down_status():
        pass
示例#7
0
 def create_vnic(self, vnic_name, vnic_profile, mac_addr=None):
     vnic = netlib.Vnic(self)
     vnic.create(name=vnic_name,
                 vnic_profile=vnic_profile,
                 mac_addr=mac_addr)
     return vnic