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/qemu_monitor.py: Allow '=' in parameter string for HMP

Parse code of monitor command parameters did not handle '='
signs in parameter itself i.e.:
cert-subject="C=CZ/L=BRNO/O=SPICE/CN=server".
This is already implemeted for QMP.

Signed-off-by: Marian Krcmarik <mkrcmari@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>
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>
virsh_net_create: Remove incorrect redundant test

Remove the 'variant' for 'existing_network' within the variants for
bad_command_line.  Since each of the error_test variants already has
a 'no_existing_removal' and 'existing_removal' option, the removed
code would was redundant. Additionally, since the existing_network
option didn't have a net_create_options_ref, net_create_options_extra,
or net_create_corrupt_xml parameter, the test went through the high
level test code which was not expected for error_test code unless
the net_create_remove_existing is set to yes.
qemu.tests: update block mirroring/streaming cfg

Signed-off-by: Xu Tian <xutian@redhat.com>
virttest.libvirt_xml: Fix wrong comment of vm_xml.set_cpu_mode.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
virttest.libvirt_xml: Add get_first_mac_by_name method for VMXML class.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
virttest.utils_libguestfs: Add functions for libguestfs tools.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
libguestfs.testcases: Add test for guestfish disk operations.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
qemu.tests: enhance drive_mirror class

if no event check, it sleep 3 seconds to wait job in steady status
really;

Signed-off-by: Xu Tian <xutian@redhat.com>
v2v.tests: Adjust parameters for convert_local_image test.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
v2v.tests: Minor fix to convert_local_image module.

* Add debugging for test module.
* Make sure converted vm is down when cleanup.
* Change temp dir for pool from test.tmpdir to data_dir.TMPDIR.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
virttest.libvirt_xml.vm_xml: Add support of change current vcpu

Support change current vcpu in set_vm_vcpus method, add new
current_vcpu XMLAttribute in VMXMLBase.

This will benefit vcpu hotplug for setting current vcpu first.

Signed-off-by: Wayne Sun <gsun@redhat.com>