libvirt: Add unittests for virsh session manager

* test_del_VirshPersistent to make sure __del__ method works well.
* test_VirshSession to make sure VirshSession works well without virshPersistent.
* test_VirshPersistent to make sure COUNTERS in VirshPersistent works well.

Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>
libvirt-virsh: cut off the reference from VirshClosure objects to virshpersistent.

In current code, VirshPersistent.__del__() will never be called in
`del virshPersistent_instance`
Because there are some other references to this object.
They are VirshClosure object. The VirshClosure.dict_like_instance is a
reference to VirshPersistent object. So, we can't use the del feature
of VirshPersistent at all.
So every test using VirshPersistent object will remain a virsh process
after exiting.

This patch fix this problem.
 * Change the dict_like_instance in VirshClosure from the reference of
Virsh object to another object named closure_args stored in VirshPersistent.
And we update the closure_args in setting slots of VirshPersistent to keep
the closure_args and VirshPersistent in-sync.

Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>
libvirt-virsh: remove calling for undefined method in virshPersistent.__del__

Fix an error of exit. There is no method named exit in Virsh class,
So super().__exit__ in VirshPersistent will down.

Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>
libvirt-virsh: Add autoclose param in VirshSession.__init__()

Add a param named auto_close into __init__ method of VirshSession. The default
value of this param is False, and it will not close the ShellSession when we derefer it.
So, I add this param to allow user pass a auto_close=True to use it more convinient.

Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>
libvirt-virsh: update the using of VirshSession in VirshPersistent.

Introduce a class variable named COUNTERS in VirshPersistent. COUNTERS is a
dict whose key is a_id and value is counter. Two method counter_increase and
counter_decrease introduced in VirshPersistent at the same time. B/c VirshSession is
not auto closed, then we need to manage the VirshSession in VirshPersistent.

Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>
Merge pull request #609 from yangdongsheng/virshpersistent

libvirt: Virsh: session manager fixing.
virttest.qemu_vm: Check migration_exec_cmd_src before accessing it

Signed-off-by: Qingtang Zhou <zhouqt@gmail.com>
qemu.tests: small bug fix in nmi_bsod_catch

Give a default value "" to reboot_after_config. Otherwise it will raise
an TypeError(argument of type 'NoneType' is not iterable) when it is None.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
shared.unattended: enable serial console in SUSE guest

update autoyast.xml to enable serial console in SUSE guest;

Signed-off-by: Xu Tian <xutian@redhat.com>
virttest.qemu_vm : add function to get vhost threads

This patch add a function to get vhost threads

Signed-off-by: Yunping Zheng <yunzheng@redhat.com>

Conflicts:
	virttest/qemu_vm.py
Merge pull request #633 from humanux/vhost_threads

virttest.qemu_vm : add function to get vhost threads
shared.deps: Adding build_install.py script to download git repo, build and install

In order to build git repos in the guest, ship this simple script.
It'll be used to build SPICE components, though it could be used
for other purposes.

Signed-off-by: Swapna Krishnan <skrishna@redhat.com>
Add NetworkManager and enable servie for RHEL.5 guest

Signed-off-by: Xiaoqing Wei <xwei@redhat.com>
Merge pull request #759 from xiaoqing-wei/rhel5.NetworkManager

Add NetworkManager and enable servie for RHEL.5 guest
Merge pull request #758 from zhouqt/migrate

virttest.qemu_vm: Check migration_exec_cmd_src before accessing it
qemu.tests: fix login test fail when need_install is yes

VM paused after install finished because of option '-no-shutdown', and
env.get_vm() got a paused VM, so case will fail at wait_for_login() when
need_install is 'yes';

Signed-off-by: Xu Tian <xutian@redhat.com>
virttest: Add some numa test related functions

Add a class NumaInfo in utils_misc and some related functions to
get the host numa structure and information.

Also add a function in utils_test to get qemu process's memory
and cpu use status in each node.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
virttest.qemu_vm: Add -numa to qemu command line

Add the command line to simulate a multi node NUMA system in guest.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
qemu.tests: Add a numa basic test

Get host numa topology. Start and bind guest to the cpu in each node
one by one. Then check the memory status for qemu process.
The qemu process should mainly used the memory from the node that it
is binded to.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
qemu.test: Add a numa consistency test

Boot up a guest have the same number of node as host. Each node in guest
only have 1 cpu. Try to malloc inside the guest with taksset. The memory
allocated in host should also in the same node as the cpu thread.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>