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>
shared.scripts.virtio_console_guest: Adds new loopback mode

This patch adds _reconnect_none_mode version of the loopback thread.
It works as ordinary none_mode, but additionally disconnects in case
the port is unreadable and reconnects when possible.

It was necessarily to make virt global variable to be able to access
it in this thread.

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

This test starts loopback between first 2 ports and do the interruption.
Than it verifies, whether new data still arrives and the loss/dup is
in the allowed range. Multiple interruption loops are supported.

Variants:
* stop and cont
* port replug (sender, receiver, random)
* hibernate (S4)

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
shared.cfg: Modify virtio_console loopback test setting

This setting suits the current version of virtio_console loopback
test.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.kvm_vm: FIX virtio_ports bus handling

The bus handling in virtio_ports is broken. This patch modifies
it to realy work as described:
1) manual port definition
2) virtio_port_spread
3) without definition (but create the first bus)

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

Console version of test_rw_notconnect_guest used the second vio port,
but should use the first one instead. Test might fail in case VM
was recreated by the test.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
kvm.virtio_console: FIX Exceptions don't accept *args

Don't pass *args to Exceptions, use '%' instead.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
kvm.virtio_console: FIX multi_open for console on windows

Expected result when opening virtconsole on windows is fail.
(actually it's dependent on the way we open it and currently
we use exclusive access so this test is not exactly related
to virtconsole, but to windows CreateFile function)

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virt-test: add a time suffix to result file

We might use 'iterations' parameters to execute one case
repeatedly, this patch makes the filename unique.

Signed-off-by: Amos Kong <akong@redhat.com>
tools: Adding more tools from autotest

Those tools are more useful in the virt_test than they
are on autotest:

 * cd_hash.py: Tool to get disk md5/sha1 sums from files
 * regression.py: Tool to analyze regression results
 * virt_disk.py: Tool to create virtual cds and floppies

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