KVM Test: Update nfs_corrupt test

The virt_env_process.preprocess_image() function parameters was updated
by f37c7f736a867bc649fc4319e8a8f9ccf1f049d6 to accept an image_name parameter.
This patch fixes the nfs_corrupt test module to use the new signature.

Signed-off-by: Feng Yang <fyang@redhat.com>
create image directory if needed

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
qtree: avoid class name clash

Rename 'class' to 'class_name' in the qtree parser, to fix a name clash
(followed by a parser error) with the 'class' property in upstream qemu.

Device in question is virtio-blk-pci:

      dev: virtio-blk-pci, id "virtio-disk0"
        class = 0x100
        [ ... snip ... ]
        class SCSI controller, addr 00:05.0, pci id 1af4:1001 (sub 1af4:0002)
        [ ... snip ... ]
qtree: id name clash workaround

qtree parser stubles over a duplicate id here:

  dev: kvm-apic, id ""
    id = 1
    vapic = on
    irq 0
    mmio ffffffffffffffff/0000000000100000

Bad idea on qemu side to do that in the first place, should
better be named 'apic-id' (simliar to scsi-id).

This patch adds a workaround for it: ignore empty id strings.
Looked like the least hacky way to fix the issue at hand.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
qtree: {bus, dev}-prop: prefix is gone, adapt

upstream qemu has no 'bus-prop:' and 'dev-prop:' prefixes any more,
they are gone with the move to QOM.  Adapt the qtree parser, by
stripping off the prefixes for older qemu versions, then use the
short, un-prefixed version to query the values.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Fix repair of systems with install_server

When we are running repair on a system, we aren't passed a profile like
we are with autoserv jobs normally in the machine name. So self.profile
for the Host object comes back as ''. With the code as-is, that will
result in install_machine() returning immediately back to the repair
code and verify complaining with:

07/08 06:45:32 INFO |base_class:0407| Trying to reinstall the machine
07/08 06:45:32 WARNI|base_class:0360| Already done this (<bound method [machine name redacted].machine_install of <remote host: [machine name redacted], profile: >>) repair procedure, re-raising the original exception.

I think a simpler choice is that if we still don't have a profile after
self.profile is assigned, let's assume that the install system can
figure it out? And if it is unable to (usually do to a misconfiguration
of Cobbler backend), thrown an exception.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
KVM Test: Always run vm.resume() after image_func()

in virt/virt_env_process.py,
 def _call_image_func():
should use try...finally to make sure the vm is alway resumed back.

Signed-off-by: Feng Yang <fyang@redhat.com>
Do not pickle SoftwareManager

root@prasad-autotest-2:/usr/local/autotest/client# cat
0001-Do-not-pickle-SoftwareManager.patch
>From 72fd2c3a81bf60dffd71bcffbc31e8fcaa205dd1 Mon Sep 17 00:00:00 2001
From: Prasad Joshi <prasadjoshi.linux@gmail.com>
Date: Sat, 21 Jul 2012 01:59:19 +0530
Subject: [PATCH] Do not pickle SoftwareManager

The sleeptest on remote CentOS machine resulted in following traceback

15:45:31 ERROR| JOB ERROR: Unhandled TypeError: can't pickle file objects
Traceback (most recent call last):
  File "/tmp/sysinfo/autoserv-KCmM2V/job.py", line 1165, in step_engine
    execfile(self.control, global_control_vars, global_control_vars)
  File "/tmp/sysinfo/autoserv-KCmM2V/control.autoserv", line 13, in <module>
    pickle.dump(job.sysinfo, open(sysinfo_pickle, 'w'))
  File "/usr/lib64/python2.6/pickle.py", line 1362, in dump
    Pickler(file, protocol).dump(obj)
  File "/usr/lib64/python2.6/pickle.py", line 224, in dump
    self.save(obj)
  File "/usr/lib64/python2.6/pickle.py", line 331, in save
    self.save_reduce(obj=obj, *rv)
  File "/usr/lib64/python2.6/pickle.py", line 419, in save_reduce
  ...
  ...
  ...
  ...
  File "/usr/lib64/python2.6/pickle.py", line 306, in save
    rv = reduce(self.proto)
  File "/usr/lib64/python2.6/copy_reg.py", line 70, in _reduce_ex
    raise TypeError, "can't pickle %s objects" % base.__name__
  TypeError: can't pickle file objects

Marking SoftwareManager as not to pickle solve the problem.

Signed-off-by: Abhay Chavan <chavan.abhay@gmail.com>
Signed-off-by: Rajshree Thorat <rajashree.thorat16@gmail.com>
Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>