frontend.db.backends: Fix undefined name error in _valid_connection

We've experienced some problems in a newer instance of
our autotest server, when we discovered that one exception
handling in the django db code (introduced by
ee3cced1afb6bc45216c7038472827ad4033c3f5) had the wrong
namespace for the DatabaseError. Without the appropriate
path, the exception handling would itself throw a NameError
exception, making the function return None.

This is expected to fix errors like:

[Tue Jul 10 10:35:04 2012] [error] [client 1.2.3.4]     return
self.connection.rollback(), referer:
http://foo.com/afe

[Tue Jul 10 10:35:04 2012] [error] [client 1.2.3.4] OperationalError:
(2006, 'MySQL server has gone away'), referer:
http://foo.com/afe/

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Client: Enhancements for xml_utils & unittest

* Added abstract base classes
    * TempXMLFile - Temporary file that unlinks on destruction
    * XMLBackup - Backup temporary file of some source content
    * XMLBase - ElementTree from Backup temporary file of source content
* ElementTree and xml_utils update
    * Convert all ElementTree classes into "new-style" classes
      (ugly, best of two evils)
    * Impliment string.Template based XML templates and unittests
* Uniformly support ElementTree XPATH refs.
    * Included 2.6 copy of ElementPath module
    * Hard-coded autotest ElementTree to use bundled ElementPath
      (ugly, best of two evils)
* Unittests for all classes & methods

Signed-off-by: Chris Evich <cevich@redhat.com>
virt: Run vm.pause/resume methond instead of call monitor cmd

Some cases call Monitor.cmd method directly, and they can't
work with qmp monitor, we need to make them call the wrapper
of monitor instead.

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
virt.kvm_monitor: Record all monitor message into a separated file

This patch record all monitor cmd/response in a seperated file,
so that we can analyse them easily.

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
virt: Fix floppy image path for the old command line

The floppy image path in old format command line is not an abspath
which will cause some cases failed.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
Fix the md5sum check issue

The "md5sum -c" will check the file which is md5sumed. in guest-os.cfg, it will hit a error,if we don't use the right
path
lyang0@lyang0-OptiPlex-755:~/community/autotest_upstream$ cd /bin && md5sum ls > /tmp/ls.md5 && cd /tmp && md5sum -c ls.md5
md5sum: ls: No such file or directory
ls: FAILED open or read
md5sum: WARNING: 1 of 1 listed file could not be read

Signed-off-by: Lei Yang <yanglei.fage@gmail.com>
virt: to test timer functionality of guest

This test implements the following github issue
https://github.com/autotest/autotest/issues/404

Signed-off-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
boottool: get rid of DeprecationWarning messages

Get rid of DeprecationWarning messages on newer Python version while still
making it run on properly on Python 2.4

Signed-off-by: Cleber Rosa <crosa@redhat.com>
boottool: support instalation of grubby build dependencies

Signed-off-by: Cleber Rosa <crosa@redhat.com>
kvm.tests.time_manage: stress parameters fixup

cpu and io stress has been added to the host load command.

Signed-off-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
Use -device for virtio-blk

Create virtio-blk devices using '-drive if=none,...' and
'-device virtio-blk-pci'.  Has the advantage that we can
support bootindex this way.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
bootindex support for ahci

pass on bootindex (if set) to ide drives hooked up via ahci.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
add option to switch from boot=on to bootindex

This adds a global switch 'use_bootindex' which will make autotest
use bootindex instead of boot=on when it sees image_boot=yes.  Needed
when testing upstream qemu as boot=on isn't supported there.

Unfortunaly there is no easy way to figure whenever qemu supports
boot=on or not, thus we need the inconvinient manual switch here.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Catch KeyError in BaseVM.del_nic()

Base_VM.add_nic() doesn't add mac to address_cache,
so when we delete call BaseVM.del_nic(), it is like this:
    del self.address_cache[nic_mac]
This may lead to KeyError. But BaseVM.del_nic() only catch IndexError.
So we should catch KeyError too.

And also, we should do delete the nic in virtnet before we delete it
from address_cache, in case we occur the KeyError.

Signed-off-by: Tang Chen <tanchen@cn.fujitsu.com>
boottool: add debug logging when running commands

Previous boottool versions logged every single command that was run,
but that was considered to be exceedingly verbose, because all of those
commands and output/return would show in *.DEBUG files. Now, when running
into bugs, we frequently have add log statements to the _run_* methods.

This patch checks an environment variable and logs debug messages if
it is set. I chose to keep that as an extra knob, as casual users
may want to see debug messages ('--verbose=5') but not every single
command run and it's output/return code.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
boottool: add checks and debug statements when running grubby

And the actual grubby path set is not valid.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
boottool: remove imp (black) magic

Now that the boottool app is properly named, that is, has a .py suffix.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
boottool: avoid instantiating boottool with invalid grubby path

Signed-off-by: Cleber Rosa <crosa@redhat.com>
virt: Fix the extra blank in readonly_floopy

Remove the extra blank

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
virt: style changes nitpicks

No behavior changes whatsoever, just minor style adjustments.

Signed-off-by: Cleber Rosa <crosa@redhat.com>