virt: Un-privatize remote._remote_login()

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Fix VirshPersistent.command bug

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Implement VirshConnectBack class

Several virsh tests share a need in executing a virsh command on
a remote host, against the virt test client machine.

The VirshSession class was enhanced to accept remote-access
parameters.  When present, an ssh command is executed prior
to entering the virsh shell (on the remote system).  When
these parameters aren't provided, this class operates as before.

A new VirshConnectBack class was added as a subclass of
VirshPersistent.  It's only override is to validate the
remote-access parameters are provided, then create the
VirshSession using them.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Update vcpuinfo to use VirshConnectBack

Signed-off-by: Chris Evich <cevich@redhat.com>
base_cfg: Fix variable naming typo

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virttest.utils_params: Improve message of missing key

This error message covers most cases of the missing config key thus
it allow us to use params[] for required configs instead of checking
and raising custom exceptions.

Changes from v1:
 * Raise a custom error, ParamNotFound, that inherits
   from error.TestNAError, that will make the tests
   that lack a mandatory param to be skipped.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
Add unittests for utils_params

They'll come up handy, and will help to verify whether
the Params class is behaving like we intended.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
qemu.tests: Use params[] for required params

This patch benefits from the better error message when key is missing
in config params. Instead of custom handling of missing param it
uses params[] directly.

I modified those params, where I was 100% certain that they are
required and doesn't have default value:
 * val = params.get(..) followed by if not val: raise...
 * int(params.get(...))
 * params.get(...).split()
 * commands which require string (eg. session.cmd(params.get(...)))

I didn't test all the tests before and after in order to verify
possible typos but I used pylint before and after, watching for
new errors (code rate before and after).

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest: Add a module for cleaning up enviroment

With this module, tests can define multiple clean up functions which will
be called after tests termination inside the tests scripts. These will help
tests which need complex host enviroment setup and clean up.

The clean up function can be defined in tests and will be register to a
global list named with exithandlers of the test. You can register the
clean up functions right after the set up operation finished. And they
will be executed no matter the test is failed or not after the test finished.
And the execution order will be the backward of the register order.

Changes from v1:
 * Fixed typo, removed unused module and trailing whitespaces.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
qemu.tests: Use funcatexit to handle the clean up in transparent hugepage test

Use funcatexit to handle the debugfs clean up in transparent hugepage test

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
virttest.utils_misc:fix 'unknown' CPU for IBM Power architecture

Currently, virt-tests support amd and intel's X86 cpu type,
IBM Power cpus will be detected as 'unknown'.

To solve the problem, use platform.machine, so when the
arch is ppc64, we can return appropriate power CPU models.

Signed-off-by: Mike Qiu <qiudayu@linux.vnet.ibm.com>
virttest.utils_misc:fix qemu-system-ppc64 cpu model list

Currently, the regular expression in extract_qemu_cpu_models just
works with X86 qemu models.

Add check if X86 pattern return none, will use PowerPC pattern to
get qemu support cpu model.

If it is not possible to recognize the patterns in
the output of 'qemu -cpu ?', throw an error explaining
that the proper support must be added.

Signed-off-by: Mike Qiu <qiudayu@linux.vnet.ibm.com>
guest-os:add the fedora17 and 18 for ppc64 guest os support

Currently, the autotest haven't support the guest os fedora17
and 18 for ppc64.

Add two config file to support this to os.

Signed-off-by: Mike Qiu <qiudayu@linux.vnet.ibm.com>
virt:Fix check_modules error for other arch

Currently, check_modules in qemu/get_started.py and
virttest/standalone_test.py just suitable for x86_64, for other
arch, especially ppc64, will not have module like kvm-%s, and this
causes errors.

To fix this problem, use platform to decide the modules need to
be checked.

Signed-off-by: Mike Qiu <qiudayu@linux.vnet.ibm.com>
Introduce arch module

In order to concentrate (as much as possible) processor
architecture dependent code, create an arch module on
virt tests. As the first function in there, refactor
the code that gets the list of kvm modules on different
architectures.

The idea is to move other arch dependent code to that
module, so we have a cleaner and less repetitive way
of solving multi-arch support.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
arch: Add arch dependent networking constants

As mentioned, it'll be better and easier to have as much
as possible of the arch dependent code in this module.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virt-libvirt: Add configuration for virsh dumpxml test.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
virt-libvirt: Add test module for virsh dumpxml.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
Add test for virsh dump

Signed-off-by: Yanbing Du <ydu@redhat.com>
Add change-media function in virsh module

Signed-off-by: whuang <whuang@redhat.com>