env_process: Check if VM exists when preprocessing

Before this patch when running test cases without a main VM exists,
say `virt-tests-vm1`, the test still goes on, it will raise a `TestFail`
if it tries to start the non-exist VM or if test was configured not to be
started at the preprocess progress, there will be strange outputs.

This patch check the existence of target VM, and raise a `TestError` if
`main_vm` don't exist or a `TestNAError` if a non-`main_vm` don't exist.

Signed-off-by: Hao Liu <hliu@redhat.com>
libvirt_vm: make normalize_connect_uri return exact uri rather than None when input is default.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
libvirt_vm: Fix for vm.connect_uri when it is default.

Default is not always qemu.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
libvirt_vm: introduce two method to VM named is_lxc() and is_qemu().

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
libvirt_vm: Make destroy() support lxc.

If the vm is lxc container, we destroy it with virsh command
rather than send a shutdown into it.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
libvirt_vm: Override wait_for_login() method in libvirt_vm.

Override the wait_for_login method of virt_vm to support other
guest in libvirt.

If connect_uri is lxc related, we call wait_for_serial_login()
directly, without attampting login it via network.

Other connect_uri, call virt_vm.wait_for_login().

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
libvirt_vm: send ^] to serial_console when vm is lxc to close console.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Merge pull request #1672 from yangdongsheng/lxc_1

[Part 1] Some patches for lxc supporting.
virttest.env_process: Fix bug of postprocess_image.

When VM image cannot be found, image.info() will return None.
Then postprocess_image will raise following exception:
    raise virt_vm.VMError("Failures occurred while postprocess:%s" % err)
        VMError: Failures occurred while postprocess:
        Postprocess: 'NoneType' object has no attribute 'splitlines'
and test will be failed(None of testcase's business).
So check it before splitlines().

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
virttest.data_dir: Fix bug setting an alternate data dir

With 948635a9, we broke the ability to set a data dir in
virt test through --data-dir. This fixes the problem.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virttest.data_dir: Fix PEP8 mistake

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Merge pull request #1681 from Hao-Liu/fix_preprocess

env_process: Check if VM exists when preprocessing
Merge pull request #1658 from yumingfei/process_bug

virttest.env_process: Fix bug of postprocess_image.
Merge pull request #1686 from vanbogithub/bfan-next

virttest.utils_libguestfs: Add some PV commands
add debug() function