virtio_console: FIX emit exit_event on failures in migrate test

When migration fails we have to emit exit_event to background threads
otherwise there are confusing errors in log.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
tests: Keyboard input tests through spice

Keys based on their scancodes are sent to client VM through monitor
when spice session of guest VM is in focused on the client VM.
Key events are caught on the guest VM and compared with expected
keycodes.

Signed-off-by: Marian Krcmarik <mkrcmari@redhat.com>
shared/scripts: Simple wxPython form catching keyEvents

Form catches keyEvents and store them into a text file.

Signed-off-by: Marian Krcmarik <mkrcmari@redhat.com>
shared/unattended/RHEL-6.3.ks: Add wxPython dependency - SDL

Signed-off-by: Marian Krcmarik <mkrcmari@redhat.com>
kvm/cfg/spice: Add keyboard input tests.

Signed-off-by: Marian Krcmarik <mkrcmari@redhat.com>
shared/cfg/subtests: Add rv_input test.

Signed-off-by: Marian Krcmarik <mkrcmari@redhat.com>
virt: Adds multi_host_migration early boot tests.

Signed-off-by: Jiří Župka <jzupka@redhat.com>
tools: Add tapfd_helper tool

Move this tapfd_helper tool from autotest repo into
this virt-test repo, since it's a virt-test only tool.

This script can help us boot up guest with autotest
generated qemu command line, it creates tap device
and updates the tapfd in given qemu cli.

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
virt: Adds support for cancel migration in multi-host tests.

1) Start migration with stressed VM.
2) Wait cancel_delay and then cancel migration.
3) Check if machine is alive on source host.
4) Stop stress of VM.
5) Migrate machine again.
6) Check if machine is alive on destination host.

Signed-off-by: Jiří Župka <jzupka@redhat.com>
kvm.virtio_console: FIX delete_guest_script must kill python

On linux guest the guest_worker runs as a daemon so we have to
also kill the worker and remove it's pipes. Otherwise the new
instance would only connect to the old running version.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.kvm_vm: FIX docstrings for add_virtio_port()

Add missing docstrings.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.kvm_vm: Add support for virtio_port extra_params

This allows to specify extra params of virtio_ports using
virtio_port_params_$name = "$param1 $param_2 ...".

Whitespaces are stripped and replaced with ','.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
kvm.virtio_console: Add new test failed_boot

This patch adds new test failed_boot. It tries to create VM
and checks the error message.

As an example boot_nr0 test is added to cfg. It tries to create
VM with virtio port number = 0 (nr=0) which should fail due
to backward compatibility issue.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest: Store qemu_id in VirtioPort

This patch stores the qemu_id to each VirtioPort. This is crucial
for virtio_console hotplug tests.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
kvm.virtio_console: Make all subtests context_aware

This patch makes all virtio_console subtests contest_aware. This should
help debugging failures in subtests called from another subtest's body.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
kvm.virtio_console: Add reboot virtio_console subtest

This patch adds 2 variants of reboot test.
1) stressed - stresses all ports and gently reboots VM (supersede the
              poweroff test)
2) unplugged_ports - unplugs all ports and gently reboots VM

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
shared.cfg: Move guest_s4 OS dependend setup to guest-os.cfg.sample

These settings were by default in subtests.cfg and windows version
overwrote this in guest-os.cfg. I'd like to move them to guest-os.cfg
for booth versions thus the'll be on the same place and it's gonna
be possible to get them in other tests too.

I put a comment to subtests.cfg about required variables.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.kvm_virtio_port: FIX cleanup_ports

_init_guest() doesn't execute the worker. We have to do that manualy
before calling self._init_guest()

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.kvm_virtio_port: FIX ThSendCheck

The main loop of ThSendCheck worked incorrectly in case of port
reconnection. It could end-up with infinite number of reconnection
although only 10 was allowed. This patch makes ThSendCheck work
as it should.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.kvm_virtio_port: New features for GuestWorker

This patch adds new features to GuestWorker:
* read_nonblocking - read-out the output of guest script (used when
                     the test fails and we want to see the output)
* ThSendCheck - adds reduced_set option (use only A-Z, simplifies debuging
* ThRecvCheck - adds debug mode. This mode executes completely different
                loop. It's better for debuging purposes. Not all
                functionalities are kept so you should know when you want
                to use it.

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