virttest.utils_misc: Convert host_setup_flag into int

If host_setup_flag is set up in cfg files. Convert it to int in this
step. This can ignore the type error when use it for bit check.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
Merge pull request #832 from ypu/host_setup_flag

virttest.utils_misc: Convert host_setup_flag into int
qemu.test: fix module reload failed issue

Signed-off-by: Xu Tian <xutian@redhat.com>
qemu.test.cfg: Add cmd /c for windows disk write test

Add cmd /c to let the cmd session wait util the autoit scripts finished.
Otherwise it will return immediately after the autoit scripts start.
Also correct the script name.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
qemu.test.cfg: Add two sub test for windows disk write

Run CrystalDiskMark in guest during s3 and s4.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
run: Docstring fix

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virttest.qemu_vm: But fix in add_pcidevice.

This patch will fix following issue:

"qemu: -device pci-assign,host=06:00.1,id=id_06:00.1:
 Parameter 'id' expects an identifier\n"

Also correct parameter in add_pcidevice function call.

Signed-off-by: Feng Yang <fyang@redhat.com>
virttest.qemu_vm: generate mac address if not available in nic and add vf with mac

Now we need set mac for vf before using it. Or guest could not get IP.

Signed-off-by: Feng Yang <fyang@redhat.com>
qemu.tests: make sr_iov_hotplug_negative.py works with new PciAssignable class

We have update vm.pci_assignable.request_devs() function call.

Now we need create device dict and use it in request_devs().

We need set device["type"], device['mac'] (for vf), device["name"] (optional)

Signed-off-by: Feng Yang <fyang@redhat.com>
qemu.tests: Make sr_iov_hotplug.py works with new PciAssignable class

We have update vm.pci_assignable.request_devs() function call.

Now we need create device dict and use it in request_devs().

We need set device["type"], device['mac'] (for vf), device["name"] (optional)

Signed-off-by: Feng Yang <fyang@redhat.com>
qemu.tests.cfg.sr_iov: Config update.

Signed-off-by: Feng Yang <fyang@redhat.com>
virttest/test_setup:Add pf_vf_info element and get_pf_vf_info function into PciAssignable

get_pf_vf_info() will get following pf information:
    pf_id: The id of the pf device.
    occupied: Whether the pf device assigned or not
    vf_ids: vf device id list of this pf.
    ethname: network device interface name in host for this pf.

Signed-off-by: Feng Yang <fyang@redhat.com>
virttest.test_setup: Add get_vf_num_by_id() function to PciAssignable class

This function will return corresponding pf eth name and vf num according to vf id.
We need use pf eth name and vf num when setting mac for vf.

Signed-off-by: Feng Yang <fyang@redhat.com>
virttest/test_setup: Update _get_pf_pci_id() function.

Get the PF PCI ID from self.pf_vf_info.
Return the first available PF if name is not set.

Signed-off-by: Feng Yang <fyang@redhat.com>
virttest:test_setup: update get_vf_devs() and get_pf_devs() function

get requested vf or pf from self.pf_vf_info list.

Signed-off-by: Feng Yang <fyang@redhat.com>
virttest.test_setup: Update PciAssignable class

In this patch have following update:
1. Delete self.type_list and introduce self.devices.
2. Update add_device() to support mac setting for VF.
3. Update get_devs() to use new get_vf_devs() and get_pf_devs().
4. Update kvm parameter by echo to /sys folder.
5. Support set mac for VF.
6. Update the way used to update kvm module parameter.

Signed-off-by: Feng Yang <fyang@redhat.com>
virttest.test_setup: Change docstring from Doxygen to sphinx in PciAssignable class

Signed-off-by: Feng Yang <fyang@redhat.com>
virttest.test_setup: Support vfio for pf/vf pci assign

Also add new function get_same_group_devs() to get devices in same
group.

Get device's driver from /sys/bus/pci/devices/[device id]/driver

Signed-off-by: Feng Yang <fyang@redhat.com>
virttest.qemu_vm: Support device_driver parameter in pci_assignable related device.

It used to set which device we want to use in device assignment test

Signed-off-by: Feng Yang <fyang@redhat.com>
virttest.test_setup: Fix issue that 'pci-assign' is treated as not support in some host which really support it.

In some host pci-assign is aliased as kvm-pci-assign in qemu-kvm -device ?
So pci-assign is treated as not support. Add code to fix this.

Signed-off-by: Feng Yang <fyang@redhat.com>