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>
virttest.staging.service: Introduce a class named ServiceManagerFactory.

Introduce a class named ServiceManagerFactory to create kinds of service manager.
* Class ServiceManagerFactory provides two staticmethod to create generate service manager
and to create specific service manager.
* Internal class named FactoryHelper to provide some help method for ServiceManagerFactory.

Relationship of the classes in service module.

                                        service
                                           |
                          -------------------------------------
                          |                                   |
               _GenericServiceManager                _SpecificServiceManager
                          |
            -----------------------------
            |                           |
      _SystemdServiceManager   _SystemdServiceManager

* ServiceManagerFactory provides two interfaces to create service.
    * create_specific_service_manager() to create _SpecificServiceManager.
    * create_generic_service_manager() to create _GenericServiceManager.
      * FactoryHelper provides a method get_service_manager_type() to
      auto detect the system type and return constructor of
      _SystemdServiceManager or _SystemdServiceManager.
      So, user do not have to know about the system type when they use
      create_generic_service_manager() to create _GenericServiceManager.

Outline of ServiceManagerFactory class:
                                             ServiceManagerFactory
                                                     |
            ---------------------------------------------------------------------------------------
            |                                        |                                            |
create_specific_service_manager()          create_generic_service_manager()                   FactoryHelper
            |                                        |                                            |
            |                                        |                      ----------------------------------------------
            |                                        |                      |                     |                      |
            |                                        |             |----------------------| |---------------------| get_name_of_init()
            |                                        |             |*get_specific_service_| |*get_generic_service_|
            |                                        |------------>|command_generator()   | |command_generator()  |
            |                                                      |*get_specific_service_| |*get_generic_service_|
            |                                                      |result_parser()       | |result_parser()      |
            |                                                      |----------------------| |*get_generic_service_|
            |------------------------------------------------------------------------------>|manager_type()       |
                                                                                            -----------------------

Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>
virttest.staging.service: minor fix for ServiceManagerFactory class.

Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.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>
tests.cfg: Display default_install variant in test name

This type of installation is commonly used, remove the '@'
before it.

Also update the comment for it.

Signed-off-by: Tom Zhou <zhouqt@gmail.com>
virttest.aexpect: Use /bin/bash instead of /bin/sh

Some particular Linux distrio, such as debian, uses a
shell program called dash. Unfortunately, the dash
program can't work with "dash -c source foobar" command.

Hence let's use '/bin/bash' explicitly, instead of the
ambiguous '/bin/sh' symbol link.

Signed-off-by: Tom Zhou <zhouqt@gmail.com>
shared: Add guest Ubuntu 13.10

Signed-off-by: Tom Zhou <zhouqt@gmail.com>
virt-libvirt: Add emulatorpin command wrapper function

Signed-off-by: Alex Jia <ajia@redhat.com>
virt-libvirt: vm_xml: Add vcpu accessors

Signed-off-by: Alex Jia <ajia@redhat.com>
virt: Add 'cpulist' standard parser to utils_test

cpulist is a list of physical CPU numbers. Its syntax is a comma
separated list and a special markup using '-' and '^' (ex. '0-4',
'0-3,^2') can also be allowed. The '-' denotes the range and the
'^' denotes exclusive.  The expression is sequentially evaluated,
so "0-15,^8" is identical to "9-14,0-7,15" but not identical to
"^8,0-15".

Signed-off-by: Alex Jia <ajia@redhat.com>