pre/post-process: Don't unpause VM if it was already paused

On my test case, I want to get a paused VM and I won't ever need to
unpause it, so I set paused_after_start_vm=yes. The image check code,
however, was unconditionally unpausing the VM, and this is a bug.

This changes the process() code to pause/unpause the VM only if it was
not yet paused.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
env_process: separate VM class lookup from object creation

The VM class lookup will be moved somewhere else.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
env_process: Move VM class lookup to a separate function

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
env_process: Import VM class modules on demand

Instead of importing every single VM type module, just import the
modules that are going to be used on demand, depending on vm_type.

The only exception by now is libvirt_vm, that is also used for the
libvirtd_restart() call at preprocess().

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Move VM class lookup to BaseVM class

This way it can be reused elsewhere. This keeps the on-demand loading of
vm_type-specific modules.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Move VM creation/registration code to Env class

This way, other code can easily create/register a VM object manually if
necessary.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
qemu_monitor: Make both monitor subclasses provide a human_monitor_cmd() method

This way we can write test code that use HMP commands without worrying
if the actualy monitor is a QMP or HMP monitor.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
qemu_monitor: Add info_numa() method

Unit test for the response parsing included.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Add test module for the QEMU "-numa" option parsing

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
qemu.tests.multi_disk: Fix bootindex bug

Fix signal_repeat variant to boot with the correct bootindex.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.qemu_qtree: Hook for ahci disks

AHCI disk is in reality ide-drive disk inside AHCI bus.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.virt_vm: Add kernel panic pattern "general protection fault"

This fault comes from bug:
https://bugzilla.redhat.com/show_bug.cgi?id=912567

The kernel panic message is:
"""
general protection fault: 0000 [#1] SMP
last sysfs file: /sys/power/state
CPU 1
Modules linked in: bridge fuse uinput autofs4 sunrpc 8021q garp stp llc ipt_REJECT nf_conntrack_ipv4 nf_defrag_ipv4 iptable_filter ip_tables ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter ip6_tables ipv6 sg microcode virtio_balloon virtio_console snd_hda_intel snd_hda_codec snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer snd soundcore snd_page_alloc e1000 i2c_piix4 i2c_core ext4 mbcache jbd2 virtio_blk sr_mod cdrom virtio_pci virtio_ring virtio pata_acpi ata_generic ata_piix dm_mirror dm_region_hash dm_log dm_mod [last unloaded: speedstep_lib]

Pid: 2704, comm: bonobo-activati Tainted: G    B      ---------------    2.6.32-358.el6.x86_64 #1 Red Hat KVM
RIP: 0010:[<ffffffff81197619>]  [<ffffffff81197619>] do_sys_poll+0x269/0x520
RSP: 0018:ffff880119d83b28  EFLAGS: 00010202
RAX: 17e05967908ddc73 RBX: ffff880119d83f04 RCX: 953bc6ebfc12a10d
RDX: ffff880119cfcf00 RSI: ffff880119d83f04 RDI: ffff880119cfcf30
RBP: ffff880119d83f38 R08: 953bc6ebfc12a10e R09: 0000000000000001
R10: 0000001100000003 R11: 0000001300000003 R12: ffff880119d83e7c
R13: ffff880119d83e44 R14: ffff880119cfcf00 R15: ffff880119d83b88
FS:  00007f68e5b8d700(0000) GS:ffff880028300000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 00007fdce1db37d7 CR3: 0000000119c3d000 CR4: 00000000000006e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process bonobo-activati (pid: 2704, threadinfo ffff880119d82000, task ffff880119d80aa0)
Stack:
 ffff88011cb4b080 ffff880100000000 ffff880119d80aa0 00ff88011cb4b080
<d> 00007f68d8005450 0000000000000000 ffff880119d83b88 0000000000000000
<d> 0000000000000000 000000008143cfd7 ffff880119d83df8 0000000028216768
Call Trace:
 [<ffffffff81197160>] ? __pollwait+0x0/0xf0
 [<ffffffff81197250>] ? pollwake+0x0/0x60
 [<ffffffff81197250>] ? pollwake+0x0/0x60
 [<ffffffff81197250>] ? pollwake+0x0/0x60
 [<ffffffff81197250>] ? pollwake+0x0/0x60
 [<ffffffff81197250>] ? pollwake+0x0/0x60
 [<ffffffff81197250>] ? pollwake+0x0/0x60
 [<ffffffff81197250>] ? pollwake+0x0/0x60
 [<ffffffff81197250>] ? pollwake+0x0/0x60
 [<ffffffff810ace0b>] ? sys_futex+0x7b/0x170
 [<ffffffff81197b8c>] do_restart_poll+0x3c/0x60
 [<ffffffff8100b341>] ? int_signal+0x12/0x17
 [<ffffffff8108254f>] sys_restart_syscall+0x1f/0x30
 [<ffffffff8100b072>] system_call_fastpath+0x16/0x1b
Code: 00 00 00 0f 1f 80 00 00 00 00 48 89 de e8 60 ac fe ff 48 85 c0 49 89 c6 0f 84 54 01 00 00 48 8b 40 20 48 85 c0 0f 84 37 01 00 00 <48> 8b 40 38 48 85 c0 0f 84 2a 01 00 00 4d 85 ff 74 18 41 0f b7
RIP  [<ffffffff81197619>] do_sys_poll+0x269/0x520
 RSP <ffff880119d83b28>
"""

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
netperf: stop tcpdump process during performance testing

This patch was wrongly dropped in original refactor.

Tcpdump brings extra latency, it causes the guest to batch
more bytes per packet. We should stop tcpdump to drop the
effect, it will be restarted at the beginning of next case.

Reported-by: Wenli Quan <wquan@redhat.com>
Signed-off-by: Amos Kong <akong@redhat.com>
Acked-by: Wenli Quan <wquan@redhat.com>
bootstrap: Give step based installs/setup priority for qemu

Step based installs are a qemu feature, used to install
guests, so the step.cfg file should be given priority
in qemu sets.

With this patch, they'll have priority, together with
unattended_install in testing order.

CC: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
qemu/tests/steps.py: Handle IOErrors during step engine replay

As we now start the vm paused in virt tests, it might
be a little while (some seconds) before the screendump
commands actually produce a screendump. So let's handle
IOErrors (file does not exist) when reading from the
screendump ppm file gracefully, just the same way we
do with other failures in the main test loop.

CC: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
standalone_test: Don't auto cut tag when custom cfg is provided

So, contrary to my belief, there's no easy heuristics to
auto guess what is the best test name display on custom
config files, since even fairly simple files can break
our assumptions entirely. So just give up on doing that
when a custom config file is provided - fall back to
just using the shortname as a test tag.

Another thing discovered when migrating an old test
set routine that required a custom cfg file.

CC: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
standalone_test: Fix bug when skipping test results

The test runner was not printing the 'pretty index'
and repeating the test names. Example:

(29/48) raw.smp2.WinXP.32.sp3.install: FAIL (0.82 s)
raw.smp2.WinXP.64.shutdown: SKIP
raw.smp2.WinXP.64.shutdown: SKIP
raw.smp2.WinXP.64.shutdown: SKIP
raw.smp2.WinXP.64.shutdown: SKIP
raw.smp2.WinXP.64.shutdown: SKIP
raw.smp2.WinXP.64.shutdown: SKIP
raw.smp2.WinXP.64.shutdown: SKIP
raw.smp2.WinXP.64.shutdown: SKIP
raw.smp2.WinXP.64.shutdown: SKIP

Fix this by moving initialization of the test object
before the 'dependencies satisfied' branch.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
cfg: add machines.cfg to gitignore

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
cfg: change more occurrences of .64 to x86_64

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
standalone_test: provide a good error message for "./run -c mycfg.cfg"

This does not work because it looks for other config files in the cfg
directory of the current directory.  In most cases you will want to
use "-t qemu" or similar even with "-c" if you get this error, add
a hint.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>