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>
virt: Make env_setup works when os_type is windows

Changes from v1:
Delete client_path = "D:\\netperf.exe"
Changes from v2:
Make windows could be client or host.
Add host sub parameters.

Signed-off-by: Feng Yang <fyang@redhat.com>
virt: Get the last 4 value when get rx and tx from guests in netperf

The command output sometimes include the command line itself which will
cause the results get wrong. So just get the last 4 value which should
be the real data we wanted.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
netperf: Fix typo

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virtio_console: Fix location of the virtio console guest path

When running virt test outside the autotest context,
don't try to find the guest console helper script
in autotest.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
cfg: Fix mistake and change default *kvm* nettype to user

We want to make the test runner run the default test
set to root, so set nettype for the base test cfg
file to 'user', which will make qemu to use slirp
instead of bridge.

I made a mistake on a previous patch that went to master,
setting netttype = it in the base cfg file, so this patch
reverts that change too.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>