libvirt-virsh: Use weakref from VirshClosure to VirshPersistent.

To avoid circle reference, we use a class variable named closure_args
to replace VirshPersistent object for VirshClosure.dict-like-instance.
But we need to override the all item setting method in Virsh, such as
__setitem__, dict_set, super_set. It is not a good design.

Then, we use weakref to make reference from VirshClosure to VirshPersistent
weak, so that the __del__ method in VirshPersistent will work properly.

Signed-off-by: Chris Evich <cevich@redhat.com>
Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>
libvirt-virsh: update virsh_unittest for weakref using in virsh.

Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>
qemu.tests.boot_time: Typo fix and drop unused import module

Signed-off-by: Feng Yang <fyang@redhat.com>
virt: Fix project name detection in check_patch

Previously this tool was dependant on a specific directory layout
and the layout was fixed.  Now that project tree has been split
across multiple repositories, there is no guaranteed match.  This
patch tries to locate the nearest LICENSE file while traversing
up the directory tree.  It takes the lower-case version of the
first word in this file as the project name.  As of this commit
all LICENSE files have appropriate content for this scheme to
function properly.  It assumes any future project tree splits
will cause LICENSE files to be updated to match new/changed names.

Signed-off-by: Chris Evich <cevich@redhat.com>
libvirt.tests: Add test module of migration with stress.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
libvirt.tests.virsh_migrate_stress: Fix variable name in log calling.
libvirt-virsh: fix __call__ in VirshClosure to avoid update dargs in VirshPersistent.

Previously, in VirshClosure.__call__(), weakref to VirshPersistent will update the VP.
It will change or modify the slots in VirshPersistent instance, then make the dargs
to next __call__().

Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>
virttest/funcatexit: Change func.__globals__ to func.func_globals, as python 2.4 do not support it.

We found following error in python 2.4.
Traceback (most recent call last):
  File "/usr/code/autotest-devel/client/shared/test.py", line 426, in _exec
    _call_test_function(self.execute, *p_args, **p_dargs)
  File "/usr/code/autotest-devel/client/shared/test.py", line 853, in _call_test_function
    raise error.UnhandledTestFail(e)
UnhandledTestFail: Unhandled AttributeError: 'function' object has no attribute '__globals__'    [context: (run_unattended_install)]
Traceback (most recent call last):
  File "/usr/code/autotest-devel/client/shared/test.py", line 846, in _call_test_function
    return func(*args, **dargs)
  File "/usr/code/autotest-devel/client/shared/test.py", line 299, in execute
    postprocess_profiled_run, args, dargs)
  File "/usr/code/autotest-devel/client/shared/test.py", line 215, in _call_run_once
    self.run_once_profiling(postprocess_profiled_run,
  File "/usr/code/autotest-devel/client/shared/test.py", line 322, in run_once_profiling
    self.run_once(*args, **dargs)
  File "/usr/code/autotest-devel/client/tests/virt/virt.py", line 133, in run_once
    run_func(self, params, env)
  File "/usr/code/autotest-devel/client/shared/error.py", line 138, in new_fn
    return fn(*args, **kwargs)
  File "/usr/code/autotest-devel/client/tests/virt/tests/unattended_install.py", line 1003, in run_unattended_install
    dst, mount_point, image_name)
  File "/usr/code/autotest-devel/client/tests/virt/virttest/funcatexit.py", line 50, in register
    if func.func_name not in func.__globals__:
AttributeError: 'function' object has no attribute '__globals__'

In python 2.7:
>>> fuc.__globals__
{'__builtins__': <module '__builtin__' (built-in)>, '__name__': '__main__', 'fuc': <function fuc at 0x7f17b90778c0>, '__doc__': None, '__package__': None}
>>> fuc.func_name
'fuc'
>>> fuc.func_globals
{'__builtins__': <module '__builtin__' (built-in)>, '__name__': '__main__', 'fuc': <function fuc at 0x7f17b90778c0>, '__doc__': None, '__package__': None}

Signed-off-by: Feng Yang <fyang@redhat.com>
virt: Modify self[key] to self.data[key] in utils_env.py

Although self identical to self.data, prefer to use self.data
like other function did.

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

libvirt-virsh: Use weakref from VirshClosure to VirshPersistent.
virttest.qemu_vm: Fix '-pcidevice' device

The correct command for old version pci-assign device should be
'-pcidevice' and not '-device pcidevice'.

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