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 test support

add support bootindex 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>

git-svn-id: svn://test.kernel.org/autotest/trunk@5402 592f7852-d20e-0410-864c-8624ca9c26a4

Conflicts:

	client/virt/kvm_vm.py

Change from v1:
  - keep qemu-ifup sciprts

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 have
different function to add spice in rhel5 host.

It is not a perfect fix, just for rhel5.9 testing.
Will not send it to upstream.

changes from v1:
    - Disable the vga option in RHEL5 host
changes from v2:
    - Add disable-ticketing to cmd

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>
(cherry picked from commit debf4d646365d50cf4c7acecdd7ef96486e3bacd)

Conflicts:

	client/virt/kvm_vm.py
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>
virttest.qemu_vm:fix use the duplicated index in cmd

change from v1:
Use the new solution to resolve index problem.
It can be an sequential index generator, and also can test some special
situation that we want set some devices to specific index.

index_in_use = {} -- if there are definite index items, will mark them
                   in this dict. eg: drive_index_cd1 = 6, {'6': True}
index_global = 0 -- it is global variable, use it for image and cd's index.

if need set the specific index for stg or cd, can use following format:
drive_index_$name = $number
eg:  dirve_index_image1 = 5
     drive_index_stg2 = 6
     drive_index_cd1 = 7

change from v2:
delete global variables. index_in_use & index_global,
add member index_in_use in qemu_vm.VM class

Signed-off-by: Golita Yue <gyue@redhat.com>
virttest.qemu_vm: small bug fix in qemu_vm

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