qemu: Don't require a block or file when looking for an alias

This for example prohibits you to use iotune for Ceph or Sheepdog devices.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
Introduce a sub-element <driver> for controller

Like what we did for "disk", "filesystem" and "interface", this
introduces sub-element <driver> for "controller", and put the "queues"
into it.
doc: Clarify usage of SELinux baselabel

State what fields are used when generating SELinux labels from a
baselabel.
qemuBuildCommandLine: Don't overwrite errors with NWFilter's one

Currently, if there has been an error in building command line
process after virtual interfaces has been created, the flow jumps
to 'error' label, where virDomainConfNWFilterTeardown() is
called. This may report an error as well, but should not
overwrite the original cause why we jumped to 'error' label.
Add NVRAM device

For pSeries guest in QEMU, NVRAM is one kind of spapr-vio device.
Users are allowed to specify spapr-vio devices'address.
But NVRAM is not supported in libvirt. So this patch is to
add NVRAM device to allow users to specify its address.

In QEMU, NVRAM device's address is specified by
 "-global spapr-nvram.reg=xxxxx".

In libvirt, XML file is defined as the following:

  <nvram>
    <address type='spapr-vio' reg='0x3000'/>
  </nvram>

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
qemu: Add command line builder and parser for NVRAM.

This patch is to add command line builder and parser
for NVRAM device, and add test cases.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
qemu: Fix the indention

Pushed under trivial rule.
qemu: call post-parse callbacks when parsing command line too

Now we set the default disk driver name when parsing
the qemu command line too, hence all the test changes.

Assume format type is 'auto' when none is specified on
qemu command line.
conf: add PCI controllers

Add new controller type 'pci' with models 'pci-root' and 'pci-bridge'.
qemu: build command line for pci-bridge device

Signed-off-by: Ján Tomko <jtomko@redhat.com>
qemu: auto-add pci-root controller for pc machine types

<controller type='pci' index='0' model='pci-root'/>
is auto-added to pc* machine types.
Without this controller PCI bus 0 is not available and
no PCI addresses are assigned by default.

Since older libvirt supported PCI bus 0 even without
this controller, it is removed from the XML when migrating.
qemu: auto-add bridges and allow using them

Add a "dry run" address allocation to figure out how many bridges
will be needed for all the devices without explicit addresses.

Auto-add just enough bridges to put all the devices on, or up to the
bridge with the largest specified index.
qemu_conf: Don't discard strdup OOM error

After 78d7c3c5 we are strdup()-ing path to qemu-bridge-helper.
However, the check for its return value is missing. So it is
possible we've ignored the OOM error silently.
qemu_command.c: Fix whitespacing within for()

After 9d6e56db the syntax-check was unhappy due to wrong whitespacing:

  src/qemu/qemu_command.c:1637: for ( ; a.slot < QEMU_PCI_ADDRESS_SLOT_LAST; a.slot++) {
  maint.mk: incorrect whitespace around brackets, see HACKING for rules
  make: *** [bracket-spacing-check] Error 1
Fix usb master startport parsing

When all usb controllers connected to the same bus have <master
startport='x'/> specified, none of them have 'id=usb' assigned and
thus qemu fails due to invalid masterport specification (we use 'usb'
for that purpose).  Adding a check that at least one of the
controllers is specified without <master startport='x'/> and in case
this happens, error out due to invalid configuration.
fix typo introduced by 90430791

Signed-off-by: Bamvor Jian Zhang <bjzhang@suse.com>
qemu: auto-add pci-root to 'pc-i440*' machines too

Commit b33eb0d missed this machine type.
conf: reject controllers with duplicate indexes

Reject multiple controllers with the same index,
except for USB controllers.
Multi-function USB controllers can have the same index.
docs: fix memballoon examples

Use a pair of 'memballoon' tags instead of single 'watchdog' one.
Add a few missing colons.
qemu: fix build error with older platforms

Jim Fehlig reported on IRC that older gcc/glibc triggers this warning:

cc1: warnings being treated as errors
qemu/qemu_domain.c: In function 'qemuDomainDefFormatBuf':
qemu/qemu_domain.c:1297: error: declaration of 'remove' shadows a global declaration [-Wshadow]
/usr/include/stdio.h:157: error: shadowed declaration is here [-Wshadow]
make[3]: *** [libvirt_driver_qemu_impl_la-qemu_domain.lo] Error 1

Fix it like we have done in the past (such as commit 2e6322a).

* src/qemu/qemu_domain.c (qemuDomainDefFormatBuf): Avoid shadowing
a function name.

Signed-off-by: Eric Blake <eblake@redhat.com>