virsh-domif-setlink-getlink: add backup and restore of vm xml config

We need to backup and restore the guest xml config because we are
modifying the guest. If we don't do this, every other test will fail
because we break the network and the guest is not reachable by
ssh client.

Signed-off-by: Pavel Hrdina <phrdina@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>
libvirt: Supoort libvirt pool xml accessor

Signed-off-by: Yanbing Du <ydu@redhat.com>
libvirt: Add test for virsh pool-create command

Signed-off-by: Yanbing Du <ydu@redhat.com>
qemu.tests: update block mirroring/streaming cfg

Signed-off-by: Xu Tian <xutian@redhat.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>
virttest.virsh: Add nodedev-{create, destroy} commands wrapper function

Signed-off-by: Alex Jia <ajia@redhat.com>
virttest.libvirt_xml.nodedev_xml: Add new elements and attribute

Signed-off-by: Alex Jia <ajia@redhat.com>
libvirt.tests: Add test cases for virsh nodedev-{create, destroy}

Signed-off-by: Alex Jia <ajia@redhat.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>
libvirt.tests: Add virsh vcpucount test

The test works for domain state as "shut off" or "running", it check
vcpucount result after vcpu hotplug using setvcpus.

For setvcpus, include four valid options:
  --config
  --config --maximum
  --live
  --guest

For vcpucount options, restrict up to 2 options together, upstream libvirt
support more options combinations now (e.g. 3 options together or single
--maximum option), for backward support, only following options are
checked:
  None
  --config --active
  --config --maximum
  --live --active
  --live --maximum
  --current --active
  --current --maximum
  --guest

Signed-off-by: Wayne Sun <gsun@redhat.com>
libvirt_xml.devices: Remove re-assigned xml.

Slot 'xml' have been assigned in UntypedDeviceBase class.
So there is no need to set its value again in subclasses.
Otherwise, it will erase type_name in TypedDevice.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
libvirt_xml.devices: Fix pep8 problems for disk module.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
libvirt_xml.devices: Add method for address element in disk.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
libvirt_xml.devices: Replace directly init with super for DiskSource.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
Adding tests to build spice-gtk, spice-vdagent and qxl

Signed-off-by: Swapna Krishnan <skrishna@redhat.com>
v2v.tests: Suit convert_remote_vm testcases for StoragePool class.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
v2v.testcases: Catch exceptions to let vm down for cleanup.

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