kvm: Add subtest block_mirror

Test block mirroring

This test verify block mirroring functionality in qemu. Tested are following scenarios:

1) Original mage is synchronized into a mirrored one and when synchronization
   is done, switch to mirrored image is verified and content of both images
   is compared.

2) Continue in mirroring after disk synchronization. Verify the changes done
   are properly mirrored.

This test has following requirement for qemu:
  - block mirroring has to be supported
  - compare command for qemu-img has to be implemented

This requirements are not included in qemu upstream yet. You can get version
with required features in repository

git://github.com/LaneWolf/qemu.git

branch blockjobs-1.2

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
kvm.tests.enospc:Fix the test cleanup fail

Currently, When run the test and do some clenup steps it always fail
with lvremove command, because the lv is in used.
Actually, the tests do fuser -k to kill users. but the it is a link
not a file as it check if it is a file.

So change the os.path.isfile to os.path.islink.

Signed-off-by: Mike Qiu <qiudayu@linux.vnet.ibm.com>
shared.subtests.cfg.sample:add vars to make qmp_basic work

Currently, qmp_basic tests needs to change the monitors/
monitor_type/vcpu_thread_pattern in base.cfg because it has been
set for hmp as default.
To improve this, add the three vars in the subtests.cfg.sample

Signed-off-by: Mike Qiu <qiudayu@cn.ibm.com>
kvm.tests.qmp_basic:change the error class to suitable for new version of qemu

Currently, qemu has changes it's error class, this makes this test fail
To solve this problems, update the error class in the autotest.

Signed-off-by: Mike Qiu <qiudayu@linux.vnet.ibm.com>
use -cpu ? to get support_cpu_model instead of -cpu ?list as it is invaild on latest qemu-kvm

on the latest qemu-kvm, -cpu ?list is invalid now

$ ./qemu-system-x86_64  -cpu ?list
Unable to find x86 CPU definition

$ ./qemu-system-x86_64  -cpu ?
==================
x86       Opteron_G4  AMD Opteron 62xx class CPU
x86       Opteron_G3  AMD Opteron 23xx (Gen 3 Class Opteron)

Signed-off-by: Xiaoqing Wei <xwei@redhat.com>
virt: Adds support for cancel migration in multi-host tests.

1) Start migration with stressed VM.
2) Wait cancel_delay and then cancel migration.
3) Check if machine is alive on source host.
4) Stop stress of VM.
5) Migrate machine again.
6) Check if machine is alive on destination host.

Signed-off-by: Jiří Župka <jzupka@redhat.com>
virt: Multihost-migrate stops unnecessary vm disk clone.

If force_image_clone == no then only check vm image consistency.
If vm image consistency is good use old image else copy again from original.
Remove image if consistency is not correct after finish of test.

Signed-off-by: Jiří Župka <jzupka@redhat.com>
virt: Move migration_multi_host_fd to framework

It allows use migration over fd in all multihost_migration tests.

Signed-off-by: Jiří Župka <jzupka@redhat.com>
virt: Allows multihost test using of fd migration and adds new tests

New tests:
  1) change downtime of migration after start of migration
  2) change migration speed after start of migration.
  3) cancel migration after start.

Signed-off-by: Jiří Župka <jzupka@redhat.com>
libvirt.virsh_save: Fix wrong arguments passed to virsh.restore

virsh.restore only takes the savefile path as an argument,
let's fix it.

Also, let's fix a redundant import and some inconsistent
comments.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
libvirt_vm: Fix wrong domstate calls

The code was missing the proper domstate namespace and
was passing a non existing **dargs dict.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virt test: netperf: Fix bug in this script

CC: Amos Kong <akong@redhat.com>

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
virt test: Update the record write function in netperf

Update the record function in netperf to let it can records
different kind of results according the result dict.

changes from v1:
  - params and log fix

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
virt test: Check the index of the parameter get from mpstat

In different version mpstat the parameters show in results are
different. Use the name of the parameter to get the index of
CPU use status related parameter from the command output head.
This will avoid the wrong cpu values calculated in hosts with
different mpstat.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
virt test: Use shell session instead of set host env for login without password

As some ssh version in different OS may not support the ssh for
command execute.

changes from v1:
  - Add session for netperf_thread

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
virt test: Add command of netperf without numactl

Add the command line for system that don't support numactl.

changes from v1:
  - modify to fix the change from pre patches

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
virt test: Add netperf in windows

Run netserver in windows guest and the TCP scenarios in localhost.

changes from v1:
  - Add some log
  - typo error fix
  - configure parameters fix
changes from v2:
  - modify the parameters to the default test env
changes from v3:
  - format and commit clean up

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
virt test: Fix bug when getting number of CPUs on some guests

In some guest the ssh_cmd will return the commmand line in output
too which may cause the problem for find cpu number. So only take
the numbers in the output.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
virt test: Support use netserver.exe for windows guest in netperf_win.py

We have netserver.exe now, so make netserver.exe works in netperf_win.
Also correct remote.wait_for_login.

changes from v1:
  - commits and log message clean up

Signed-off-by: Feng Yang <fyang@redhat.com>
virt: Add more configure variants for netperf_win test case

variants:
    - netperf_exe:
        variants:
           - default_setting:
           - best_registry_setting:
    - netperf_cygwin:

Changes from v1:

Use telnet for win2008, win2008r2 and win2003 for
best_registry_setting case. netsh int tcp set global
autotuninglevel=disabled command always fails
with nc in these guests.

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