Commit Graph

5136 Commits

Author SHA1 Message Date
Cole Robinson
6e64899284 qemu: Support vsock model=virtio-{non-}transitional
Add <vsock> model handling for virtio transitional devices. Ex:

  <vsock model='virtio-transitional'>
    ...
  </vsock>

* "virtio-transitional" maps to qemu "vhost-vsock-pci-transitional"
* "virtio-non-transitional" maps to qemu "vhost-vsock-pci-non-transitional"

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-03-04 11:08:41 -05:00
Cole Robinson
0f5958f5c5 qemu: Support memballoon model=virtio-{non-}transitional
Add new <memballoon> model values for virtio transitional devices. Ex:

  <memballoon model='virtio-transitional'/>

* "virtio-transitional" maps to qemu "virtio-balloon-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-balloon-pci-non-transitional"

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-03-04 11:08:41 -05:00
Cole Robinson
62eef965ba qemu: Support filesystem model=virtio-{non-}transitional
Add <filesystem> model handling for virtio transitional devices. Ex:

  <filesystem type='mount' model='virtio-transitional'>
    ...
  </filesystem

* "virtio-transitional" maps to qemu "virtio-9p-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-9p-pci-non-transitional"

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-03-04 11:08:41 -05:00
Cole Robinson
947448e212 conf: Add <filesystem model='virtio-{non-}transitional'/>
<filesystem> devices lack the model= attribute which is used by
most other device types. To eventually support
virtio-9p-pci-{non-}traditional in qemu, let's add a standard
model= attribute. The accepted values are:

- virtio
- virtio-transitional
- virtio-non-transitional

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-03-04 11:08:41 -05:00
Cole Robinson
e063707556 qemu: Support rng model=virtio-{non-}transitional
Add new <rng> model values for virtio transitional devices. Ex:

  <rng model='virtio-transitional'>
    ...
  </rng>

* "virtio-transitional" maps to qemu "virtio-rng-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-rng-pci-non-transitional"

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-03-04 11:08:41 -05:00
Cole Robinson
37f75d56da qemu: Support hostdev model=virtio-{non-}transitional
Add <hostdev> protocol=vhost model handling for virtio transitional
devices. Ex:

  <hostdev mode='subsystem' type='scsi_host' model='virtio-transitional'>
    <source protocol='vhost' wwpn=X/>
  </hostdev>

* "virtio-transitional" maps to qemu "vhost-scsi-pci-transitional"
* "virtio-non-transitional" maps to qemu "vhost-scsi-pci-non-transitional"

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-03-04 11:08:40 -05:00
Cole Robinson
ef41ff4219 conf: Add <hostdev model='virtio-{non-}transitional'/>
qemu vhost-scsi devices map to XML roughly like:

    <hostdev mode='subsystem' type='scsi_host'>
      <source protocol='vhost' wwpn=X/>
    </hostdev>

To support vhost-scsi-pci-{non-}traditional in qemu, we
need to to extend the SCSI Host hostdev XML to handle
model= value. This matches the XML model= format used
for mediated devices. This is just the domain_conf bits
and some XML test cases.

Use of virtio-X naming here does not match the hostdev
protocol=vhost nor does it match the qemu vhost-X device
naming, however it's more consistent with all other
model= names in this area, and also matches the
inconsistency of <vsock> devices which use model=virtio
but map to vhost-vsock on the qemu commandline

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-03-04 11:08:40 -05:00
Cole Robinson
4d964373b5 qemu: Support interface model=virtio-{non-}transitional
Add new <interface> model handling for virtio transitional devices. Ex:

<interface>
  <model type='virtio-transitional'/>
</interface>

* "virtio-transitional" maps to qemu "virtio-net-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-net-pci-non-transitional"

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-03-04 11:08:40 -05:00
Cole Robinson
239b535d99 qemu: Support disk model=virtio-{non-}transitional
Add new <disk> model values for virtio transitional devices. When
combined with bus='virtio':

* "virtio-transitional" maps to qemu "virtio-blk-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-blk-pci-non-transitional"

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-03-04 11:08:40 -05:00
Cole Robinson
25d05051b3 conf: Add <disk model='virtio-{non-}transitional'/>
<disk> devices lack the model= attribute which is used by
most other device types. bus= mostly acts as one, but it
serves other purposes too like determing what target=
prefix to use, and for matching against controller type=
values.

Extending bus= to handle additional virtio transitional
devices will complicate apps lives, and it isn't a clean
mapping anyways. So let's bite the bullet and add a new
<disk model=X/> attribute, and wire up common handling
for virtio and virtio-{non-}transitional

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-03-04 11:08:40 -05:00
Cole Robinson
f15111f65c qemu: capabilities: Add virtio/vhost {non-}transitional
Add a single QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL that
will be set if any of the following qemu devices are found:

    virtio-blk-pci-transitional
    virtio-blk-pci-non-transitional
    virtio-net-pci-transitional
    virtio-net-pci-non-transitional
    vhost-scsi-pci-transitional
    vhost-scsi-pci-non-transitional
    virtio-rng-pci-transitional
    virtio-rng-pci-non-transitional
    virtio-9p-pci-transitional
    virtio-9p-pci-non-transitional
    virtio-balloon-pci-transitional
    virtio-balloon-pci-non-transitional
    vhost-vsock-pci-transitional
    vhost-vsock-pci-non-transitional
    virtio-input-host-pci-transitional
    virtio-input-host-pci-non-transitional
    virtio-scsi-pci-transitional
    virtio-scsi-pci-non-transitional
    virtio-serial-pci-transitional
    virtio-serial-pci-non-transitional

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-03-04 11:08:40 -05:00
Eric Blake
5817dec014 virsh: Elide backslash-newline in batch mode
The previous patch made it possible to split multiple commands by
adding newline, but not to split a long single command. The sequence
backslash-newline was being used as if it were a quoted newline
character, rather than completely elided the way the shell does.

Again, add more tests, although this time it seems more like I am
suffering from a leaning-toothpick syndrome with all the \.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2019-02-26 15:42:21 -06:00
Eric Blake
fe1b683fd0 virsh: Treat \n like ; in batch mode
I wanted to do a demonstration with virsh batch mode, which
takes multiple commands all packed into a single argument:

$ virsh -c test:///default 'echo a; echo b;'
a
b

but that produced a really long line, so I tried to make it
more legible:

$ virsh -c test:///default '
   echo a;
   echo b;
'
error: unknown command: '
'

Let's be more like the shell, and treat unquoted newline as a
command separator just as we do for semicolon.  In fact, with
that, I can even now mix styles:

$ virsh -c test:///default '
   echo a; echo b
   echo c
'
a
b
c

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2019-02-26 14:16:04 -06:00
Diego Michelotto
d163b940a7 virfile: added GPFS as shared fs
Added GPFS as shared file system recognized during live migration
security checks.

GPFS is 'IBM General Parallel File System' also called
'IBM Spectrum Scale'

BUG: https://bugzilla.redhat.com/show_bug.cgi?id=1679528

Signed-off-by: Diego Michelotto <diego.michelotto@cnaf.infn.it>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-26 11:41:18 +01:00
Roman Bogorodskiy
e9528f41c6 bhyve: implement ignore unknown MSRs feature
Implement the MSRs ignore unknown reads and writes feature
that's specified using:

  <features>
    ...
    <msrs unknown='ignore'>
    ...
  </features>

in the domain XML.

In bhyve, it's just passing '-w' command line argument to the bhyve(8)
executable.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-02-24 13:20:51 +04:00
Jiri Denemark
ac5d4e6cb0 cputest: Use python3 in CPU parser scripts
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-22 18:41:19 +01:00
Jiri Denemark
78b148c3c8 cputest: Adapt scripts to split cpu_map
The tests/cputestdata/cpu-parse.sh script has been broken since the
cpu_map.xml file was split into several XMLs.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-22 18:41:19 +01:00
David Kiarie
cb6a46364b src/xenconfig: update copyright notice
Signed-off-by: David Kiarie <davidkiarie4@gmail.com>
2019-02-22 12:52:25 +00:00
Peter Krempa
55ee6ac8de util: buffer: Introduce VIR_AUTOCLEAN function for virBuffer
virBuffer is almost always stack-allocated, but requires freeing of the
internals on error. Introduce a VIR_AUTOCLEAN function to deal with
this.

Along with the addition add a test which would leak the buffer contents
if it weren't autocleaned.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2019-02-22 10:05:45 +01:00
Peter Krempa
e25492444f util: buf: Remove virBufferEscapeN
The function was used only in the tests, remove it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2019-02-22 10:05:45 +01:00
Peter Krempa
3d6ba96ff6 tests: buf: Fix debug messages in 'testBufEscapeRegex'
The messages reference testBufEscapeN instead of testBufEscapeRegex.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2019-02-22 10:05:45 +01:00
Laine Stump
82fe58ff26 network: add netmask to dhcp range of dnsmasq conf file for IPv4
dnsmasq documentation says that the *IPv4* prefix/network
address/broadcast address sent to dhcp clients will be automatically
determined by dnsmasq by looking at the interface it's listening on,
so the original libvirt code did not add a netmask to the dnsmasq
commandline (or later, the dnsmasq conf file).

For *IPv6* however, dnsmasq apparently cannot automatically determine
the prefix (functionally the same as a netmask), and it must be
explicitly provided in the conf file (as a part of the dhcp-range
option). So many years after IPv4 DHCP support had been added, when
IPv6 dhcp support was added the prefix was included at the end of the
dhcp-range setting, but only for IPv6.

A user had reported a bug on a host where one of the interfaces was a
superset of the libvirt network where dhcp is needed (e.g., the host's
ethernet is 10.0.0.20/8, and the libvirt network is 10.10.0.1/24). For
some reason dnsmasq was supplying the netmask for the /8 network to
clients requesting an address on the /24 interface.

This seems like a bug in dnsmasq, but even if/when it gets fixed
there, it looks like there is no harm in just always adding the
netmask to all IPv4 dhcp-range options similar to how prefix is added
to all IPv6 dhcp-range options.

Signed-off-by: Laine Stump <laine@laine.org>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2019-02-21 13:06:16 -05:00
Michal Privoznik
740aeb349f testutils: Explicitly name virTestCompare*() arguments
Currently, some arguments are called strcontent and strsrc, or
content and src or some other combination. This makes it
impossible to see at the first glance what argument is supposed
to represent 'expected' value and which one represents 'actual'
value. Rename the arguments to make it obvious.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-20 15:54:41 +01:00
Michal Privoznik
9de317d0d1 virTestCompareToULL: Rename local variables
The current naming makes it hard for me to see which holds the
expected value and which holds the actual value. Rename them to
make it obvious.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-20 15:54:31 +01:00
Michal Privoznik
86d1f08669 virTestCompareToULL: Use VIR_AUTOFREE()
In order to save a few lines of code, and also since it's hype
let's use VIR_AUTOFREE() for the two strings we allocate there.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-20 15:53:32 +01:00
Chris Venteicher
5b13da5ca2 qemu_process: Enter QMP command mode when starting QEMU Process
qemuProcessQMPStart starts a QEMU process and monitor connection that
can be used by multiple functions possibly for multiple QMP commands.

The QMP exchange to exit capabilities negotiation mode and enter command
mode can only be performed once after the monitor connection is
established.

Move responsibility for entering QMP command mode into the
qemuProcessQMP code so multiple functions can issue QMP commands in
arbitrary orders.

This also simplifies the functions using the connection provided by
qemuProcessQMPStart to issue QMP commands.

Test code now needs to call qemuMonitorSetCapabilities to send the
message to switch to command mode because the test code does not use the
qemuProcessQMP command that internally calls qemuMonitorSetCapabilities.

Signed-off-by: Chris Venteicher <cventeic@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-19 18:44:49 +01:00
Peter Krempa
44601a0e96 util: Replace virStorageSourceFree with virObjectUnref
Now that virStorageSource is a subclass of virObject we can use
virObjectUnref and remove virStorageSourceFree which was a thin wrapper.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-02-18 10:31:21 +01:00
Peter Krempa
e1c01b2252 util: Remove the AUTOPTR func for virStorageSource
Since virStorageSource is now a subclass of virObject, we can use
VIR_AUTOUNREF instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-02-18 10:31:21 +01:00
Peter Krempa
dcda2bf4c1 util: Introduce function for allocating virStorageSource
Add virStorageSourceNew and refactor places allocating that structure to
use the helper.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-02-18 10:27:30 +01:00
Michal Privoznik
fa5db009c9 virkmodtest: Don't fail if modprobe doesn't exist
On some very basic installations (e.g. some container images) the
modprobe binary might be missing. If that is the case, don't fail
virkmodtest.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-02-14 18:03:10 +01:00
Michal Privoznik
17ddfd420a qemuhotplugtest: Test guestfwd attach and detach
Previous two commits demonstrate a hole in our test scenario.
Fix that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2019-02-14 09:22:17 +01:00
Michal Privoznik
18b8f67745 qemuL: Drop "user-" prefix for guestfwd netdev
Introduced by d86c876a66.

There is no real need to have "user-" prefix for chardev.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2019-02-14 09:18:31 +01:00
John Ferlan
bf688a0067 util: Introduce VIR_DEFINE_AUTOPTR_FUNC for virStorageSource
Let's make use of the auto __cleanup capabilities cleaning up any
now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-12 13:19:26 -05:00
John Ferlan
bc096fc4a2 tests: Fix memory leak in testCompareXMLToArgvFiles
Only one path will consume the @def; otherwise, we need to free it.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-12 13:11:36 -05:00
John Ferlan
9916f2a3c8 tests: Rename variable in testStorageFileGetMetadata
To prepare for subsequent change to use VIR_AUTOPTR logic rename
the @ret to @def.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-12 08:51:23 -05:00
John Ferlan
5f02df444b tests: Use VIR_AUTOFREE for various storage tests
Let's make use of the auto __cleanup capabilities cleaning up any
now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-12 08:51:23 -05:00
John Ferlan
9a4199304f storage: Use VIR_AUTOPTR(virCommand)
Let's make use of the auto __cleanup capabilities cleaning up any
now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-12 08:51:23 -05:00
John Ferlan
2f92d59c78 conf: Introduce VIR_DEFINE_AUTOPTR_FUNC for virStoragePoolDef
Let's make use of the auto __cleanup capabilities cleaning up any
now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-12 08:51:23 -05:00
John Ferlan
1f20da92d8 conf: Introduce VIR_DEFINE_AUTOPTR_FUNC for virStorageVolDef
Let's make use of the auto __cleanup capabilities cleaning up any
now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-12 08:51:23 -05:00
Ján Tomko
b4a4e8f71a qemu: do not format <usedQMP/> in qemu caps XML
Since commit a7424faff QMP is always used.

Also, commit 932534e8 removed the last use of this apart from:
* parsing/formatting this in the caps cache
* using it as a temporary variable to know when to report an error

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2019-02-12 14:02:38 +01:00
Ján Tomko
b419ea6a90 vsh-table: allow empty columns
Trivially implement this by deleting the bogus check in
vshTableSafeEncode.

Now it returns an empty string for an empty string instead
of returning NULL without setting an error.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-02-12 10:14:53 +01:00
Ján Tomko
865b201479 vshtabletest: indent strings with expected output
Indent them by four spaces from the previous line, instead of starting
at columnn zero.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-02-12 10:14:53 +01:00
Cole Robinson
b79885b7f7 tests: domcaps: Remove dependency on libxl PVUSB support
Mock out libxlCapsHasPVUSB to always return true, so test results
aren't dependent on host libxl version

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-02-11 17:40:44 -05:00
Cole Robinson
deb3b59b74 tests: Create a shared library with libxl driver
This allows us to mock functions in the libxl driver, like
is already possible for the qemu driver

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-02-11 17:40:44 -05:00
Cole Robinson
49a0bcfdf2 tests: Rename virmocklibxl.c -> libxlmock.c
Every other mock library is named ending in mock.c, move
virmocklibxl.c to follow that pattern

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-02-11 17:40:44 -05:00
Peter Krempa
22d7222ec0 qemu: caps: Don't call 'query-events' when we probe events from QMP schema
Avoid calling the command and fix test fallout.

https://bugzilla.redhat.com/show_bug.cgi?id=1673320

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 10:11:20 +01:00
Peter Krempa
850bb78a6e qemu: caps: Always assume QEMU_CAPS_DEVICE_TRAY_MOVED
The event was added by qemu commit 6f382ed226f3 released in v1.1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 10:11:20 +01:00
Peter Krempa
8c191a9061 qemu: caps: Always assume QEMU_CAPS_DEVICE_DEL_EVENT
DEVICE_DELETED was added in qemu commit 0402a5d65ec00 which was released
in v1.5.0.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 10:11:20 +01:00
Peter Krempa
458a3453da tests: qemuhotplug: Remove leftovers for non-event testing
DO_TEST_ATTACH and DO_TEST_ATTACH_EVENT now do the same thing so we can
remove the latter including the infrastructure.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 10:11:20 +01:00
Peter Krempa
eaaecd9f55 tests: qemuhotplug: Use DEVICE_DELETED event in all hotunplug tests
Currently all supported qemu versions now have support for the
DEVICE_DELETED event. This means that testing the old approach is a
waste of time.

Always add the QEMU_CAPS_DEVICE_DEL_EVENT capability in the hotplug test
and fix existing test cases.

The 'disk-virtio', 'disk-usb', 'disk-scsi', and 'disk-scsi-2' already
had variants that used the event, so the non-event variants will be
removed.

For all other cases the QMP_DEVICE_DELETED macro is used to add the
correct reply.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 10:11:20 +01:00
Peter Krempa
e29ae70ba7 tests: qemuhotplug: Remove unused test macro DO_TEST_DETACH_EVENT
This variant is unused as we create the object including capabilities
with DO_TEST_ATTACH_EVENT, which is then reused.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 10:11:20 +01:00
Peter Krempa
ea34af1f35 qemu: caps: Always assume QEMU_CAPS_SEAMLESS_MIGRATION
The event was added by qemu commit 2fdd16e239c2a2 released in v1.3.0.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 10:11:20 +01:00
Peter Krempa
3f2fa8f303 qemu: caps: Always assume QEMU_CAPS_BALLOON_EVENT
The event was added to qemu by commit 973603a813c5d60 which is contained
in the 1.2.0 release.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 10:11:19 +01:00
Peter Krempa
a1dce96236 qemu: Use the 'device_id' property of SCSI disks to avoid regressing
QEMU accidentally exposed the id of -drive (or same value as disk
serial, if provided) in one of the identifiers visible from the guest.

To avoid regression in case when -blockdev will be used we need to
always specify it ourselves.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 10:11:12 +01:00
Peter Krempa
85a8e364f3 qemu: caps: Introduce capability for 'device_id' property of 'scsi-disk'
The property allows to control the guest-visible content of the vendor
specific designator of the 'Device Identification' page of a SCSI
device's VPD (vital product data).

QEMU was leaking the id string of -drive as the value if the 'serial' of
the disk was not specified. Switching to -blockdev would impose an ABI
change.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:48:33 +01:00
Peter Krempa
8440f83529 test: qemucaps: Update caps with scsi 'device_id' property
Based on qemu commit 'v3.1.0-1445-ga61faa3d02'. Will allow checking
for the scsi 'device_id' property.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:48:33 +01:00
Peter Krempa
9222b402e5 tests: qemuxml2argv: Add a 'serial' value for a SCSI disk
Upcoming addition of a new field will need to make sure that SCSI disk
serial is tested as well. Add a case to one of the existing tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:48:33 +01:00
Peter Krempa
1328a830ce qemu: command: Drop formatting of 'media=cdrom' from -drive
For SCSI, IDE, and AHCI cdroms the appropriate device types which select
the correct media are used. In qemu there's one other code path that
looks at -drive media=cdrom in the XEN pv code. Thankfully we don't
support it with qemu (see qemuBuildDiskDeviceStr). All other devices
ignore it as the comment states, thus we can drop that code.

The test fallout is expectedly only in the test added for uncommon cdrom
types.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:48:33 +01:00
Peter Krempa
ea13c12940 tests: qemuxml2argv: Add CDROM disks for all untested buses
Add full and empty cdroms on 'usb' and 'sd' bus to have test
coverage. Note that this does not guarantee that qemu will accept them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:48:11 +01:00
Peter Krempa
5d884f3d3c qemu: Forbid cdroms on virtio bus
Attempting to create an empty virtio-blk drive results into:
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0xc,drive=drive-virtio-disk1,id=virtio-disk1: Device needs media, but drive is empty

Attempting to eject media from virtio-blk based drive results into:
error: internal error: unable to execute QEMU command 'eject': Device 'drive-virtio-disk0' is not removable

Forbid configurations where users would attempt to use cdroms in virtio
bus.

Fix few wrong examples which are not really relevant to the tested code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:41:40 +01:00
Peter Krempa
1dcba456fa qemu: caps: Always assume presence of 'ide-hd' and 'ide-cd' devices
The split of ide-disk into the two separate devices was introduced by
qemu commit 1f56e32a7f4b3 released in qemu v0.15.

Note that when compared to the previous commit which made sure that no
disk related tests were touched, in this case it's not as careful.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:34:17 +01:00
Peter Krempa
4bf49bc566 qemu: caps: Always assume presence of 'scsi-hd' and 'scsi-cd' device
The split of scsi-disk into the two separate devices was introduced by
qemu commit b443ae67 released in qemu v0.15.

All changes to test files are not really related to disk testing thanks
to previous refactors.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:34:17 +01:00
Peter Krempa
12116c018d tests: qemuxml2argv: Remove 'disk-virtio-scsi-ccw' test
It's a subset of 'iothreads-virtio-scsi-ccw'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:34:17 +01:00
Peter Krempa
76709a76ba tests: qemuxml2argv: Modernize virtio-scsi iothread tests
Use DO_TEST_CAPS_LATEST to obtain modern results.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:34:04 +01:00
Peter Krempa
253ddf5a75 tests: qemuxml2argv: Use 1.5.3 version for the oldest case of 'disk-cache'
Rather than testing random set of flags add a case also for the oldest
supported qemu.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:33:10 +01:00
Peter Krempa
61900c4cda tests: qemu: Merge 'disk-scsi-vscsi' test into 'disk-scsi'
As we support multiple scsi controllers there's no need to have a
special test for this controller.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:32:40 +01:00
Peter Krempa
ee39011a09 tests: qemu: Merge 'disk-scsi-mptsas1068' test into 'disk-scsi'
As we support multiple scsi controllers there's no need to have a
special test for this controller.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:32:40 +01:00
Peter Krempa
a11e333779 tests: qemu: Merge 'disk-scsi-megasas' test into 'disk-scsi'
As we support multiple scsi controllers there's no need to have a
special test for this controller.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:32:40 +01:00
Peter Krempa
7523e60a94 tests: qemuxml2argv: Modernize 'disk-scsi' test
Use DO_TEST_CAPS_LATEST rather than a predetermined set of caps.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:32:40 +01:00
Peter Krempa
566ada91d5 tests: qemu: Rename 'disk-scsi-device' to 'disk-scsi'
Drop the 'device' suffix which is quite pointless.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:32:40 +01:00
Peter Krempa
43620843fc tests: qemuxml2argv: Move cases from 'disk-shared-locking' into 'disk-shared'
The tests are for the same feature. Move all the cases to 'disk-shared'
case as it's already using DO_TEST_CAPS_LATEST

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:32:40 +01:00
Peter Krempa
fea4cdd2d2 tests: qemuxml2argv: Remove the 'after startup XML' testing machinery
A lot of code with no real impact and popularity. Remove all the helpers
now that the only test case is gone.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:32:40 +01:00
Peter Krempa
ee498250e7 tests: qemuxml2argv: Remove testing of post startup change to 'cachemode' for shared disks
Testing that the cachemode is properly recorded to the configuration
after startup does not add much value and overcomplicates the xml2argv
test.

Remove the 'disk-shared' test with old capabilities as the test with
real capabilities covers the code sufficiently.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:31:34 +01:00
Peter Krempa
98c128fd99 tests: qemuxml2argv: Use real caps when auto-generating SCSI controller type
Using an old strict set of capabilities is not of much use if a code
path would select a more modern controller by accident.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:31:15 +01:00
Peter Krempa
3eff4bc2c5 tests: qemuxml: Merge 'ioeventfd' variant of 'virtio-scsi' test into the common file
We don't need separate files for this test. Also modernize it in the
process.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:31:15 +01:00
Peter Krempa
7d1fc9f8d6 tests: qemuxml: Merge 'max_sectors' variant of 'virtio-scsi' test into the common file
We don't need separate files for this test. Also modernize it in the
process.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:31:15 +01:00
Peter Krempa
74a7d6fb2b tests: qemuxml: Merge 'cmd_per_lun' variant of 'virtio-scsi' test into the common file
We don't need separate files for this test. Also modernize it in the
process.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:31:15 +01:00
Peter Krempa
ab5c7dbee3 tests: qemuxml: Merge 'num-queues' variant of 'virtio-scsi' test into the common file
We don't need separate files for this test. Also modernize it in the
process.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:31:15 +01:00
Peter Krempa
6d8be31f2a tests: qemu: Remove 'disk-scsi-virtio-scsi' test
Now that we have a specific test for testing the 'virtio-scsi'
controller and other tests which test a combination of scsi and non-scsi
devices this test no longer makes sense.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:31:15 +01:00
Peter Krempa
7a22fa7dce tests: qemuxml: Add a common test file for the 'virtio-scsi' controller
Add a file to aggregate testing for 'virtio-scsi' based on the modern
framework.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:31:02 +01:00
Peter Krempa
e67b6dcf36 qemu: capabilities: Probe caps for 'ide-hd' instead of 'ide-drive'
Since commit a4cda054e7 we are using 'ide-hd' and 'ide-cd' instead of
'ide-drive'. We also should probe capabilities for 'ide-hd' instead of
'ide-drive'. It is safe to do as 'ide-drive' is the common denominator
of both 'ide-hd' and 'ide-cd' so all the properties were common.

For now the test data are modified by just changing the appropriate type
when probing for caps.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:30:38 +01:00
Peter Krempa
7d114e1b72 qemu: capabilities: Probe caps for 'scsi-hd' instead of 'scsi-disk'
Since commit 02e8d0cfdf we are using 'scsi-hd' and 'scsi-cd' instead of
'scsi-disk'. We also should probe capabilities for 'scsi-hd' instead of
'scsi-disk'. It is safe to do as 'scsi-disk' is the common denominator
of both 'scsi-hd' and 'scsi-cd' so all the properties were common.

For now the test data are modified by just changing the appropriate type
when probing for caps.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:23:26 +01:00
Peter Krempa
aedd20386d tests: qemucaps: Make fake 'microcodeVersion' depend on filename instead of length
To avoid changes to the filled in microcode in case we change the caps
replies file for any reason make the number depend on the filename.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-02-08 08:23:26 +01:00
Andrea Bolognani
eeafebc51d tests: Unify qemucaps2xml output files
Turns out different versions of QEMU on the same architecture
produce the same output, so we can have a single output file
per architecture instead of duplicating the same data over and
over again.

Spotted-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-02-05 17:15:05 +01:00
Peter Krempa
3bc3cca7bb qemu: domain: Use 'raw' for 'volume' disks without format
Storage pools might want to specify format of the image when translating
the volume thus we can't add any default format when parsing the XML.

Add a explicit format when starting the VM and format is not present
neither by user specifying it nor by the storage pool translation
function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-04 13:42:11 +01:00
Peter Krempa
2f78ca803a qemu: domain: Assume 'raw' default storage format also for network storage
Post parse callback adds the 'raw' type only for local files. Remote
files can also have backing store (even local) so we should do this also
for network backed storage.

Note that virStorageFileGetMetadata always considers files with no type
as raw so we will not accidentally traverse the backing chain and allow
unexpected files being labelled with svirt labels.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-04 13:42:11 +01:00
Peter Krempa
6b618d2d5f tests: qemu: Test network disks without format specified explicitly
Modify some existing tests of network-based disks to omit the storage
format specification.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-04 13:42:11 +01:00
Peter Krempa
6db0d03383 qemu: command: Don't skip 'readonly' and throttling info for empty drive
In commit f80eae8c2a I was too agresive in removing properties of
-drive for empty drives. It turns out that qemu actually persists the
state of 'readonly' and the throttling information even for the empty
drive.

Removing 'readonly' thus made qemu open any subsequent images added via
the 'change' command as RW which was forbidden by selinux thanks to the
restrictive sVirt label for readonly media.

Fix this by formating the property again and bump the tests and leave a
note detailing why the rest of the properties needs to be skipped.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-02-04 09:49:37 +01:00
Cole Robinson
af36f8a641 Require a semicolon for VIR_ONCE_GLOBAL_INIT calls
Missing semicolon at the end of macros can confuse some analyzers
(like cppcheck <filename>). VIR_ONCE_GLOBAL_INIT is almost
exclusively called without an ending semicolon, but let's
standardize on using one like the other macros.

Add a dummy struct definition at the end of the macro, so
the compiler will require callers to add a semicolon.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-02-03 17:46:29 -05:00
Laine Stump
30a6f91686 network: allow configuring firewalld zone for virtual network bridge device
Since we're setting the zone anyway, it will be useful to allow
setting a different (custom) zone for each network. This will be done
by adding a "zone" attribute to the "bridge" element, e.g.:

   ...
   <bridge name='virbr0' zone='myzone'/>
   ...

If a zone is specified in the config and it can't be honored, this
will be an error.

Signed-off-by: Laine Stump <laine@laine.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-02-01 12:57:13 -05:00
Laine Stump
d8393b56e2 util: move all firewalld-specific stuff into its own files
In preparation for adding several other firewalld-specific functions,
separate the code that's unique to firewalld from the more-generic
"firewall" file.

Signed-off-by: Laine Stump <laine@laine.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-02-01 12:08:37 -05:00
Andrea Bolognani
bca2346641 tests: Update qemucaps2xml for QEMU 4.0.0 on x86_64
Commit fb0d0d6c54 added capabilities data and updated
qemucapabilitiestest but forgot to update qemucaps2xmltest
at the same time.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-01 12:28:32 +01:00
Andrea Bolognani
c5f92bf558 tests: Add test for PCI usage on RISC-V
This shows users can now use PCI for RISC-V guests, as long
as they opt into it by manually assigning addresses.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-01 11:57:52 +01:00
Andrea Bolognani
030f963129 tests: Add capabilities data for QEMU 4.0.0 on RISC-V
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-02-01 11:57:33 +01:00
Casey Callendrello
682be11505 network: set mtu as a DHCP option when specified
This adds an additional directive to the dnsmasq configuration file that
notifies clients via dhcp about the link's MTU. Guests can then choose
adjust their link accordingly.

Signed-off-by: Casey Callendrello <cdc@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-01-31 17:45:41 +01:00
Ján Tomko
6dec641394 storagepoolxml2argvtest: run mountopts test conditionally
This test relies on namespace support, which is only compiled in
if we have the 'fs' and 'netfs' backends.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2019-01-31 16:48:25 +01:00
Ján Tomko
55aa7ab182 storagepoolxml2argvtest: introduce DO_TEST_PLATFORM
Instead of repeating the same platform for every test,
set it once, since we do the same tests with the same
input for all platforms, it's just the output that differs.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2019-01-31 16:48:25 +01:00
Ján Tomko
f6b839f7b4 storagepoolxml2argvtest: pass the platform suffix as a string
Instead of a pair of bools.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2019-01-31 16:48:24 +01:00
John Ferlan
6c87c75a0c tests: Fix storagepoolxml2xmltest execution for XML namespaces
Only run the pool-netfs-ns-mountopts if built WITH_STORAGE_FS and only
run pool-rbd-ns-configopts if built with WITH_STORAGE_RBD since the
namespace support is only enabled if the pool is enabled.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-01-31 08:31:17 -05:00
Daniel P. Berrangé
4a8d9d4953 storage: change custom namespace URIs to drop '/source' component
The custom namespaces were originally registered against the storage
pool source struct, but during review this was changed to the top level
storage pool struct. The namespace URIs were not updated to match, so
had a redundant '/source' component.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-01-31 12:34:05 +00:00
John Ferlan
adb15b5add tests: Add storagepoolxml2argvtest source to EXTRA_DIST
Commit f2f84b4d4 added storagepoolxml2argvtest processing; however,
it didn't follow alter the else to !WITH_STORAGE and add the source
itself to the EXTRA_DIST like the other WITH_STORAGE options for
virstorageutiltest and storagevolxml2argvtest.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2019-01-30 10:35:28 -05:00
John Ferlan
406473990c tests: Fix build issue with storagevolxml2xmltest
Commit 7a227688a caused a build failure on mingw. Following
other uses of including ../src/libvirt_driver_storage_impl.la
I moved to under the WITH_STORAGE conditional.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2019-01-30 10:35:07 -05:00
John Ferlan
ab6ca81276 rbd: Utilize storage pool namespace to manage config options
Allow for adjustment of RBD configuration options via Storage
Pool XML Namespace adjustments. When namespace arguments are
used to start the pool, add a VIR_WARN to indicate that the
startup was tainted by custom config_opts.

Based off original patch/concept:

https://www.redhat.com/archives/libvir-list/2014-May/msg00940.html

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-01-29 19:16:25 -05:00
John Ferlan
ab995c1fe9 storage: Add storage pool namespace options to fs and netfs command lines
If the Storage Pool Namespace XML data exists, format the mount
options on the MOUNT command line and issue a VIR_WARN to indicate
that the storage pool was tainted by custom mount_opts.

When the pool is started, the options will be generated on the
command line along with the options already defined.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-01-29 19:16:19 -05:00
John Ferlan
7a227688a8 storage: Add infrastructure to manage XML namespace options
Introduce the virStoragePoolFSMountOptionsDef to be used to
manage the Storage Pool XML Namespace for mount options.

Using a new virStorageBackendNamespaceInit function, set the
virStoragePoolXMLNamespace into the _virStoragePoolOptions when
the storage backend is loaded.

Modify the storagepool.rng to allow for the usage of a different
XML namespace to parse the fs_mount_opts to be included with
the fs and netfs storage pool definitions.

Modify the storagepoolxml2xmltest to utilize a properly modified
XML file to parse and format the namespace for a netfs storage pool.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-01-29 19:16:13 -05:00
John Ferlan
3d3647e14f storage: Add the nfsvers to the command line
If protocolVer present, add the -o nfsvers=# to the command
line for the NFS Storage Pool

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-01-29 19:16:07 -05:00
John Ferlan
801f8cfb37 conf: Add optional NFS Source Pool <protocol ver='n'/> option
Add an optional way to define which NFS Server version will be
used to content the target NFS server.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-01-29 19:15:27 -05:00
John Ferlan
f00cde7f11 storage: Add default mount options for fs/netfs storage pools
https://bugzilla.redhat.com/show_bug.cgi?id=1584663

Modify the command generation to add some default options to the
fs/netfs storage pools based on the OS type. For Linux, it'll be
the "nodev, nosuid, noexec". For FreeBSD, it'll be "nosuid, noexec".
For others, just leave the options alone.

Modify the storagepoolxml2argvtest to handle the fact that the
same input XML could generate different output XML based on whether
Linux, FreeBSD, or other was being built.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-01-29 19:15:20 -05:00
Daniel P. Berrangé
7431b3eb9a util: move virtual network firwall rules into private chains
The previous commit created new chains to hold the firewall rules. This
commit changes the code that creates rules to place them in the new
private chains instead of the builtin top level chains.

With two networks running, the rules in the filter table now look like

  -N LIBVIRT_FWI
  -N LIBVIRT_FWO
  -N LIBVIRT_FWX
  -N LIBVIRT_INP
  -N LIBVIRT_OUT
  -A INPUT -j LIBVIRT_INP
  -A FORWARD -j LIBVIRT_FWX
  -A FORWARD -j LIBVIRT_FWI
  -A FORWARD -j LIBVIRT_FWO
  -A OUTPUT -j LIBVIRT_OUT
  -A LIBVIRT_FWI -d 192.168.0.0/24 -o virbr0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
  -A LIBVIRT_FWI -o virbr0 -j REJECT --reject-with icmp-port-unreachable
  -A LIBVIRT_FWI -d 192.168.1.0/24 -o virbr1 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
  -A LIBVIRT_FWI -o virbr1 -j REJECT --reject-with icmp-port-unreachable
  -A LIBVIRT_FWO -s 192.168.0.0/24 -i virbr0 -j ACCEPT
  -A LIBVIRT_FWO -i virbr0 -j REJECT --reject-with icmp-port-unreachable
  -A LIBVIRT_FWO -s 192.168.1.0/24 -i virbr1 -j ACCEPT
  -A LIBVIRT_FWO -i virbr1 -j REJECT --reject-with icmp-port-unreachable
  -A LIBVIRT_FWX -i virbr0 -o virbr0 -j ACCEPT
  -A LIBVIRT_FWX -i virbr1 -o virbr1 -j ACCEPT
  -A LIBVIRT_INP -i virbr0 -p udp -m udp --dport 53 -j ACCEPT
  -A LIBVIRT_INP -i virbr0 -p tcp -m tcp --dport 53 -j ACCEPT
  -A LIBVIRT_INP -i virbr0 -p udp -m udp --dport 67 -j ACCEPT
  -A LIBVIRT_INP -i virbr0 -p tcp -m tcp --dport 67 -j ACCEPT
  -A LIBVIRT_INP -i virbr1 -p udp -m udp --dport 53 -j ACCEPT
  -A LIBVIRT_INP -i virbr1 -p tcp -m tcp --dport 53 -j ACCEPT
  -A LIBVIRT_INP -i virbr1 -p udp -m udp --dport 67 -j ACCEPT
  -A LIBVIRT_INP -i virbr1 -p tcp -m tcp --dport 67 -j ACCEPT
  -A LIBVIRT_OUT -o virbr0 -p udp -m udp --dport 68 -j ACCEPT
  -A LIBVIRT_OUT -o virbr1 -p udp -m udp --dport 68 -j ACCEPT

While in the nat table:

  -N LIBVIRT_PRT
  -A POSTROUTING -j LIBVIRT_PRT
  -A LIBVIRT_PRT -s 192.168.0.0/24 -d 224.0.0.0/24 -j RETURN
  -A LIBVIRT_PRT -s 192.168.0.0/24 -d 255.255.255.255/32 -j RETURN
  -A LIBVIRT_PRT -s 192.168.0.0/24 ! -d 192.168.0.0/24 -p tcp -j MASQUERADE --to-ports 1024-65535
  -A LIBVIRT_PRT -s 192.168.0.0/24 ! -d 192.168.0.0/24 -p udp -j MASQUERADE --to-ports 1024-65535
  -A LIBVIRT_PRT -s 192.168.0.0/24 ! -d 192.168.0.0/24 -j MASQUERADE
  -A LIBVIRT_PRT -s 192.168.1.0/24 -d 224.0.0.0/24 -j RETURN
  -A LIBVIRT_PRT -s 192.168.1.0/24 -d 255.255.255.255/32 -j RETURN
  -A LIBVIRT_PRT -s 192.168.1.0/24 ! -d 192.168.1.0/24 -p tcp -j MASQUERADE --to-ports 1024-65535
  -A LIBVIRT_PRT -s 192.168.1.0/24 ! -d 192.168.1.0/24 -p udp -j MASQUERADE --to-ports 1024-65535
  -A LIBVIRT_PRT -s 192.168.1.0/24 ! -d 192.168.1.0/24 -j MASQUERADE

And finally the mangle table:

  -N LIBVIRT_PRT
  -A POSTROUTING -j LIBVIRT_PRT
  -A LIBVIRT_PRT -o virbr0 -p udp -m udp --dport 68 -j CHECKSUM --checksum-fill
  -A LIBVIRT_PRT -o virbr1 -p udp -m udp --dport 68 -j CHECKSUM --checksum-fill

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-01-29 13:37:11 +00:00
Daniel P. Berrangé
b092a4357d util: pass layer into firewall query callback
Some of the query callbacks want to know the firewall layer that was
being used for triggering the query to avoid duplicating that data.

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-01-29 13:35:58 +00:00
Michal Privoznik
6dd2a2ae63 virfile: Detect ceph as shared FS
https://bugzilla.redhat.com/show_bug.cgi?id=1665553

Ceph can be mounted just like any other filesystem and in fact is
a shared and cluster filesystem. The filesystem magic constant
was taken from kernel sources as it is not in magic.h yet.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-01-28 14:56:21 +01:00
Michal Privoznik
5772885d28 lib: Use more of VIR_STEAL_PTR()
We have this very handy macro called VIR_STEAL_PTR() which steals
one pointer into the other and sets the other to NULL. The
following coccinelle patch was used to create this commit:

  @ rule1 @
  identifier a, b;
  @@

  - b = a;
    ...
  - a = NULL;
  + VIR_STEAL_PTR(b, a);

Some places were clean up afterwards to make syntax-check happy
(e.g. some curly braces were removed where the body become a one
liner).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-01-28 14:46:58 +01:00
Roman Bogorodskiy
0c8df11071 bhyve: implement support for commandline args
Implement support for passing custom command line arguments
to bhyve using the 'bhyve:commandline' element:

  <bhyve:commandline>
    <bhyve:arg value='-newarg'/>
  </bhyve:commandline>

 * Define virDomainXMLNamespace for the bhyve driver, which
   at this point supports only the 'commandline' element
   described above,
 * Update command generation code to inject these command line
   arguments between driver-generated arguments and the vmname
   positional argument.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2019-01-27 14:54:52 +04:00
Ján Tomko
c7e03df8c0 qemu: format CCID controllers after USB hubs
Since they go on the USB bus, format them after USB hubs.

https://bugzilla.redhat.com/show_bug.cgi?id=1375402

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-01-25 14:58:35 +01:00
Cole Robinson
0ba9786d8a qemu: Move <rng> validation out of qemu_command.c
Move the rng->model == VIRTIO check to parse time. This also
allows us to remove similar checks throughout the qemu driver

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-01-24 18:59:38 -05:00
Cole Robinson
ea72bc65df conf: Add virDomainNetIsVirtioModel
This will be extended in the future, so let's simplify things by
centralizing the checks.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-01-24 18:59:38 -05:00
Christian Ehrhardt
fb01e1a44d
virt-aa-helper: generate rules for gl enabled graphics devices
This adds the virt-aa-helper support for gl enabled graphics devices to
generate rules for the needed rendernode paths.

Example in domain xml:
<graphics type='spice'>
  <gl enable='yes' rendernode='/dev/dri/bar'/>
</graphics>

results in:
  "/dev/dri/bar" rw,

Special cases are:
- multiple devices with rendernodes -> all are added
- non explicit rendernodes -> follow recently added virHostGetDRMRenderNode
- rendernode without opengl (in egl-headless for example) -> still add
  the node

Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1757085

Reviewed-by: Erik Skultety <eskultet@redhat.com>
Acked-by: Jamie Strandboge <jamie@canonical.com>
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
2019-01-23 07:54:58 +01:00
Ján Tomko
2e2b0d69a9 qemu: add support for encrypted VNC TLS keys
Use the password stored in the secret driver under
the uuid specified by the vnc_tls_x509_secret_uuid
option in qemu.conf.

https://bugzilla.redhat.com/show_bug.cgi?id=1602418

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2019-01-22 12:18:28 +01:00
Cole Robinson
fb0d0d6c54 tests: Add capabilities data for QEMU 4.0.0 x86_64
The next release of QEMU is going to be 4.0.0. A bit early, but
this adds capabilities data for x86_64 from current qemu git
15bede554162dda822cd762c689edb6fa32b6e3b

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-01-21 17:29:10 -05:00
Peter Krempa
f80eae8c2a qemu: command: Don't format image properties for empty -drive
If a -drive has no image, using image properties makes qemu whine that
they should not be used.

This patch stops formating cache/readonly/... for empty drives
for the pre-blockdev syntax. Unfortunately those parameters can't be
added later when inserting media, but on the other hand qemu will start
with an empty drive.

Since we already were able to start a VM with such config previously due
to qemu ignoring them I've opted just to skip formatting them.
Additionally with -blockdev support it will work as expected as the
image properties will be formatted when adding the image itself which is
not possible without it.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1651457

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-01-21 17:04:26 +01:00
Peter Krempa
a641e044c1 tests: qemuxml2argv: Add test case for empty CDROM with cache mode
Upcomming change will influence CDROM with cache mode so add a test
case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-01-21 17:04:26 +01:00
Jiri Denemark
511df17aec cpu_map: Add support for arch-capabilities feature
The feature was added to QEMU in 3.1.0 and it is currently blocking
migration, which is expected to change in the future. Luckily 3.1.0 is
new enough to give us migratability hints on each feature via
query-cpu-model-expension, which means we don't need to use the
"migratable" attribute on the CPU map XML.

The kernel calls this feature arch_capabilities and RHEL/CentOS 7.* use
arch-facilities. Apparently some CPU test files were gathered with the
RHEL version of QEMU. Let's update the test files to avoid possible
confusion about the correct naming.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-01-10 16:39:57 +01:00
Eric Blake
1862a55462 maint: Prefer AM_CPPFLAGS over INCLUDES
Our use of INCLUDES in Makefile.am hearkens back to when we had to
cater to automake 1.9.6 (thanks, RHEL 5) which lacked AM_CPPFLAGS.
Modern Automake flags a warning that INCLUDES is deprecated, and
now that we mandate RHEL 7 or better (see commit c1bc9c66), we no
longer have to cater to the old spelling.  This change will also
make it easier to do per-binary CPPFLAGS.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-01-07 16:46:55 -06:00
Eric Blake
7a879323a9 maint: Drop unused GETTEXT_CPPFLAGS variable
Commit c0a8ea45 removed the use of gettextize, and the setting of
GETTEXT_CPPFLAGS, but did not scrub the now-unused variable from
Makefile.am snippets.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-01-07 16:45:45 -06:00
Michal Privoznik
c99e954973 Remove even more Author(s): lines from source files
In 600462834f we've tried to remove Author(s): lines
from comments at the beginning of our source files. Well, in some
files while we removed the "Author" line we did not remove the
actual list of authors.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-01-03 13:24:18 +01:00
Luyao Zhong
87c87f41f6 qemu: Add qemu command-line to generate the nvdimm unarmed property
According to the result parsing from xml, add the unarmed property
into QEMU command line:

-device nvdimm,...[,unarmed=on]

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2019-01-02 09:00:34 -05:00
Luyao Zhong
82576d8f35 qemu: Add command-line to generate the nvdimm pmem property
According to the result parsing from xml, add pmem property
into QEMU command line:

-object memory-backend-file,...[,pmem=on]

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2019-01-02 09:00:34 -05:00
Luyao Zhong
1fdcaac3d3 qemu: Add command-line to generate the nvdimm align property
According to the result parsing from xml, add align property
into QEMU command line:

-object memory-backend-file,...[,align=xxx]

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2019-01-02 09:00:34 -05:00
Luyao Zhong
900289b767 tests: Use DO_TEST_CAPS_LATEST for nvdimm qemuxml2argv
Deprecate DO_TEST to do nvdimm qemuxml2argvdata tests, because
DO_TEST_CAPS_LATEST is a better choice. The DO_TEST needs
to specify all qemu capabilities and is not easy for scaling.

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2019-01-02 09:00:34 -05:00
Luyao Zhong
404766dbcc qemu: Introduce QEMU_CAPS_DEVICE_NVDIMM_UNARMED capability
This capability tracks if nvdimm has the unarmed attribute or not
for the nvdimm readonly xml attribute.

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2019-01-02 09:00:34 -05:00
Luyao Zhong
55b4fc78b6 qemu: Introduce QEMU_CAPS_OBJECT_MEMORY_FILE_PMEM capability
This capability tracks if memory-backend-file has the pmem
attribute or not.

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2019-01-02 09:00:34 -05:00
Luyao Zhong
e9b28cc9bc qemu: Introduce QEMU_CAPS_OBJECT_MEMORY_FILE_ALIGN capability
This capability tracks if memory-backend-file has the align
attribute or not.

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2019-01-02 09:00:34 -05:00
Luyao Zhong
db521e7d03 conf: Introduce 'readonly' element into xml for NVDIMM memory
The 'readonly' option allows users to mark vNVDIMM read-only:

<devices>
  ...
  <memory model='nvdimm' access='shared'>
      <source>
          <path>/dev/dax0.0</path>
      </source>
      <target>
          <size unit='MiB'>4094</size>
          <node>0</node>
          <label>
              <size unit='MiB'>2</size>
          </label>
          <readonly/>
      </target>
  </memory>
  ...
</devices>

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2019-01-02 09:00:34 -05:00
Luyao Zhong
73fc8c491e conf: Introduce 'pmem' element into xml for NVDIMM memory
The 'pmem' option allows users to specify whether the backend
storage of memory-backend-file is a real persistent memory:

<devices>
  ...
  <memory model='nvdimm' access='shared'>
      <source>
          <path>/dev/dax0.0</path>
          <pmem/>
      </source>
      <target>
          <size unit='MiB'>4094</size>
          <node>0</node>
          <label>
              <size unit='MiB'>2</size>
          </label>
      </target>
  </memory>
  ...
</devices>

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2019-01-02 09:00:29 -05:00
Luyao Zhong
80d1ed9773 conf: Introduce 'alignsize' element into xml for NVDIMM memory
NVDIMM emulation will mmap the backend file, it uses host pagesize
as the alignment of mapping address before, but some backends may
require alignments different from the pagesize. So the 'alignsize'
option is introduced to allow specification of the proper alignment:

<devices>
  ...
  <memory model='nvdimm' access='shared'>
      <source>
          <path>/dev/dax0.0</path>
          <alignsize unit='MiB'>2</alignsize>
      </source>
      <target>
          <size unit='MiB'>4094</size>
          <node>0</node>
          <label>
              <size unit='MiB'>2</size>
          </label>
      </target>
  </memory>
  ...
</devices>

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2019-01-02 09:00:24 -05:00
Michal Privoznik
1e63dea999 tests: Introduce qemusecuritytest
This test checks if security label remembering works correctly.
It uses qemuSecurity* APIs to do that. And some mocking (even
though it's not real mocking as we are used to from other tests
like virpcitest). So far, only DAC driver is tested.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-12-19 15:32:43 +01:00
John Ferlan
44d0db011d tests: Fix possible NULL derefs in virErrorTestMsgs
Add guards to avoid calling strchr when @err_noinfo == NULL or
calling virErrorTestMsgFormatInfoOne when @err_info == NULL as
both would fail with a NULL deref.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Peter Krempa <pkrempa@redhat.com>
2018-12-18 10:12:09 -05:00
Daniel P. Berrangé
3dc3e58b32 tests: ignore XML files starting with a .
If an editor has an XML file open, it may create a temporary . file. The
existance of this file will cause the virschematest to fail, so just
skip these editor temp files.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-12-18 14:49:46 +00:00
Michal Privoznik
29682196d8 Drop UML driver
The driver is unmaintained, untested and severely broken for
quite some time now. Since nobody even reported any issue with it
let us drop it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2018-12-17 17:52:46 +01:00
Jiri Denemark
eb1b551d21 cpu: Add support for "stibp" x86_64 feature
QEMU commit v3.1.0-4-g0e89165829
KVM patch: https://lore.kernel.org/lkml/20181205191956.31480-1-ehabkost@redhat.com/

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-12-17 17:27:32 +01:00
Daniel P. Berrangé
07c9d6601d qemu: use line breaks in command line args written to log
The QEMU command line arguments are very long and currently all written
on a single line to /var/log/libvirt/qemu/$GUEST.log. This introduces
logic to add line breaks after every env variable and "-" optional
argument, and every positional argument. This will create a clearer log
file, which will in turn present better in bug reports when people cut +
paste from the log into a bug comment.

An example log file entry now looks like this:

  2018-12-14 12:57:03.677+0000: starting up libvirt version: 5.0.0, qemu version: 3.0.0qemu-3.0.0-1.fc29, kernel: 4.19.5-300.fc29.x86_64, hostname: localhost.localdomain
  LC_ALL=C \
  PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin \
  HOME=/home/berrange \
  USER=berrange \
  LOGNAME=berrange \
  QEMU_AUDIO_DRV=none \
  /usr/bin/qemu-system-ppc64 \
  -name guest=guest,debug-threads=on \
  -S \
  -object secret,id=masterKey0,format=raw,file=/home/berrange/.config/libvirt/qemu/lib/domain-33-guest/master-key.aes \
  -machine pseries-2.10,accel=tcg,usb=off,dump-guest-core=off \
  -m 1024 \
  -realtime mlock=off \
  -smp 1,sockets=1,cores=1,threads=1 \
  -uuid c8a74977-ab18-41d0-ae3b-4041c7fffbcd \
  -display none \
  -no-user-config \
  -nodefaults \
  -chardev socket,id=charmonitor,fd=23,server,nowait \
  -mon chardev=charmonitor,id=monitor,mode=control \
  -rtc base=utc \
  -no-shutdown \
  -boot strict=on \
  -device qemu-xhci,id=usb,bus=pci.0,addr=0x1 \
  -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
  -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
  -msg timestamp=on
  2018-12-14 12:57:03.730+0000: shutting down, reason=failed

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-12-17 15:02:11 +00:00
Daniel P. Berrangé
912c6b22fc util: require command args to be non-NULL
The virCommand APIs do not expect to be given a NULL value for an arg
name or value. Such a mistake can lead to execution of the wrong
command, as the NULL may prematurely terminate the list of args.
Detect this and report suitable error messages.

This identified a flaw in the storage test which was passing a NULL
instead of the volume path. This flaw was then validated by an incorrect
set of qemu-img args as expected data.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-12-17 14:43:33 +00:00
Peter Krempa
d9baf0d75b tests: Add test for virErrorMsg message constraints
Make sure that we don't add any broken error message strings any more.

This ensures that both the version with and without additional info is
populated, the version without info does not have any formatting
modifiers and the version with info has exactly one.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2018-12-14 13:56:53 +01:00
Daniel P. Berrangé
568a417224 Enforce a standard header file guard symbol name
Require that all headers are guarded by a symbol named

  LIBVIRT_$FILENAME

where $FILENAME is the uppercased filename, with all characters
outside a-z changed into '_'.

Note we do not use a leading __ because that is technically a
namespace reserved for the toolchain.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-12-14 10:47:13 +00:00
Daniel P. Berrangé
4cfd709021 Fix many mistakes & inconsistencies in header file layout
This introduces a syntax-check script that validates header files use a
common layout:

  /*
   ...copyright header...
   */
  <one blank line>
  #ifndef SYMBOL
  # define SYMBOL
  ....content....
  #endif /* SYMBOL */

For any file ending priv.h, before the #ifndef, we will require a
guard to prevent bogus imports:

  #ifndef SYMBOL_ALLOW
  # error ....
  #endif /* SYMBOL_ALLOW */
  <one blank line>

The many mistakes this script identifies are then fixed.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-12-14 10:46:53 +00:00
John Ferlan
e6f53e7a4b storage: Fix build issue with MOUNT and VGCHANGE commands
Turns out there some build platforms that must not define MOUNT
or VGCHANGE in config.h... So moving the commands from the storage
backend specific module into a common storage_util module causes
issues for those platforms.

So instead of assuming they are there, let's just pass the command
string to the storage util API's from the storage backend specific
code (as would have been successful before).  Also modify the test
to determine whether the MOUNT and/or VGCHANGE doesn't exist and
just define it to (for example) what Fedora has for the path. Could
have just used "mount" and "vgchange" in the call, but that defeats
the purpose of adding the call to virTestClearCommandPath.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2018-12-13 12:42:36 -05:00
Daniel P. Berrangé
600462834f Remove all Author(s): lines from source file headers
In many files there are header comments that contain an Author:
statement, supposedly reflecting who originally wrote the code.
In a large collaborative project like libvirt, any non-trivial
file will have been modified by a large number of different
contributors. IOW, the Author: comments are quickly out of date,
omitting people who have made significant contribitions.

In some places Author: lines have been added despite the person
merely being responsible for creating the file by moving existing
code out of another file. IOW, the Author: lines give an incorrect
record of authorship.

With this all in mind, the comments are useless as a means to identify
who to talk to about code in a particular file. Contributors will always
be better off using 'git log' and 'git blame' if they need to  find the
author of a particular bit of code.

This commit thus deletes all Author: comments from the source and adds
a rule to prevent them reappearing.

The Copyright headers are similarly misleading and inaccurate, however,
we cannot delete these as they have legal meaning, despite being largely
inaccurate. In addition only the copyright holder is permitted to change
their respective copyright statement.

Reviewed-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-12-13 16:08:38 +00:00
John Ferlan
e0eb8a8a69 secret: Add check/validation for correct usage when LookupByUUID
https://bugzilla.redhat.com/show_bug.cgi?id=1656255

If virSecretGetSecretString is using by secretLookupByUUID,
then it's possible the found sec->usageType doesn't match the
desired @secretUsageType. If this occurs for the encrypted
volume creation processing and a subsequent pool refresh is
executed, then the secret used to create the volume will not
be found by the storageBackendLoadDefaultSecrets which expects
to find secrets by VIR_SECRET_USAGE_TYPE_VOLUME.

Add a check to virSecretGetSecretString to avoid the possibility
along with an error indicating the incorrect matched types.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2018-12-13 10:22:25 -05:00
John Ferlan
a15fe1247d storage: Add tests for logical backend startup
Add the logical storage pool startup validation (xml2argv) tests.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2018-12-13 07:09:42 -05:00
John Ferlan
515aa0c184 tests: Add storagepool xml test for netfs-auto
Cover the case where @netauto would be used to create the command
line in virStorageBackendFileSystemMountCmd. Essentially when the
pool type is "netfs", but the "source.format" is empty, create the
command line properly.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2018-12-13 07:09:42 -05:00
John Ferlan
f2f84b4d4a tests: Introduce tests for storage pool xml to argv checks
Similar to qemuxml2argv and storagevolxml2argv, let's create some
tests to ensure that the XML generates a consistent command line.

Using the same list of pools as storagepoolxml2xmltest, start with
the file system tests (fs, netfs, netfs-cifs, netfs-gluster).

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2018-12-13 07:09:42 -05:00
Michal Privoznik
c658764dec qemu: Don't use -mem-prealloc among with .prealloc=yes
https://bugzilla.redhat.com/show_bug.cgi?id=1624223

There are two ways to request memory preallocation on cmd line:
-mem-prealloc and .prealloc attribute for a memory-backend-file.
However, as it turns out it's not safe to use both at the same
time. If -mem-prealloc is used then qemu will fully allocate the
memory (this is done by actually touching every page that has
been allocated). Then, if .prealloc=yes is specified,
mbind(flags = MPOL_MF_STRICT | MPOL_MF_MOVE) is called which:

a) has to (possibly) move the memory to a different NUMA node,
b) can have no effect when hugepages are in play (thus ignoring user
request to place memory on desired NUMA nodes).

Prefer -mem-prealloc as it is more backward compatible
compared to switching to "-numa node,memdev=  + -object
memory-backend-file".

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-12-13 09:55:38 +01:00
Erik Skultety
dd45c2710f conf: domain: gfx: Iterate over graphics devices when doing validation
The QEMU validation code for graphics has been in place for a while, but
because it is only executed from virDomainDeviceInfoIterateInternal, it
was never run, since the iterator expects the device to have boot info
which graphics don't have. The unfortunate side effect of this whole mess
was that a few capabilities were missing from the test suite (as commit
d8266ebe1 demonstrated with graphics-spice-invalid-egl-headless test),
which in turn meant that a few graphics tests which expected a failure
happily accepted any failure the test runtime returned which made them
succeed. The impact of this was that we then allowed to start a domain
with multiple OpenGL-enabled graphics devices.

This patch enables iteration over graphics devices. Unsurprisingly,
a few tests started to fail as a result, so fix those too.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-12-12 15:12:35 +01:00
Erik Skultety
0d5244cc86 tests: Introduce negative versions of DO_TEST_CAPS_LATEST
It's fairly easy to forget to add a capability to the list of
capabilities for a negative test case which might yield (for us) very
unfortunate results. Therefore, introduce negative versions of
DO_TEST_CAPS_LATEST macros, so that real QEMU caps can be used with
tests that expect a failure too.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-12-12 15:12:35 +01:00
Julio Faracco
daf4e2abca tests: Adding test case to include multiple network definitions.
This commit includes a test case for multiple network definitions. It is
useful right now, but it will be more useful when the index used by LXC
version 3.X is implemented to support this new settings. The version 3.X
is using indexes to specify each network settings.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2018-12-11 15:03:08 -05:00
Daniel P. Berrangé
081bdb4d68 tests: fix dry run handling in network firewall test
The networkxml2firewalltest sets virCommand to dry run mode but doesn't
provide a callback to fill in stdout/stderr. As a result when the
firewall code queries rules it gets a NULL output and so never triggers
the callback to process output.

This trivial change just returns an empty string for the command output
in order to ensure the callback gets triggered. It has no effect right
now, but in future patches this will trigger greater test coverage.

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-12-07 15:45:51 +00:00
Daniel P. Berrangé
0367524b4f tests: remove duplicated test case in networkxml2firewalltest
Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-12-07 15:45:51 +00:00
Jim Fehlig
0a1b565382 xenconfig: add support for openvswitch configuration
Add support for converting openvswitch interface configuration
to/from libvirt domXML and xl.cfg(5). The xl config syntax for
virtual interfaces is described in detail in the
xl-network-configuration(5) man page. The Xen Networking wiki
also contains information and examples for using openvswitch
in xl.cfg config format

https://wiki.xenproject.org/wiki/Xen_Networking#Open_vSwitch

Tests are added to check conversions of openvswitch tagged and
trunked VLAN configuration.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2018-12-06 15:05:16 -07:00
Peter Krempa
eed7b205c4 tests: qemuxml2argv: Remove disks from few tests which don't need them
Remove the disk from tests focusing on other aspects so that change to
-blockdev will touch less tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-12-05 17:53:26 +01:00
Peter Krempa
0ba4da5871 tests: qemuxml2xml: Add few debug statements for status XML testing
Add markers for allowing test debugging if one of the steps fails
without setting a proper error.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-12-05 17:53:26 +01:00
Yuri Chornoivan
e5c1fbca24 Fix minor typos in messages and docs
Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-12-05 10:39:54 +01:00
Erik Skultety
3163de7d0e qemu: command: gfx: egl-headless: Add 'rendernode' option to the cmdline
Depending on whether QEMU actually supports the option, we can put the
'rendernode' on the '-display egl-headless' cmdline.

https://bugzilla.redhat.com/show_bug.cgi?id=1628892

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-12-03 14:58:31 +01:00
Erik Skultety
5f931fe391 conf: gfx: egl-headless: Introduce a new <gl> subelement
Unlike with SPICE and SDL which use the <gl> subelement to enable OpenGL
acceleration, specifying egl-headless graphics in the XML has
essentially the same meaning, thus in case of egl-headless we don't have
a need for the 'enable' element attribute and we'll only be interested
in the 'rendernode' one further down the road.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-12-03 14:56:08 +01:00
Erik Skultety
312063b766 qemu: caps: Introduce QEMU_EGL_HEADLESS_RENDERNODE capability
Now that we have QAPI introspection of display types in QEMU upstream,
we can check whether the 'rendernode' option is supported with
egl-headless display type.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-12-03 14:56:08 +01:00
Erik Skultety
27cc9f6ac1 qemu: process: spice: Pick the first available DRM render node
Up until now, we formatted 'rendernode=' onto QEMU cmdline only if the
user specified it in the XML, otherwise we let QEMU do it for us. This
causes permission issues because by default the /dev/dri/renderDX
permissions are as follows:

crw-rw----. 1 root video

There's literally no reason why it shouldn't be libvirt picking the DRM
render node instead of QEMU, that way (and because we're using
namespaces by default), we can safely relabel the device within the
namespace.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-12-03 14:56:08 +01:00
Stefan Schallenberg
41cc4ca107 Add armv6l Support as guest
Support for armv6l qemu guests has been added.
Tested with arm1176 CPU on x86.

Signed-off-by: Stefan Schallenberg <infos@nafets.de>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-12-03 14:31:41 +01:00
Andrea Bolognani
022c4b7a9c tests: Sync qemucaps2xml with qemucapabilities
Commits d7434ae800 and 9c4afbda34 added replies files for
QEMU 3.0.0 on s390x and QEMU 3.1.0 on x86_64 respectively, but
only enabled the corresponding test in qemucapabilities and not
in qemucaps2xml.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-11-29 15:24:03 +01:00
Erik Skultety
9c4afbda34 test: caps: Add capabilities for QEMU 3.1.0
These are based on QEMU v3.1.0-rc2-41-g4822f1ee9e.

Acked-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
2018-11-29 08:54:01 +01:00
Simon Kobyda
071488983c vsh-table: Get rid of trailing spaces
Get rid of trailing spaces which can be found after last column in tables.

Signed-off-by: Simon Kobyda <skobyda@redhat.com>
2018-11-28 13:18:48 +01:00
Andrea Bolognani
c54d3d00ae qemu: Format nested-hv feature on the command line
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-11-27 17:12:21 +01:00
Andrea Bolognani
bfa2bd7e38 conf: Parse and format nested-hv feature
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-11-27 17:12:19 +01:00
Andrea Bolognani
0029eace52 qemu: Introduce QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-11-27 17:12:18 +01:00
Andrea Bolognani
e95bcd8d18 tests: Add capabilities data for QEMU 3.1.0 on ppc64
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-11-27 17:12:15 +01:00
Marek Marczykowski-Górecki
6262ea7148 xenconfig: add support for type="pvh"
Handle PVH domain type in both directions (xen-xl->xml, xml->xen-xl).
And add a test for it.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2018-11-26 16:38:26 -07:00
Marek Marczykowski-Górecki
494fa1fd1b xenconfig: add support for parsing type= xl config entry
builder="hvm" is deprecated since Xen 4.10, new syntax is type="hvm" (or
type="pv", which is default). Since the old one is still supported,
still use it when writing native config, so the config will work on
older Xen too (and will also not complicate tests).

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2018-11-26 16:34:55 -07:00
Marek Marczykowski-Górecki
45ea5688ab tests: add basic Xen PVH test
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2018-11-26 16:33:25 -07:00
John Ferlan
9aec374b01 qemu: Detect whether iothread polling is supported
Add a capability check for IOThread polling (all were added at the
same time, so only one check is necessary).

Based on code originally posted by Pavel Hrdina <phrdina@redhat.com>
with the only changes to include the more recent QEMU releases.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2018-11-19 07:26:40 -05:00
Michal Privoznik
b3a3759b62 Revert "virlockspace: Allow caller to specify start and length offset in virLockSpaceAcquireResource"
This reverts commit afd5a27575.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-11-16 13:42:39 +01:00
Michal Privoznik
0aad10cdae Revert "security_manager: Load lock plugin on init"
This reverts commit 3e26b476b5.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-11-16 13:42:39 +01:00
Marc-André Lureau
24b74d187c qemu: add memfd source type
Add a new memoryBacking source type "memfd", supported by QEMU (when
the capability is available).

A memfd is a specialized anonymous memory kind. As such, an anonymous
source type could be automatically using a memfd. However, there are
some complications when migrating from different memory backends in
qemu (mainly due to the internal object naming at this point, but
there could be more). For now, it is simpler and safer to simply
introduce a new source type "memfd". Eventually, the "anonymous" type
could learn to use memfd transparently in a separate change.

The main benefits are that it doesn't need to create filesystem files,
and it also enforces sealing, providing a bit more safety.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-11-16 08:57:12 +01:00
Marc-André Lureau
a6fd5b596a qemu: check memory-backend-memfd.hugetlb capability
QEMU 3.1 should only expose the property if the host is actually
capable of creating hugetable-backed memfd. However, it may fail
at runtime depending on requested "hugetlbsize".

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-11-16 08:57:12 +01:00
Marc-André Lureau
21b18ea5d9 qemu: add memory-backend-memfd capability check
Check availability of "-object memory-backend-memfd".

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-11-16 08:57:12 +01:00
Yi Min Zhao
9d6be3ff79 qemu: Generate and use zPCI device in QEMU command line
Add new functions to generate zPCI command string and append it to
QEMU command line. And the related tests are added.

Signed-off-by: Yi Min Zhao <zyimin@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-11-15 12:32:18 +01:00
Yi Min Zhao
e6565d54db qemu: Add zPCI address definition check
We should ensure that QEMU supports zPCI when a zPCI address is defined
in XML and otherwise report an error. This patch introduces a generic
validation function qemuDomainDeviceDefValidateAddress() which calls
qemuDomainDeviceDefValidateZPCIAddress() if address type is PCI address.

Signed-off-by: Yi Min Zhao <zyimin@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-11-15 12:32:18 +01:00
Yi Min Zhao
b4833b2c2f conf: Introduce parser, formatter for uid and fid
This patch introduces new XML parser/formatter functions. Uid is
16-bit and non-zero. Fid is 32-bit. They are the two attributes of zpci
which is introduced as PCI address element. Zpci element is parsed and
formatted along with PCI address. And add the related test cases.

Signed-off-by: Yi Min Zhao <zyimin@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-11-15 12:32:18 +01:00
Yi Min Zhao
29ad952f7e qemu: Introduce zPCI capability
Let's introduce zPCI capability.

Signed-off-by: Yi Min Zhao <zyimin@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-11-15 12:32:17 +01:00
Vitaly Kuznetsov
362b4ee616 qemu: add support for Hyper-V Enlightened VMCS
QEMU 3.1 supports Hyper-V Enlightened VMCS feature which significantly
speeds up nested Hyper-V on KVM environments.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
2018-11-15 09:54:57 +01:00
Vitaly Kuznetsov
1c596f4964 qemu: add support for Hyper-V PV IPIs
QEMU 3.1 supports Hyper-V-style PV IPIs making it cheaper for Windows
guests to send an IPI, especially when it targets many CPUs.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
2018-11-15 09:54:57 +01:00
Julio Faracco
83405f92a9 tests: Adding tests cases to cover rebased settings for LXC 3.0.
This commit includes new test cases to cover LXC version 3.0 and higher.
This LXC version rebased some settings entries and deprecated other ones.
As we support both, we should include tests to minimize problems with
integration between them.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-11-14 15:00:43 -05:00
John Ferlan
99b8ef7a98 tests: Augment vcgrouptest to add virCgroupGetMemoryStat
Add a test to fetch the GetMemoryStat output. This only gets
data for v1 only right now since the v2 data from commit 61ff6021
is rather useless returning all 0's. The v1 data was originally
added in commit d1452470.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2018-11-14 14:45:02 -05:00
Wang Huaqiang
a5c4e705a5 conf: Introduce cache monitor element in cachetune
Introducing <monitor> element under <cachetune> to represent
a cache monitor.

Signed-off-by: Wang Huaqiang <huaqiang.wang@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-11-14 12:18:46 -05:00
John Ferlan
4608af30f9 tests: Use correct function name in error path
Commit id 5eb61e6846 neglected to change the name in the wrong value
output to virCgroupGetPercpuStats from virCgroupGetMemoryUsage.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2018-11-07 18:18:42 -05:00
Michal Privoznik
c0790e3a09 virfile: Take symlink into account in virFileIsSharedFixFUSE
https://bugzilla.redhat.com/show_bug.cgi?id=1640465

Weirdly enough, there can be symlinks in the path we are trying
to fix. If it is the case our clever algorithm that finds matches
against mount table won't work. Canonicalize path at the
beginning then.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2018-10-19 13:15:54 +02:00
Michal Privoznik
641a95c9b6 qemu: Put format=raw onto cmd line for SCSI passthrough
https://bugzilla.redhat.com/show_bug.cgi?id=1632833

When doing a SCSI passthrough we don't put format= onto the
command line. This causes qemu to probe the format automatically
which ends up in a warning in the domain log and possible qemu
disabling writes to the first block (according to the warning
message).

Based-on-work-of: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2018-10-17 09:16:20 +02:00
Ján Tomko
4c64768e8f tests: use real capabilities for net-vhostuser
Commit ed5aa85f37
    qemu: don't use chardev FD passing for vhostuser backend
altered the legacy DO_TEST macro.

Run the test against capabilities of QEMU 2.5.0 (which did not
support QEMU_CAPS_CHARDEV_FD_PASS) as well as the latest version.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-10-15 13:13:29 +02:00
Ján Tomko
ccad7b5888 tests: add virtio-rng-egd-unix
Test RNG devices connected to EGD via UNIX sockets.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-10-15 13:13:29 +02:00
Ján Tomko
818e9a3b90 tests: add usb-redir-unix
Test USB redirdevs backed by UNIX sockets.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-10-15 13:13:29 +02:00
Ján Tomko
91750d8564 tests: add console-virtio-unix
Test a virtio console backed by a UNIX socket.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-10-15 13:13:29 +02:00
Ján Tomko
8e0266d5bb tests: add channel-unix-guestfwd
Test guestfwd channels backed by UNIX sockets.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-10-15 13:13:29 +02:00
Ján Tomko
9ed91bed4e tests: add parallel-unix-chardev
Test creating a parallel port backed by a UNIX socket.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-10-15 13:13:29 +02:00