virttest: Call utils_net.update_mac_ip_address() in vm.create() when mac_changeable set to yes

Sometime we directly call vm.create() to create a VM. mac_changeable could not work
in this situation. As it only used in qemu test so move utils_net.update_mac_ip_address()
to vm.create() function.

If other test need support mac_changeable later, we can call  update_mac_ip_address
in its start() function.

Signed-off-by: Feng Yang <fyang@redhat.com>
qemu: Fix vhost params behavior.

when param[vhost]= [on, force] it create vhost-fds and pass it to
qemu vm correct way.

Signed-off-by: Jiří Župka <jzupka@redhat.com>
shared.unattended: Disable the color display from console

The default bashrc for root in Ubuntu will enable color display
in the console. This caused unreadable characters for some
cmd output, like 'ls'. It will fail our cases as script can not
get the output we want. So disable it in preseed files for install.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
cpuid_test_kernel: Dump additional 0xD subleaves

Those subleaves need to stay stable on QEMU upgrades, too, so it is
useful to dump them.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
qemu_cpu.cfg: Whitelist known broken alias bits on RHEL-6 qemu-kvm

Newer QEMU will make sure the alias bits are consistent, but there are
known bugs on RHEL-6 on some of the alias bits on some of the CPU
models, so whitelist those known issues.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
cpuid: Use new API to detect cases where QEMU aborts

virt-test won't raise VMCreateError anymore, but VMStartError, when QEMU
aborts. Change the code to catch the new exception.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Cc: Ruda Moura <rmoura@redhat.com>
qemu_cpu.cfg: Trivial comments about some config options

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
qemu_cpu.cfg: We don't need any image processing

The qemu_cpu test case doesn't use any disk image, so we don't need any
image processing when running the tests cases.

This should make the tests run much faster.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
qemu_cpu.cfg: Force nettype=none

We don't need networking when running the CPUID dump kernel, so we can
simply skip networking setup.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
virttest.staging.service: Introduce a class named Factory.

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

Relationship of the classes in service module.

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

* Factory provides two interfaces to create service.
    * create_specific_service to create _SpecificServiceManager.
    * create_generic_service 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 to create _GenericServiceManager.

Outline of Factory class:
                                                  Factory
                                                     |
            ---------------------------------------------------------------------------------------
            |                                        |                                            |
create_specific_service          	create_generic_service                 		  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>
staging: Add staticmethod create_service in Factory.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
virt: Adapt nfs to Factory of service.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
staging: adapt utils_cgroup to Factory in service.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
virt: adapt lvsbs to Factory in service.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
lvsbs: Add more comment for self.service in __init__().

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
staging.service: Add more comment for class Factory.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
libvirt: Adapt the remote config in base.cfg to existing tests.

Since there are several tests in libvirt are using ENTER.YOUR as
the default configuration of remote, we should add this substring
into base.cfg.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
shared.cfg: Add config to timedrift_monotonicity for windows guest

"date +%s%N" cannot show the current time for windows guest.

Signed-off-by: Shuping Cui <scui@redhat.com>
qemu.test.watchdog: Remove RHEL.5 from the ib700 cfg

Remove RHEL.5 from the cfg, sinece RHEL.5 not support ib700wdt.

Signed-off-by: Yunping Zheng <yunzheng@redhat.com>
virttest.qemu_vm: Catch all exceptions when sending quit to monitor in destroy

When host or guest under heavy load or in a shutdown status from pre case.
VM process may quit during destory() in any steps and will raise very strange
error message like if it is try to kill vm by monitor:
 error: (9, 'Bad file descriptor')

So catch all kinds of exceptions and judge if the process is alive or not.
Log warning message in the log file instead of through errors.

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