virttest.libguestfs: Unified virt-command functions.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
virttest.utils_libguestfs: Add virt command function.

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

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

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
virttest.utils_test: make ping support ipv6

This patch make ping support ipv6

Signed-off-by: Yunping Zheng <yunzheng@redhat.com>
wait_for_get_address: Handle dead vm

Pull request #1424 added logic to wait_for_get_address() in order to
try and renew the guest IP by using the serial console. However, it did
not take into account that the guest may not be running in this instance
and that failing and/or raising an exception may be an expected output.

As it turns out the virsh.attach_device test has such a need as part of
its processing - it expects/tests certain exceptions.

Without this change, the wait_for_get_address() eventually calls the
serial_login() function which fails (exception) when trying to determine
if the path to 'self.serial_console.inpipe_filename' exists. Trying
to change that code to call create_serial_console() will fail because
the VM is dead.  So rather than go through that processing, just fail.

This issue was exacerbated by verify_ip_address_ownership() not returning
True from the mac in macs checking on the return from parse_arp(). Since
the IP address wasn't matched a failure would result, which led to going
into the new code. Exactly what caused that I'm not quite sure as it
was only reproducible for a short period of time and now it does find
the address. When the code does return True, the remote.remote_login()
call in the login() code will eventually fail since the guest is not
up with a LoginError exception, which is caught/handled by attach_device.

Hopefully @humanux can review and comment on this.  I am open to other
suggestions, but this just seemed to be the easiest way.
virttest: Change working dir before showing git log

When run download_test_provider if the test_provider is already
downloaded, current working dir won't change before running "git log -1".

This will output false log info or won't work at all if cwd is not a git
repo.

Signed-off-by: Hao Liu <hliu@redhat.com>
virttest.virsh: Add blockresize() API

Add new API to support the libvirt test
virsh_blockresize

Signed-off-by: Guannan Ren <gren@redhat.com>
Fix parameters for LibvirtXMLError calls

Initially seen in vm_xml/sync() - the raising of the exception passed
3 paramters instead of the __init__ required 2:

   File "/home/virt-test/virttest/libvirt_xml/vm_xml.py", line 376, in sync
     raise xcepts.LibvirtXMLError("Failed to undefine %s.", self.vm_name)
 TypeError: __init__() takes at most 2 arguments (3 given)

Since I was fixing this one - I looked for others. Found the pool_xml/
pool_rename() condition as well, so I modified it too.
lvsb_base: Add sandbox options mapper

The patch fixes several small issues firstly, for example, to avoid
the make_sandbox_command_line() is called twice, and should append
option for flag rather than argument. And then the patch implement
a sandbox options mapper, which will help complex options testing.

Signed-off-by: Alex Jia <ajia@redhat.com>
lvsb: support complex options sandboxes

Refactor codes to support complex sandbox testing.

Signed-off-by: Alex Jia <ajia@redhat.com>
virttest: build a object with counts generator

Implement a generator based on object and counts.

Signed-off-by: Alex Jia <ajia@redhat.com>
virttest.standalone_test: Use name instead shortname in print_guest_list

When we list the guest names with run we need the whole guest name but not
the shortname. Otherwise we will filter more cases than expect when we use
the output from --list-guests to run a test.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
virttest.virsh: Add wrapper for migrate-compcache

Add standard wrapper function in virsh.py for calling virsh command
migrate-cimpcache.

Signed-off-by: Hao Liu <hliu@redhat.com>
libvirt_xml: remove the import of utils_test in devices.

There is a cycle import chain as below:

utils_test->VMXML->librarian->utils_test.

Then we will get a error when we use libvirt_xml:
    from virttest.libvirt_xml import vm_xml
  File "/home/yds/github-autotest/github-autotest/client/tests/virt/virttest/libvirt_xml/__init__.py", line 45, in <module>
    from virttest.libvirt_xml.vm_xml import VMXML
  File "/home/yds/github-autotest/github-autotest/client/tests/virt/virttest/libvirt_xml/vm_xml.py", line 10, in <module>
    from virttest.libvirt_xml.devices import librarian
  File "/home/yds/github-autotest/github-autotest/client/tests/virt/virttest/libvirt_xml/devices/librarian.py", line 6, in <module>
    import virttest.utils_test
  File "/home/yds/github-autotest/github-autotest/client/tests/virt/virttest/utils_test/__init__.py", line 38, in <module>
    import libvirt
  File "/home/yds/github-autotest/github-autotest/client/tests/virt/virttest/utils_test/libvirt.py", line 25, in <module>
    from virttest.libvirt_xml import vm_xml
ImportError: cannot import name vm_xml

This patch remove this unnecessary import line in librarian.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
libvirt_xml: fix issues from run_pep8 tool.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
libvirt_xml: Add support of net and storage for nodedev_xml.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
libvirt_xml: add implemention for hostdev in libvirt_xml/devices/.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
libvirt_xml: add a function to add hostdev device in vm_xml.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
virttest: Mass indentation fix

This time, brought to you by the program inspektor.

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