autotest/virt-test — pull request #609 by yangdongsheng (2013-07-08 09:03:56+00:00)
Title: libvirt: Virsh: session manager fixing.

In current code, VirshPersistent.__del__() will not be called in
del virshPersistent_instance
Because there are some other object still have a reference to the 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.

This patch fix this problem.
(1). 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.
(2). Fix an error of __exit__. There is no method named __exit__ in Virsh class,
So super().__exit__ in VirshPersistent will down.
(3). Introduce a class variable named COUNTERS in VirshSession. COUNTERS is a
dict whose key is a_id and value is counter. Two method counter_increase and
counter_decrease introduced in VirshSession at the same time. With COUNTERS,
we can fix the problem when two VirshSession keep the same a_id, if one of them
is 'del'ed, the session will be closed and the other one can not work normally any more.

Signed-off-by: yangdongsheng