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.
small fix for virsh_snapshot.

Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>
fix virsh.snapshot_create to return command().

Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>
fix virsh_snapshot for new virsh.snapshot_create

Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>
add test for virsh snapshot disk.

Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>
Test virsh_snapshot: Import the 're' module.
Test virsh_snapshot_disk: Fix indentation.

Signed-off-by: Ruda Moura <rmoura@redhat.com>
shared.scripts.virtio_console_guest: Fix problem with async mode

The bacground process was likely to be killed by SIGIO while setting
port to async mode. This was due of bad workflow, where first the
port was set to async mode, than the the new SIGIO handler was set.

With this version when we set async mode, we fist add the SIGIO
handler and then set the port to async mode.

When we are setting the port back, the order is the opposite, so
first the port is set to sync mode and then we remove the SIGIO
handler.

Additionally the workaround with test_delete_guest_script() was
removed as it's fixed by this patch.

NOTE: You have to remove the previous /tmp/virtio_console_guest.py*
      in order to let virtio_console test to copy this updated one!

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
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>
tool: add a tool to run pep8.

Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>
tool: add pep8 check into check_patch.

Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>