libvirt.tests: Enhancements of stress migration tests.

* Support migration in thread for expanding.
* Fix bugs and some pylint problems.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
libvirt.tests: Add cross migration test for virsh_migrate_stress.

Cross migration:
local     =====      remote
           <-         vm1
vm2        ->
~~
           <-         vm2
vm3        ->

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
libvirt.tests: Add migration testcases when vms are booting.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
libvirt.tests: Expand stress type for migration stress test.

 * Seperate cpu and memory stress of stress tool.
 * Add timeout parameter for migration threads.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
libvirt.tests: Running stress tool on host for stress migration.

Do migration when stress tool is running on host:
1.Half of total memory is consumed.
2.Host is short of memory(Free memory is not enough for vms.)

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
libvirt.tests: Add network check after migration for stress migration test.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
virsh_domxml_to_native test improvements

Various changes to make the test function:
    Adjust the read process cmdline based on the knowledge that on
        Fedora 18 or later host, the qemu-kvm command line argument
        can be changed to be "qemu-system-x86_64 accel=kvm"
    Adjust the splitting of the command line from a list of each element
        that was separated by a space to a more ordered and natural
        looking list of items with "-option [arg]" on one line rather
        than adjacent "-option" "argument" elements
    Adjust the logic to perform better diffs using sets and determining
        what is in one list and not the other
    If differences are found, print them and in which order to make for
        easier debugging of problems

Signed-off-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
virttest.libvirt_storage: Add define_disk_pool function for StoragePool class.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
v2v.tests: Support disk type pool for local virt-v2v test.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
qemu.test: Restructure balloon_check

Now have two different class for Windows and Linux balloon test. Most of the
functions in these classes are same and inherit from class BallooningTest.
They have different error_report and get_memory_status. Also add some different
method to set ballooned memory in cfg files. Now the ballooned memory size also
can be set by a given value or a ratio base on the assign memory value.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
qemu.test.cfg: Add a balloon check case with fixed value.

This case follows the following steps:
ballooned memory to 1/2
do guest s3
ballooned memory to 3/4
do guest s4
ballooned memory to 7/8

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
compute total-significance by ratio paired t-test

Total-significance isn't good in current results, we should not use
standard paired t-test for it.

This patch use ratio paired t-test to compute total-significance,
just compute logarithm of samples and then execute standard paired
t-test.

Example: (we can see the p-value is reduced obviously, expected)
 control: [ 1  2  4  8 16]
 treated: [ 2  4  8 16 32]
 p-value: 0.0854412369731

 control: [ log(1)  log(2)  log(4)  log(8)  log(16)]
 treated: [ log(2)  log(4)  log(8)  log(16) log(32)]
 p-value: 8.88531529942e-65

Signed-off-by: Amos Kong <akong@redhat.com>
rh_perf_envsetup.sh: fix disable/stop services

The services to disable are difference with the services to stop,
it should be same.

smartd is stopped twice, so sort services alphabetically to avoid
duplicates.

Signed-off-by: Amos Kong <akong@redhat.com>
run: Further restrict the default qemu set

It makes up for a quicker default run, good for presentation
purposes.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
libvirt.testcases: Enhancements of stress migration.

* Use common parameters for remote info and vm info.
* Use specific parameters for stress tool.
* Fix pylint complaints for stress migration module.
* Fix pep8 errors.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
qemu.tests.boot_from_device: Change vm.create() to preprocess_vm()

In older code we did not update params for vm before creating it.
So old VM is reused. So we will meet following error:
15:42:02 ERROR| Exception escaping from test:
Traceback (most recent call last):
  File "/usr/code/autotest/client/shared/test.py", line 426, in _exec
    _call_test_function(self.execute, *p_args, **p_dargs)
  File "/usr/code/autotest/client/shared/test.py", line 853, in _call_test_function
    raise error.UnhandledTestFail(e)
UnhandledTestFail: Unhandled VMImageMissingError: CD image file not found: '/tmp/test.iso'
[context: (run_boot_from_device) --> creating 'virt-tests-vm1']
Traceback (most recent call last):
  File "/usr/code/autotest/client/shared/test.py", line 846, in _call_test_function
    return func(*args, **dargs)
  File "/usr/code/autotest/client/shared/test.py", line 299, in execute
    postprocess_profiled_run, args, dargs)
  File "/usr/code/autotest/client/shared/test.py", line 216, in _call_run_once
    *args, **dargs)
  File "/usr/code/autotest/client/shared/test.py", line 322, in run_once_profiling
    self.run_once(*args, **dargs)
  File "/usr/code/autotest/client/tests/virt/virt.py", line 139, in run_once
    run_func(self, params, env)
  File "/usr/code/autotest/client/shared/error.py", line 138, in new_fn
    return fn(*args, **kwargs)
  File "/usr/code/autotest/client/tests/virt/qemu/tests/boot_from_device.py", line 112, in run_boot_from_device
    vm.create()
  File "/usr/code/autotest/client/shared/error.py", line 138, in new_fn
    return fn(*args, **kwargs)
  File "/usr/code/autotest/client/tests/virt/virttest/qemu_vm.py", line 1769, in create
    raise virt_vm.VMImageMissingError(iso)
VMImageMissingError: CD image file not found: '/tmp/test.iso'

This patch could fix this.

Signed-off-by: Feng Yang <fyang@redhat.com>
qemu.cfg.boot_from_device: Update bootindex.

Not first index is 0, so update bootindex to 0, if we want to boot from it
firstly.

Signed-off-by: Feng Yang <fyang@redhat.com>
run: Setting --qemu_sandbox=on by default

This commit sets the Qemu sandboxing to 'on' by default. It allows the
user to run all tests using this feature to catch missing system calls
and providing more feedback to the general security of Qemu.

Signed-off-by: Eduardo Otubo <otubo@linux.vnet.ibm.com>
qemu.tests: small fix for qemu_iotests

since qemu_iotests merged into tests/qemu_iotests, add param
qemu_iotests_dir to set iotests root dir;
And updated default git repo to qemu-kvm new repo;

Signed-off-by: Xu Tian <xutian@redhat.com>
virsh.is_dead(): Resolve timing condition

Existing code didn't check for 'in shutdown' condition which led to
odd timing issues in various tests where is_dead() was returning true
during the "Trying to shutdown VM with shell command" path followed
by code attempting a startup which would fail because you cannot start
an already started guest.

Rather than add 'in shutdown' to the list of things to check - I flipped
the check to look for dead states and return true (per the comments).  I
also note that 'no state' was returning False previously which could
have caused false positives.

Since the list of checked states could grow over time, I added a check
for all currently known states and just print a message if a state
is not known.

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