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>
virttest: Move nic_script under tap device branch in add_net

nic_script should be parameter for tap devices, so move it to
the right place. And now we can not control guest to use nic_script
or fds with cfg files as tapfds are automatic get by framework functions
only depends on the host env. So update the judgement as if we setup
nic_scritp, will let guest use script, otherwise will try to use fds.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
virttest.utils_libguestfs: Add functions for file operations.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
utils_test.libguestfs: Add functions for file operations.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
libguestfs.tests: Add test module for libguestfs file operations.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
virttest.utils_misc: Allow null source passed to umount.

Sometimes, we don't know what's source is, but mountpoint
can still be umounted, so allowing to pass null for umount.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.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>