kvm.cgroup: Fix cgroup testing

Fix cgroup testing by adding the cgroup library from
current autotest upstream (0.14 rpms won't have it).

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virt-libvirt: Add methods for vcpu access in libvirt_xml

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Added debug logging for virsh.define()

Signed-off-by: Chris Evich <cevich@redhat.com>
virtio_console: Remove unnecessary print

This patch removes debug print which somehow made it to upstream, plus
two long line fixes. There are no other (fixable) pylint errors now.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
ksm_overcommit: Add test description

No test change, only additional comments.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
ksm_overcommit: pylint and pep8 fixes

No code changes, only variable renames, etc.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
ksm_overcommit: Kill ksmtuned

ksmtuned modifies KSM setting which results in test failure.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virt-libvirt: Fix debug log message typo.

* Bug introduced in 8f464022f845e958c4777f943384179b66428eec
* Fix 'name' -> 'xml_path'

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: configuration of virsh managedsave

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
virt-libvirt: add test of virsh managedsave

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
run: Print more info in --list-tests

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
cartesian_config: Fix use of reserved keywords and unused variables

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
kvm_virtio_port: Do not readout ports when VM is dead

When VM dies it closes connection to sockets. We might (and often)
stuck in readout for ever.

Additionally get rid of in-test readouts which are handeled by
guest_worker's safe_exit_loopback_threads()

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virtio_console: Check periodically for failures in loopback test

Don't wait until the test timeout, but fail the test when thread
or VM fails.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
data_dir: Introduce root_dir

The data dir library is useful to avoid recalculating
over and over again commonly used locations of this test
suite. This time, let's introduce get_root_dir, that
returns the top level dir of the test suite.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
utils_misc.Env: Create a method to destroy the env file

Make it possible to destroy all vms, and close other
processes stored in the env file. This way we can do some
safe cleanup before we run virt tests.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
standalone_test: Destroy the previous env file before run

This is a complement solution for issue #122.

Before running the tests, clean up all objects lying around
in the env file. This is safer and avoids errors that happen
here and there, and are hard to understand for people not
familiar with the virt tests structure.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virt.kvm_vm: Introduce background error queue

Introduce a background error queue to store exceptions
happened during virt background tasks (such as aexpect
instances and screendump thread). With this queue,
it is possible to store exception information useful
to fail tests at certain points. Examples:

* We can detect qemu suffered a crash from inside the
  aexpect thread
* We can detect screen inactivity on the screendump
  thread and fail the unattended install test without
  having to wait the entire timeout of the test

The next patches will introduce that functionality.

Implementation consists in a virt test attribute,
background_error test, that is a Queue.Queue()
(thread safe), background threads that want to
make use of it need to catch the exception they
want to propagate and store it in the queue
using put(sys.exc_info).

Then in every convenient situation to do so, subtests
can call the test.verify_bg_errors() method
(in the beginning or end of each test loop, where
operations such as migrations are executed).

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virt.virt_env_process: fail tests due to guest screen inactivity

In a very specific test (unattended_install), all OEM installer
mechanism will present intense guest screen activity, so screen
inactivity for a relatively long time almost always mean something
went very wrong and the installer is stuck.

So create a mechanism to detect screen inactivity for any vm that
takes place in the test - have a timer for each vm that is reset
only if the next screenshot is different than the previous. So,
if the vm got stuck somewhere at the install process, for example:

* Wrong Windows CD Key
* Guest OS does not see a disk controller due to lack of drivers
* BIOS got stuck

And other similar cases, we'll have a test failure before the full
test timeout (that for Windows may be up to 3 hours). So we save
time and know about such situations earlier.

Next patch introduces the parameters on base.cfg, subtests.cfg, and
also introduces a sensible default for inactivity treshold (30 min).

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virt tests: Introduce inactivity watcher for unattended_install

With this patch, if the screen got inactive during unattended
install for more than 30 minutes, an error will be thrown. For
any other tests, we'll just log a debug message, since in other
tests we do not expect to see much action going on the screen.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>