virsh-domif-setlink-getlink: add backup and restore of vm xml config

We need to backup and restore the guest xml config because we are
modifying the guest. If we don't do this, every other test will fail
because we break the network and the guest is not reachable by
ssh client.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
libvirt: Supoort libvirt pool xml accessor

Signed-off-by: Yanbing Du <ydu@redhat.com>
libvirt: Add test for virsh pool-create command

Signed-off-by: Yanbing Du <ydu@redhat.com>
virttest.virsh: Add nodedev-{create, destroy} commands wrapper function

Signed-off-by: Alex Jia <ajia@redhat.com>
virttest.libvirt_xml.nodedev_xml: Add new elements and attribute

Signed-off-by: Alex Jia <ajia@redhat.com>
libvirt.tests: Add test cases for virsh nodedev-{create, destroy}

Signed-off-by: Alex Jia <ajia@redhat.com>
virsh: remove a result handle in vcpuinfo function.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
virttest.utils_net: Add openflow manager API for ovs bridge

Add a method to manager openflow rules.

Signed-off-by: Yunping Zheng <yunzheng@redhat.com>
qemu.test: add openflow test

This patch add general openflow rules set(drop, normal)
test for arp, icmp, ip, tcp and udp

Signed-off-by: Yunping Zheng <yunzheng@redhat.com>
virttest.qemu_vm: Use aobject instead of type for PCI bus

The pci bus assignement should be strictly defined. We should be able
to assign each device to the specific PCI bus. Currently only
'pci.0' bus is created by devices.machine_by_params() function.

Additionally correct the 'pci' type to the qemu matching ones (PCI, PCIE)

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.qemu_devices: Simplify qdev.insert (remove force)

The force insertion code is unused and unreadable. Let people
handle negative testing on their own and focus on the important
parts as device creation for now.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.qemu_devices: Allow bus to create additional devices on insert

This patch adds the possibility for bus to specify list of devices,
which needs to be plugged prior to the device. This enables us to
create internal autotest buses, which simulates complex behaviors
and it's going to be used for PCI switch definition.

Additionally this patch brings the possibility to specify list of devices
to be inserted instead just a simple device. Still when the insertion
fails the qdev remains unchanged.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.qemu_devices: Change match_bus policy

The match_bus in atest (soft) mode allowed atype to be mismatched.
This is not enough and the problem with other matching bus could
occur. Change this policy to match only 'type' thus other matching
buses might be found and strict_mode enforced during insert.

Additionally add support for multiple acceptable values (list, tuple).

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.qemu_devices: Support length definition for QPCIBus

This patch modifies the QSparseBus to use self.first_port to modify
the first usable port (there are many buses starting on port 1). This
function is used in QPCIBus to let user specify the first acceptable
port.

Also with this patch users are allowed to specify the PCI bus length.
(PCI bridge accepts only addresses 1-19)

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.qemu_devices: Always set properties of QPCIBus

PCI bridge must always set the device's PCI address. Instead of custom
behavior only for the bridges this patch forces strict_mode (set all
properties) for all QPCIBus buses.

This might bring some problems in the beginning, but it should help
us to test what we really want. So in the long-term this should
simplify testing and analyzing of failures.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.qemu_devices: Support for PCI RC/bridge/switch

This patch adds the support for various PCI root controllers, bridges and
switches.

PCI root controllers and bridges (and custom switches) work as normal
QPCIBus (with limited address ranges).

It's possible to say you want an automated x3130 switch. This switch
creates x3130-upstream port and for each inserted device
xio3130-downstream port. This is done automatically at any stage (during
hotplug). If you need different behavior (multiple devices on a single
switch port) you have to create the switch using your own x3130-upstream
and xio3130-downstream ports.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.qemu_vm: Add support for PCI RC/bridge/switch

This patch adds the support to define PCI root controllers, bridges and
switches via autotest params. The syntax is:

# controller names/objects
pci_controllers = "root.1 pci_bridge1"

# default pci_bus (all devices will be plugged here)
pci_bus = 'pci_bridge1'
# parent bus of root.1
pci_bus_root.1 = 'pci.0'
# parent bus of pci_bridge1
pci_bus_pci_bridge1 = 'root.1'
# type of root.1 controller (root controller ioh3420)
type_root.1 = 'ioh3420'
# type of pci_bridge1 (PCI2PCI bridge)
type_pci_bridge1 = 'pci-bridge'
virttest.qemu_devices: Docstring/PEP8/pylint fixes

Some pylint PEP8 fixups and additional docstrings.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
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>