virttest: Restore the working dir in download_test_provider

After check the repo informations we should restore the working
dir to original one. Otherwise it will cause problems after we
call it in our scripts.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
virt: Add clone_volume func to PoolVolume class

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
virt: Add create func to VolXML class

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
virt: Add functions to get/set cpu status

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
libvirt: Declare LIBVIRT_DEFAULT_URI in preprocess().

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
env_process: Recreate vm in env if vm.connect_uri is not params.get('connect_uri').

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
libvirt_vm: Override __setattr__ of libvirt_vm.VM.

For VMs in different uri, we need some different params for them.
This patch introduce a way we can set these params in base.cfg only
for VM in a special uri. What we need to do is adding the special
param with a prefix of 'libvirt_URI_' into base.cfg. That's all.
libvirt_vm.VM will check the connect_uri and use the param you want.

Example:
	isa_serial = "serial0" is not usable for lxc VM. lxc does
not support serial device yet. In this case, we need not to change
the default value of isa_serial. We can add a new param in base.cfg.
	libvirt_lxc_isa_serial = "console0"
Then if your VM is a lxc guest, it will use "console0".

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
run: Introduce an option --connect-uri to assign uri for test.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
virttest.utils_test: Init subtest_dir in run_virt_sub_test

Init subtest_dir to None otherwise, it will report the variable
referenced before assignment.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
Merge pull request #1717 from ypu/run_virt_sub_test

virttest.utils_test: Init subtest_dir in run_virt_sub_test
virt: Fix a bug in preprocess_vm func

If VM is running before test, and param.get('start_vm') == 'yes',
the variable 'start_vm' will be False, at this situation
params.get("kill_vm_before_test") will work, if it's 'yes',
the VM will be shutdown, and make the test fail.

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
libvirt: adapt the default_tests.cfg to new framework of test-provider.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
virt: Add a func to make filesystem on partition

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
Merge pull request #1727 from liyangfnst/env

virt: Fix a bug in preprocess_vm func
Merge pull request #1730 from yangdongsheng/default_tests

libvirt: adapt the default_tests.cfg to new framework of test-provider.
virt: Fix a bug in Iscsidev init func

Set 'self.emulated_image' to be a true file, if not
cleanup cannot find the emulated_image file.

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
Merge pull request #1734 from liyangfnst/iscsi_fix

virt: Fix a bug in Iscsidev init func
Fix a bug in Iscsi.export_target func

If emulated_image already exists, but size is different with
you want, we must rebuild this file, if not, test will fail.

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
Merge pull request #1692 from yangdongsheng/lxc_2

[Part 2] Declare  LIBVIRT_DEFAULT_URI in preprocess()
Merge pull request #1735 from liyangfnst/emulate

Fix a bug in Iscsi.export_target func