virttest.qemu_devices: Support for default parameter in device.get_param

similarily to dictionary support the default return in case the key is
not found.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.qemu_devices: Support bus.reserve(addr) to reserve the addr

We might reserve particular address. This address will not be used for
devices, which won't ask for the exact address.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.qemu_devices: Define first_port for each addr item

first_port of each addr item might be different. Implement it as
list of integers instead of just integer.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.qemu_devices: Support for DevContainer.get_by_properties()

This function returns the devices filtered by the dictionary of
properties (and values)

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.qemu_devices: Support for multifunction PCI devices

PCI bus supports multifunction devices compound of upt o 8 devices
on the same PCI addr. This patch adds the support for subaddress
into the qdev representation.

Function is not incremented by default so new devices are still set
to the new PCI slot. But when you define addr with '.' function is set
and used in the representation.

In order to be closer to qtree representation this patch also changes
the addr string to '%02x.%x'.

Last but not least PCI bus changed from QDenseBus to QSparseBus as
lots of the addresses are unused and this way the representation is more
readable.

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

Addopt the QPCISwitchBus to create the structure on-the-fly in the same
maner as the user would create the bus. The difference is that this way
we'll be able to follow the qtree structure without any hooks.

From now each new port means new PCI bus inserted into the representation.
Users are allowed to add additional ports whenever they want.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.qemu_devices: Support PCI addre reservation

This patch brings the possibility to specify addresses, which should
be reserved for furthure use by specifying "reserved_slots = ...".
Those addresses won't be assigned by default and will be accepted only
when the device would ask for this specific address.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.qemu_devices: Use multifunction devs to create ehci usbc

ehci usb controller is compound by 4 devices. Previously only the 0st
one was added into the representation. Now when QPCIBus supports
multifunction add all of them.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.qemu_devices: Set all of the machine PCI devices

Add all of the PCI devices which are added by the -M into PCI
representation.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.qemu_qtree: Fix the corrupted id:

Some devices in qtree had corrupted IDs. This occured because the line
is now striped before use.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
qemu.tests.pci_devices: Add test of pci devices

This test boots VM with a define set of PCI devices and compares
the qtree and internal representation.

In the future this test should also check the operation system view
of the devices (lspci or the windows equivalent)

The testing setup is done via graphical representation of the setup.
Note that the number of spaces is irelevant. The location is defined
by the number of '->' characters. You can verify the setup in the test.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.qemu_devices_unittest.py: Update unittest to suit the changes

There were lot's of changes so please accept this single unittest
update instead of incremental one.

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