libvirt: Fix vcpupin XML change

Test vcpupin doesn't backup and restore vm XML, making the XML change
when using '--config' option.

This commit:
* Backup and restore VM's XML using new_from_inactive_dumpxml and sync.

* Close the test block in 'try ... finally ...' to ensure VM recover in
  any case.

Signed-off-by: Hao Liu <hliu@redhat.com>
virt: Modify 'test_modules' to be a dictionary

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
Merge pull request #1277 from liyangfnst/virt_py

virt: Modify 'test_modules' to be a dictionary
Merge pull request #1266 from Hao-Liu/fix_vcpupin

libvirt: Fix vcpupin XML change
libvirt: Fix start uuid change

When calling vm_rename() the UUID will change, making the vm xml don't
consist with original one.

The patch use new_from_inactive_dumpxml and sync to backup and recover
test vm.

For testing empty or invalid vm name, we need another variable to store
the valid vm name for recovering.

This patch also fix a bug of VMXML.sync(). when the vm is no longer
exist, sync will raise an exception in the backup step. This is not a
right behavior because sync should recover vm even if it's undefined.

Signed-off-by: Hao Liu <hliu@redhat.com>
libvirt.tests.virsh_memtune: Replace incompatible py 2.4 construct

The keyword 'with' is valid only on py >= 2.5. We'll have
to wait a bit before those can be freely used.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
libvirt.virsh_schedinfo_qemu_posix: Remove py 2.4 incompatible construct

With is valid only on py >= 2.5. We'll have to wait
a bit until it can be used in virt-test code.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virttest.utils_cgroup_unittest: Make it compatible with python 2.4

This unittest relied on a new param of the tempfile.NamedTemporaryFile
class: delete. Python 2.4 doesn't have such param, which means that
named temp files will always be deleted after they are closed.

So let's use the module only to give us a file path, that will then
be manually managed.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Merge pull request #1289 from autotest/fix-py24-bugs

Fix py24 bugs
Merge pull request #1264 from Hao-Liu/fix_start

libvirt: Fix start uuid change