virt: RHEL-6-series.ks - Add coreutils and usbutils

Those packages are needed for some of the new tests
added to the kvm test set.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
client job: Instantiate job.bootloader lazily

Only instantiate job.bootloader to a usable value
if it's really needed (ie, we want to reboot the
machine), since now we depend on a C tool to do
that and the compilation of this tool might fail.

So only throw errors if something wrong happens
there, so we don't have to punish users that only
want to run some tests with the autotest client.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
contrib/install-autotest-server.sh: make the script more modularized

The encapsulation of the script code into functions will allow one
to chose specific installation actions, such as just installing packages,
and may help the code reuse between the script itself and %pre/%post
scripts on RPM packages.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
contrib/install-autotest-server.sh: install packages all packages at once

This should improve the install time a little, as YUM won't have to do all
the checking (including contacting repos, cheking depencies) multiple times.

Still, the packages are still separated into different groups, so it's easy
to select only a subset of them if necessary.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
contrib/install-autotest-server.sh: only play with iptables config if it exists

I've observed that minimal installations might lack the iptables configuration
file, so add a check.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
contrib/install-autotest-server.sh: better filter libvirt's default network address

If installing a VM with an autotest server using libvirt's default network
address assigment, if the aquired address starts with '1', then it'd not
be shown on the installation status message.

So, let's filter out just the address assigned to the host interface.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
contrib/install-autotest-server.sh: allow to short-circuit the installation

This first commit allows one to install the necessary packages on a base
system. Suitable for generating and keeping a base autotest installation
image, handy for development.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
contrib/install-autotest-server.sh: check and skip package installation

We can quickly detect if packages are already installed. If desired and
installed counters match, skip installation.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
boottool: Instantiate job.bootloader lazily take 2

We did find out that the job.boottool attribute was
more pervasively used than we originally thought, so
267bebd93546d43a0900052742767dad941e7ed2 did resolve
the problem for users of autotest local, but broke
use for any code that involved kernel code. So instead
of treating all the places that might use job.bootloader
methods, make boottool.boottool a child class that will
initialize the grubby compilation on demand, only
if one of the methods of it are actually accessed.

With this, we resolve the bug that makes any job that
installs a kernel to fail, since self.job.bootloader
might be None currently.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
subtests.cfg: Make boot_with_usb and reboot_with_usb Linux only

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
boottool: Fix __getattribute__ acessor

The shorthand __getattr__ can't be used.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
boottool: optmize implementation of get_entries()

Now 'grubby --info=<arg>' should be called just once, instead of
once for every entry.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
boottool: fix misleading error message

When running --info without parameters, a misleading error message
was printed out. Replace it with a proper message.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
boottool: made parsing of grubby output (entries) more resilient

Signed-off-by: Cleber Rosa <crosa@redhat.com>
boottool: made info action implementation rely on entries instead of lines

This reuses the get_entry()/get_entries() methods to obtain information
in a better format (dicts instead of lines of text).

Also, by switching to these methods, 'grubby --info=<param>' is called
only once.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
boottool: make warnings show up on default logging level

This changes the default logging level, so that warnings also show
up by default.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
boottool: warn on usage of not ideal version of grubby

Since boottool can use the grubby version that is already installed
if the user explicitly chooses it, we should warn if that version
is not guaranteed to work.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
boottool: make grubby auto installation more robust

This adds more granular checks to the automatic grubby installation,
and also allows grubby to be installed under '/tmp', so that
unpriviledged users can, to the extent that grubby and the boot
configuration files themselves allow, also use boottool.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
boottool: Fix boot_once unittest

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
utils: make_clean temporary files and env

Signed-off-by: Chris Evich <cevich@redhat.com>