autotest regression test: add a single VM (server only) mode

I've found that it's useful to check just the autotest installation steps
with a single VM with increased resources, mainly memory.

First 1G of memory is too little to do things like compiling the GWT client,
2G is OK, but 4G is preferrable. On most development machines (mine included),
starting two VMs with 2G or 4G is usually not a good idea.

To set this single VM (server only) mode, simply set the "vms" parameter to
a single (server) VM name.

Also, be a lot more generous about the installation timeout, as based on my
experience, things like downloading GWT and the git trees can take a long
time (YMMV).

Signed-off-by: Cleber Rosa <crosa@redhat.com>
autotest regression test: make the unittests arguments configurable

So that we can run the shorter set of unittests if desired.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
Merge pull request #1350 from clebergnu/autotest_regression

Autotest regression test
qemu.cfg: Typo fix in cdrom_test.cfg

Signed-off-by: Feng Yang <fyang@redhat.com>
Merge pull request #1359 from FengYang/cdrom_test

qemu.cfg: Typo fix in cdrom_test.cfg
SLES11.xml: make serial port can be login

Move chroot-scripts into one section and make serial port setting
part with chrooted as false.

change from V1:
  revert the other lines, just change chroot part.

Signed-off-by: Xiangmin Han <xhan@redhat.com>
Merge pull request #1338 from Xiangmin/fix_SLES11_xml

SLES11.xml: make serial port can be login
virt: Fix ping test when pre_cmd fails

Test result should not be dependent on successful execution of pre_cmd.
If pre_cmd fails, and it is important, most likely test will fail
also.  Otherwise, it's probably safe to ignore output and result.

Signed-off-by: Chris Evich <cevich@redhat.com>
Revert virt.virtnet: update vm.virtnet when guest reboot

This reverts commit 33b69b8bb51b217a857028dc9ea7889eaef54531.

Conflicts:
	virttest/virt_vm.py
virt: Remove vm.driver_type

This parameter is only ever actually used for a handful of Xen tests and
checks.  Where referenced, it always came along with a test against the
'hvm_or_pv' parameter.  This patch removes vm.driver_type, removes
the params dict manipulation, and consolidates all use down to just a
new vm.is_xen() method call.  The handful of tests we have which use xen
VM's were also updated.

I also removed a docstring referencing xen for a non-existant function
parameter.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt: VM House-keeping

*  Several callers to the VM class use 'basedir' and 'root_dir'
   interchangeably.  Rename these to just use root_dir since it
   appears more common.

*  VM instance attributes ``name``, ``params``, root_dir`` and
   ``address_cache`` are common to all subclasses, so it makes
   more sense to consolidate their assignment into the base-class.

*  Fix a name <-> self.name reference problem in a context label.

*  Implement proper line-wrapping for call to
   qemu_monitor.wait_for_create_monitor() in qemu_vm.py

*  Fix a possible bug where vm.migration_file is initialized
   to None, but only it's existance was checked, not it's possible
   None value.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt: Fix host IP lookup assumption

Looking up an IP address for the host system should not depend
on guest networking configuration.  For example, if guest is
using nettype=user, then (technically) the netdst param contents
are not applicable and may not even be set!  However,
utils_net.get_host_ip_address() assumes netdst param will
always point at a host networking device.

Another problematic situation is when a guest is installed
with unattended_install using a network-based method,
however guest is initially configured WITHOUT any networking
device (possible with libvirt/virt-install).

A safer assumption, is that a default route is defined to
deliver packets via a valid local networking device.  With IPv4,
this networking device _must_ have an associated IP address
which is unlikely to be invalid or a black-hole.  Therefor,
this address is a much safer option than relying on guest
networking configuration.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt: Reduce virtnet and rewrite unittests

Component classes of virtnet had their behavior bound together,
making them less flexible and more difficult to use.  An auxiliary
class was then used to support customization but it was not at the
right level in the stack, nor did it help untangle any bound
behavior.

This update takes the intention of the auxiliary class
(VMNetStyle) and folds it into the virtnet component classes
in a more heirarchical manner.  Additionally, VirtNet itself
has been split up into an ABC, and multiple subclasses which
operate on different data sources, but through a common interface.

This places the burden/responsibility for managing data and it's source
on the virtnet consumer.  It allows for greater flexibility and eases
maintenance since class responsibility and interfaces are more clearly
defined and don't come with any cross-dependencies.

Finally, since a prior update made PropCan instances fully pickleable,
there is no need to perform string conversion/parsing for storage.
Further, since a proper ABC model was implemented, storage can
be performed agnostic to inner container-class type.  These changes
permit rich comparison between the various VirtNet classes, including
the ability to select specific properties to NOT be compared, at
runtime.

The unittests were nearly completely re-written to cover the most
critical points in the new structure.  Test coverage is a little
less robust than previous, however it also runs roughly 10x faster.
The cartesian-based testing was updated to reflect recent changes
to the vm classes, and cut back on a lot of redundant tests.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt: Share virtnet specialization and cleanup

Choosing which networking inner-storage class for virtnet
now happens at the VM level.  Also, the cache database
location can be made common, allowing for a shared
clean_tmp_files() implementation.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt: Let VM subclasses decide init virtnet

Rather than one-size-fits all, provide a common set of
network initialization, caching, storage, and syncing
functions, and allow higher-levels to decide when/how to
setup networking.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt: Mac/IP loop readability

Clean up some variable names and virtnet calls to make it more
obvious what is being returned and operated on.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt: BaseVM VirtNet updates

Simplify base-class networking code related to dynamic
addition/removal of networking devices.  Even though
all device info is cached in database, only pull
mac addresses from it for new devices.  Otherwise
always trust current params are ultimate authority
for setup info.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-qemu: Remove deprecated script support

While still supported in qemu, virt-test has long since
dropped support for networking up/down scripts.  However,
some remnents remained inside vm.make_create_command().

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

Move commonly used helper functions to methods on virtnet
classes.  This helps organize them closer to relevant data
and while keeping the global and local namespaces clean.
This also helps prevents the need for burried, private
functions, and organizes them in a common location where
they can be unittested.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt: QemuIface auto-convert int() from str. params.

For parameters which expect integers, QemuIface will
attempt to parse them as integers, but provides for
disabling this conversion if necessary (i.e. unittesting).
Therefor, explicit calls to int on reference are no
longer necessary.

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