add VIR_ERR_OPERATION_INVALID as valid complete install error [BZ 755830]

In F16 (and possibly earlier) this is one of the errors that libvirt
throws when you attempt to operate on a domain that has shut down.
This needs to be one of the "acceptable errors" we catch as an indication
that the JEOS install has finished.
(cherry picked from commit d4e90b19d13c5c52a860d0783facd5ee1c5de873)
Refactor capture_screenshot.

This just takes the exception string, which was duplicated
in two places, and consolidates it into capture_screenshot.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
(cherry picked from commit 9e4490b041c2af1714726eaa3e305eace505b8a4)
Refactor wait_for_install_finish.

This method was getting out of hand with how complicated
it was.  To help, factor out the bits that detect the
disks and interfaces attached, and the bits that actually
do the stats gathering.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
(cherry picked from commit a47172ba2aa6ddca011c77d43259fac170214637)
Improve shutdown detection

Detecting when a guest has independently shutdown via libvirt calls turns
out to be a little dicey.  During testing we have seen a variety of exceptions
depending on when exactly in the guest teardown process the libvirt call is
made.  This patch changes the approach from checking against a growing
whitelist of exceptions to waiting until teardown/destroy is complete and
a single known good exception is thrown.  That is, a libvirt exception where:

e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN

We have been testing with a slightly different version of this patch in the
Aeolus project.  This has proven rock solid over about a month of testing.

This patch simply checks more frequently for the "correct" exception while
allowing up to 10 seconds for it to occur (instead of 5).

clalancette: I've cleaned up the patch a bit and made some
minor changes to it.  The basic idea is still Ian's.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
(cherry picked from commit 1e9c395eaae76548bb7902db0fe56800dcd60025)
Update the default screenshot dir to be /var/lib/oz/screenshots

This closes out github issue #19.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
(cherry picked from commit 3b127e22eb54be0b5cb0067f41e38bb7097a2608)

Conflicts:
	debian/dirs
	oz/ozutil.py
Switch screenshot mechanism to using libvirt screenshots.

This gets rid of an annoying external dependency, and
makes for some simpler code.  Unfortunately I was not able
to get it to work on a Fedora-14 host with libvirt 0.9.6,
but I have not investigated the causes.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
(cherry picked from commit a0cd2832f4ddb90878272f3b283a292edc95507b)

Conflicts:
	TODO
	oz.spec.in
Loosen the check for RHEL-6 update numbers.

We have never had a case where a RHEL minor update has
broken the installer.  Thus, we can afford to accept any
version number within a major RHEL version.  This will make
it so that we don't have to release a new version of Oz
for every minor RHEL/CentOS update

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
(cherry picked from commit 4ac3c4651c333c1bf7e5f621c80bb058071731b2)
(add support for Betas e.g. 4Beta)

Conflicts:
	oz/RHEL_6.py