virt.libvirt_vm: Fix get_pid() method

This is a fix for issue #473.

The current implementation of get_pid() in libvirt_vm is
reminiscent of the kvm_vm implementation, where self.process
is an expect object. In libvirt_vm, process is a PID (int),
therefore the same rules can't be applied. Re-create the
implementation in a cleaner way.

Signed-off-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virt.cfg: Update config of phyical_resources_check

RHEL5 guest doesn't have 'lscpu' cmd, so add special cpu info
checking cmd for it.

This patch also fixes a typo in cpu sockets checking cmd.

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
virt.kvm_vm: Fix a bug in cpu info generating code

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
virt.physical_resources_check: Fix typo

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virt.kvm_vm: Add nw interfaces to bridge unconditionally

This is a solution for issue #441.

In kvm_vm.create(), the process of attaching each one
of the nics on kvm_vm.virtnet currently happens only
if the nic doesn't have a tapfd key. However, on test
failure (and consequent vm destruction), this field
will continue to be filled up, therefore a new connection
to the bridge will never be stablished, making all
subsequent tests to fail.

However, the old networking code used to stablish the
network interface-bridge connection regardless of the
state of the nic, when create() is called. Applying the
same logic proved to be an effective solution for the
problem, therefore it's implemented on this patch.

CC: Chris Evich <cevich@redhat.com>
CC: Lukas Doktor <ldoktor@redhat.com>
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
kvm test: Separate virtio port class to library

* this patch separates class Port (handles virtio_console and
  virtio_serial_port) to framework library.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virt: Add support for virtio_serialport and console to framework

This patch adds support for virtio_serialport and virtio_console
to framework. Also it modifies virtio_console test to use this
framework.

params:
virtio_ports  -- space sepparated port names [""]
virtio_port_spread  -- spread consoles across multiple pcis [0]
                       when 0 it uses values from "virtio_port_bus"
                       when >0 it creates virtio_serial_pci for every
                       n-th virtual port
virtio_port_bus  -- which bus to use (integer) [0]

it extends VM structure:
self.virtio_ports  -- adds kvm_virtio_port objects during vm.create()

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virt: Move kvm_virtio_port related helpers from test to library

* This patch moves virtio_port related helpers from virtio_console test
  to kvm_virtio_port library.
* It also changes the way of VM handling and avoids unnecessarily VM
  recreation.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virt.kvm_virtio_port: Add GuestWorker (virtio_console_guest helper)

Class for executing virtio_console_guest on guest.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virt test: Use new framework features in virtio_console test

* use kvm_vm virtio_ports
* use GuestWorker
* use kvm_virtio_port functions
* use single execution (get rid of subtests)
* fix subtests.cfg.sample to suit new structure
* lots of test bugfixes
* docstring bugfixes
* few changes in params

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
ltp: Update to latest LTP 20120614.

This patch updates the version of LTP from 20120104 to 20120614.

It also adds the ksm tests to the skiplist, according to our findings
documented on github issue #462.

Signed-off-by: Vinson Lee <vlee@twitter.com>
Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
Signed-off-by: Cleber Rosa <crosa@redhat.com>
usb: fix get_free_usb_port

Use the controller_type passed in when looking for a free usb port, so
get_free_usb_port(something, "ehci") actually gets you a ehci port even
in case there is a uhci controller present.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb: use /dev/urandom not /dev/random

Otherwise dd will read whatever /dev/random has to offer at the moment
and the test file will be a few bytes instead of a megabyte in size.
usb: fix booting for usb-storage test

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb-storage: check for usb device resets in the kernel log

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb: update ids for usb-hub and usb-storage

usb-hub and usb-storage got non-zero IDs in upstream qemu.

usb-hub has 0409:55aa
usb-storage has 46f4:0001

Adapt config & testcases.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb: ehci companion setup

Add support for creating a ehci host controller with uhci
companion controllers, giving a usb bus which can handle
both usb 1.1 and usb 2 devices.  It is done automagically
when picking ich9-usb-ehci1 as usb controller type.

Using usb-ehci gives a standalone ehci controller which
can handle usb2 devices only.

Zap the usb host controller options (masterbus, firstport,
etc) which can be used to create a companion setup using
the config file.  It's incomplete anyway (can't set the
pci bus addr so there is no way to create a multifunction
device).

While being at it also zap the ehci freq property test,
it is gone in upstream qemu.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb: update install test

Remove the separare usb_cdrom test, just hook up both disk and
cdrom via usb in a single variant.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb: add support for usb1+usb3 drives

usb-storage connected via uhci / xhci.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb-storage: test with uhci, ehci and xhci.

Add uhci, ehci and xhci variants to all usb-storage tests.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>