def get_vm_ifaces(session=None): """ Get interfaces of vm :param session: The session object to the host :return: interfaces """ p_iface, v_iface = utils_net.get_remote_host_net_ifs(session) return p_iface
def check_vm_iface_num(session, exp_num=3): """ Check he number of interfaces :param session: The session to the guest :param exp_num: The expected number :return: True when interfaces' number is equal to exp_num """ p_iface = utils_net.get_remote_host_net_ifs(session)[0] logging.debug("Ifaces in VM: %s", p_iface) return len(p_iface) == exp_num
def get_vm_iface(vm_session): """ Get VM's 1st interface :param vm_session: An session to VM :return: VM's first interface """ p_iface, _v_ifc = utils_net.get_remote_host_net_ifs(vm_session) vm_iface = p_iface[:1:] if not vm_iface: raise exceptions.TestFail("Failed to get vm's iface!") return vm_iface[0]
def test_unassigned_address(): """ Cold/Hot plug hostdev interface with 'unassigned' address type """ hostdev_dict = get_hostdev_dict(vf_pci, params) exec_test(vm, hostdev_dict, params) test.log.info("Check if the VM is not using VF.") libvirt_vfio.check_vfio_pci(vf_pci) vm_session = vm.wait_for_serial_login(timeout=240) p_iface = utils_net.get_remote_host_net_ifs(vm_session)[0] if p_iface: test.fail("There should be no interface, but got %s." % p_iface)