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>
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>
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>
qemu.cfg.ksm_base.disable: Update extra_params for rhel host.

rhel host do not support extra_params += " -machine mem-merge=off".
Change to extra_params += " -redhat-disable-KSM"

Signed-off-by: Feng Yang <fyang@redhat.com>
qemu.tests.cfg.cdrom_test: Disable pre_cmd and post_cmd for RHEL3, 4, 5, 6 guest

There is no /usr/lib/udev/rules.d in these guest.

Signed-off-by: Feng Yang <fyang@redhat.com>
qemu.tests.migration_with_dst_problem: Correct the way check whether disk list is empty

We should use if disk to check whether disk list is empty

Or this script will fail with following error:
Traceback (most recent call last):
  File "/home/autotest/client/shared/test.py", line 426, in _exec
    _call_test_function(self.execute, *p_args, **p_dargs)
  File "/home/autotest/client/shared/test.py", line 853, in _call_test_function
    raise error.UnhandledTestFail(e)
UnhandledTestFail: Unhandled IndexError: list index out of range    [context: (run_migration_with_dst_problem)]
Traceback (most recent call last):
  File "/home/autotest/client/shared/test.py", line 846, in _call_test_function
    return func(*args, **dargs)
  File "/home/autotest/client/shared/test.py", line 299, in execute
    postprocess_profiled_run, args, dargs)
  File "/home/autotest/client/shared/test.py", line 216, in _call_run_once
    *args, **dargs)
  File "/home/autotest/client/shared/test.py", line 322, in run_once_profiling
    self.run_once(*args, **dargs)
  File "/home/autotest/client/tests/virt/virt.py", line 136, in run_once
    run_func(self, params, env)
  File "/home/autotest/client/shared/error.py", line 138, in new_fn
    return fn(*args, **kwargs)
  File "/home/autotest/client/tests/virt/qemu/tests/migration_with_dst_problem.py", line 639, in run_migration_with_dst_problem
    tests_group()
  File "/home/autotest/client/tests/virt/qemu/tests/migration_with_dst_problem.py", line 53, in __new__
    ret = self.test(*args, **kargs)
  File "/home/autotest/client/tests/virt/qemu/tests/migration_with_dst_problem.py", line 436, in test
    self.workload()
  File "/home/autotest/client/tests/virt/qemu/tests/migration_with_dst_problem.py", line 467, in workload
    disk_path_src = find_disk_vm(self.vm_guest, self.disk_serial_src)
  File "/home/autotest/client/tests/virt/qemu/tests/migration_with_dst_problem.py", line 148, in find_disk_vm
    return os.path.join(disk_path, disk[0])
IndexError: list index out of range

Signed-off-by: Feng Yang <fyang@redhat.com>
qemu.cfg.host_kernel: Set workaround_qemu_qmp_crash to always in rhel host.

We need set workaround_qemu_qmp_crash to always to ignore the dump.

Signed-off-by: Feng Yang <fyang@redhat.com>
qemu.cfg.host_kernel: Disable rdma related migrate case in RHEL host.

rdma related migrate case are not supported in rhel host. So disable them.

Signed-off-by: Feng Yang <fyang@redhat.com>
qemu.tests.pci_hotplug: Add default value for queues parameter

This patch have us fix "TypeError: int() argument must be a string or a number,
not 'NoneType'" error when queues parameter not set in config.

Signed-off-by: Feng Yang <fyang@redhat.com>
virttest.staging.utils_cgroup: Remove '\t' from the string in get_property()

When call get_property() we may get following error n cgroup test:
Description of problem:
Traceback (most recent call last):
  File "/home/autotest/client/shared/test.py", line 426, in _exec
    _call_test_function(self.execute, *p_args, **p_dargs)
  File "/home/autotest/client/shared/test.py", line 846, in _call_test_function
    return func(*args, **dargs)
  File "/home/autotest/client/shared/test.py", line 299, in execute
    postprocess_profiled_run, args, dargs)
  File "/home/autotest/client/shared/test.py", line 216, in _call_run_once
    *args, **dargs)
  File "/home/autotest/client/shared/test.py", line 322, in run_once_profiling
    self.run_once(*args, **dargs)
  File "/home/autotest/client/tests/virt/virt.py", line 136, in run_once
    run_func(self, params, env)
  File "/home/autotest/client/shared/error.py", line 138, in new_fn
    return fn(*args, **kwargs)
  File "/home/autotest/client/tests/virt/qemu/tests/cgroup.py", line 2032, in run_cgroup
    return fce()
  File "/home/autotest/client/shared/error.py", line 138, in new_fn
    return fn(*args, **kwargs)
  File "/home/autotest/client/tests/virt/qemu/tests/cgroup.py", line 366, in blkio_throttle
    return blkio_throttle_multi([[_] for _ in speeds])
  File "/home/autotest/client/shared/error.py", line 138, in new_fn
    return fn(*args, **kwargs)
  File "/home/autotest/client/tests/virt/qemu/tests/cgroup.py", line 537, in blkio_throttle_multi
    % (dev[0], dev[1], speed))
  File "/home/autotest/client/tests/virt/virttest/staging/utils_cgroup.py", line 411, in set_property
    % (repr(check), repr(_values)))
TestError: cg.set_property(): Setting failed: desired = '8:16 1024', real values = ['8:16\t1024']
    [context: Executing test: blkio_throttle --> Init --> Setup test]

Signed-off-by: Feng Yang <fyang@redhat.com>
virttest.cartesian_config: Make 'replace deprecated template with eval in cart-config' works for multi deprecated template

        - rebase:
            type = qemu_disk_img_rebase
            rebase_mode = safe
            base_format = qcow2
            guest_file_name_image1 = "${tmp_dir}/base"
            image_chain += " snA snB"
            image_name_snA = "images/snA"
            image_name_snB = "images/snB"
            guest_file_name_snA = "${tmp_dir}/snA"
            guest_file_name_snB = "${tmp_dir}/snB"
            variants:
                - snB:
                    check_files = "${tmp_dir}/base ${tmp_dir}/snA ${tmp_dir}/snB"
                    variants:
                        - to_base:
                            rebase_list = "snB > image1"

from the log we know that only signal ${tmp_dir} is replace to /var/tmp
But check_files did not change.

Signed-off-by: Feng Yang <fyang@redhat.com>
virttest.qemu_monitor: ignore empty args in qmp's send_args_cmd()

We will meet following error:

QMPCmdError: QMP command 'system_powerdown' failed    (arguments: {'': ''},
   error message: {u'data': {u'name': u''}, u'class': u'InvalidParameter',
 u'desc': u"Invalid parameter ''"})

Signed-off-by: Feng Yang <fyang@redhat.com>
run: Add --run-dropin option

Add a run option that executes scripts on a directory
called dropin sequentially in the host, rather than
the guest. The option to run the mentioned tests in
the host will be added on a future series.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Add dropin test wrapper

virt test wrapper that actually runs the dropin script.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Add dropin directory

Directory that holds the dropin tests.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virsh_dumpxml: Need to populate output

Commit id '7bdea150' removed the setting of output in the try/except
to call virsh.dumpxml, resulting in the error:

UnboundLocalError: local variable 'output' referenced before assignment.

This change just sets output from the cmd_result