virttest.virt_vm: make pci_addr in make_create_command configurable

Make pci_addr can be get from cfg and or generate by the
make_create_command.

Signed-off-by: Chen Cao <kcao@redhat.com>
virttest.qemu_vm: Add start_time in create()

Add the guest boot up measure functions to help system_reset
case can make sure reset the guest during the guest boot up.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
virttest.qemu_vm: modify get_vcpu_pids() to fit for different monitor

Signed-off-by: yunzheng <yunzheng@redhat.com>
virttest.qemu_vm: Update the nic add and delete command line

Signed-off-by: Feng Yang <fyang@redhat.com>
virttest.qemu_vm: Update code for migrate.exec

As using gzip to migrate in exec mode requires start the destination
guest after generate the migration file with monitor command line.
Update the code to make migrate.exec in local works again.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
virttest.qemu_vm: Validate monitor before accessing it

The existed qemu_vm code just verifies if vm.monitors
is not empty, but the property could still return a
None type.

Since in the VM's monitor method there is some code to
validate the vm.monitors member, let's verify the
vm.monitor directly when we accessing it.

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
virttest.qemu_vm: Update add_drive in make_create_command

Update add_drive with more parameters using in test. And also update
related part code when generate qemu command line for harddisk, cdrom
and floppy.

Signed-off-by: Feng Yang <fyang@redhat.com>
Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
Signed-off-by: Yunping Zheng <yunzheng@redhat.com>
Signed-off-by: Shuping Cui <scui@redhat.com>
Signed-off-by: Yiqiao Pu <ypu@redhat.com>
virttest.qemu_vm: update command line for add_nic

Signed-off-by: Chen Cao <kcao@redhat.com>
virttest.qemu_vm: add boot_order_check support

Add support of bootindexes for nic dev.

changes from v1:
1) add the bootindex param in add_nic func as last one

Signed-off-by: Shuping Cui <scui@redhat.com>
virttest.qemu_vm: Add 'vhost' parameter instead of 'netdev_extra_params'

Add 'vhost' parameter for vhost=on configure,
and release 'netdev_extra_params' for other extra usage.

Signed-off-by: Golita Yue <gyue@redhat.com>
virttest.qemu_vm: Take bridge scripts back

We used to use qemu-ifup to manage the tap which have several
limitations:

1) If we want to specify a bridge, we must create a customized
qemu-ifup file as the default script always match the first bridge.
2) It's hard to add support for macvtap device.

So this patch let kvm subtest control the tap creation and setup then
pass it to qemu-kvm. User could specify the bridge he want to used in
configuration file.

The original autoconfiguration was changed by private bridge setup.

Changes from v1:
* Combine the private bridge config and TAP fd in one patchset,
dropped the "auto" mode

Changes from v2:
* Close TAP fds on VM.destroy() (thanks to Amos Kong for finding
the problem, and for Cleber and Jason for actually fixing it).

Changes from upstream:
* Keep network scripts method and make it configurable

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Signed-off-by: Yiqiao Pu <ypu@redhat.com>
virttest.qemu_vm: quick fix to make spice work on rhel5 host

This is a quick fix to make spice work on rhel5 host.
As spice in rhel6 host and rhel5 host is different, we'll
create different functions to add spice in rhel5 hosts.

Signed-off-by: Feng Yang <fyang@redhat.com>
Signed-off-by: Yiqiao Pu <ypu@redhat.com>
virttest.qemu_vm: Check machine type available before using it

If setting machine type is not available, warning message will print
out and default machine type will be used.

Changes from v1:
Add invalid_type parameter.
if we want to test invalid type, need set it to true.

Signed-off-by: Feng Yang <fyang@redhat.com>
virttest.qemu_vm: Add freq option to usb device

USB EHCI controller has a 'freq' option, it's used to specify controller
Wakeup frequency.  Effect is that ehci will batch the frame processing
and process 4 frames per wakeup.  Reduces the cpu load, but also reduces
usb performance.  Not guest-visible.

The default value of this option is 1000, which equals the usb frame rate.
Can be reduced to -- for example -- 250.

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
virttest.qemu_vm: add new test check_roms support

add support for test check_roms, can use default roms
or some special roms.

Signed-off-by: Shuping Cui <scui@redhat.com>
virttest.qemu_vm: Start guest as nobody

this patch add test for check groups when guest is started as nobody
[v2] using qemu -runas option to exec the qemu.

Acked-by: Suqin Huang <shuang@redhat.com>
virttest.qemu_vm: Update mac address in reboot

For SRIOV cases guest mac address will change after reboot.
So need update mac address for them.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
virttest.qemu_vm: Update vcpu core/thread/socket calculation code

The existed code will generate an incorrect config when smp
number is small, thus add some check to deal with this situation.

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
virttest.qemu_vm: Use string in monitor.migrate_set_speed function call

monitor.migrate_set_speed only support string now

Signed-off-by: Feng Yang <fyang@redhat.com>
virttest.qemu_vm: Rename defaults to "use_nodefaults"

Since the defaults is generally used in config files for variants
and comments, it's a bit hard to grep the 'real' parameter.

And the meaning of 'defaults' is not much clear, so rename it to
'use_nodefaults', to mark its relationship with '-nodefaults'
option in qemu.

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>