Commit Graph

5260 Commits

Author SHA1 Message Date
Peter Krempa
10e12c4009 tests: uri: Add test for urlencoded URIs
When specifying extra params for spcie TLS verification, it's necessary
to pass a weird URI to it. Let's add a test for this case where the TLS
string contains a space.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-06-12 09:26:25 +02:00
Peter Krempa
4977f19c54 tests: uri: Run all test cases on a single URI
Determine whether the test has failed after running all the cases so
that we don't need to rerun it multiple times to see all problems.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-06-12 09:26:25 +02:00
Peter Krempa
cd99bcf298 tests: uri: Use VIR_TEST_DEBUG instead of VIR_DEBUG
VIR_TEST_DEBUG can be easily made verbose in the tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-06-12 09:26:25 +02:00
Peter Krempa
b872422a9c tests: qemumonitorjson: Replace use of virReportError
Use VIR_TEST_VERBOSE instead. This fixes the following syntax check
problem:

tests/qemumonitorjsontest.c:1409:        virReportError(VIR_ERR_INTERNAL_ERROR, "arr should have been cleared");

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-06-12 09:19:25 +02:00
Eric Blake
fbb5271c78 backup: Add new parameters to qemu monitor nbd-server-add
The upcoming virDomainBackup() API needs to take advantage of the
ability to expose a bitmap as part of nbd-server-add for a pull-mode
backup (this is the recently-added QEMU_CAPS_NBD_BITMAP capability).

Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
2019-06-11 21:47:13 -05:00
Eric Blake
ad1c17c8d5 backup: Add new qemu monitor bitmap
The upcoming virDomainBackup() API needs to take advantage of various
qcow2 bitmap manipulations as the basis to virDomainCheckpoints and
incremental backups.  Add four functions to expose
block-dirty-bitmap-{add,enable,disable,merge} (this is the
recently-added QEMU_CAPS_BITMAP_MERGE capability).

Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
2019-06-11 21:47:10 -05:00
Eric Blake
6abda7a445 backup: Add two new qemu capabilities
Add two capabilities for testing features required for the upcoming
virDomainBackupBegin: use block-dirty-bitmap-merge as the generic
witness of bitmap support needed for checkpoints (since all of the
bitmap management functionalities were finalized in the same qemu 4.0
release), and the bitmap parameter to nbd-server-add for pull-mode
backup support.  Even though both capabilities are likely to be
present or absent together (that is, it is unlikely to encounter a
qemu that backports only one of the two), it still makes sense to keep
two capabilities as the two uses are orthogonal (full backups don't
require checkpoints, push mode backups don't require NBD bitmap
support, and checkpoints can be used for more than just incremental
backups).

Existing code is not affected by the new capabilities.

Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
2019-06-11 21:42:57 -05:00
Eric Blake
73bf0a9c28 backup: Prepare for Unix sockets in QMP nbd-server-start
Migration always uses a TCP socket for NBD servers, because we don't
support same-host migration. But upcoming pull-mode incremental backup
needs to also support a Unix socket, for retrieving the backup from
the same host. Support this by plumbing virStorageNetHostDef through
the monitor calls, since that is a nice reusable struct that can track
both TCP and Unix sockets.

Update qemumonitorjsontest to verify both forms of the QMP command.

Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
2019-06-11 21:41:42 -05:00
Eric Blake
1ddc7e0363 qemumonitorjsontest: Simplify returns
Time to remove the cleanup labels rendered useless in the previous
patch.  There are still plenty of other tests that could be further
simplified, but I've already spent enough time in this file for now.

Signed-off-by: Eric Blake <eblake@redhat.com>
2019-06-11 21:35:39 -05:00
Eric Blake
4b658bfe4b qemumonitorjsontest: Validate more commands against schema
The DO_TEST() macro in qemumonitorjsontest.c was not passing the
schema through, which meant that we were not validating any of those
tests for correct usage according to the schema.

In the process of mechanically altering tests to pass the schema
through, use VIR_AUTOPTR on all of the affected test instances. The
next patch will do some further cleanups that it exposes.

Tested by using this hack, where the test mistakenly passed pre-patch,
but correctly diagnosed the garbage post-patch:

| diff --git i/src/qemu/qemu_monitor_json.c w/src/qemu/qemu_monitor_json.c
| index 53a7de8b77..86d8450814 100644
| --- i/src/qemu/qemu_monitor_json.c
| +++ w/src/qemu/qemu_monitor_json.c
| @@ -1532,7 +1532,8 @@ qemuMonitorJSONGetStatus(qemuMonitorPtr mon,
|      if (reason)
|          *reason = VIR_DOMAIN_PAUSED_UNKNOWN;
|
| -    if (!(cmd = qemuMonitorJSONMakeCommand("query-status", NULL)))
| +    if (!(cmd = qemuMonitorJSONMakeCommand("query-status",
| +                                           "s:garbage", "foo", NULL)))
|          return -1;
|
|      if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)

Suggested-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
2019-06-11 21:35:24 -05:00
Eric Blake
09083437ff qemumonitorjsontest: Use VIR_AUTOPTR support
Simplify the GEN_TEST_FUNC() and target of the DO_TEST_SIMPLE() macros
by using autoptr support.

Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
2019-06-11 21:30:12 -05:00
Eric Blake
2ea60b6f7e qemumonitortestutils: Add VIR_AUTOPTR support
Upcoming tests are going to use VIR_AUTOPTR to simplify test cleanup.

Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
2019-06-11 20:53:50 -05:00
Peter Krempa
6f15c82fda tests: qemuhotplug: Use schema testing with qemuMonitorTestNewFromFileFull
Pass in the schema since it works with the 'file' test now.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2019-06-07 16:18:46 +02:00
Peter Krempa
1a77e0032b tests: Allow QMP schema testing in qemuMonitorTestNewFromFileFull
Pass in the schema data from the caller if QMP schema testing is
desired.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2019-06-07 16:18:45 +02:00
Peter Krempa
56c2f2b45b tests: qemu: Add QMP schema checking in qemuMonitorTestProcessCommandVerbatim
In case when we are testing a QMP command we can try to schema check it
so that we catch inconsistencies.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2019-06-07 16:18:45 +02:00
Peter Krempa
e4013f9ff7 tests: Refactor cleanup in qemuMonitorTestProcessCommandVerbatim
Use VIR_AUTOFREE and get rid of the cleanup section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2019-06-07 16:18:45 +02:00
Erik Skultety
08ad83eee1 tests: Fix parentheses order in an assignment-comparison conditional
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1717090

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2019-06-04 20:56:58 +02:00
Andrea Bolognani
1b2ac8010c util: Introduce virBitmapUnion()
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-06-04 09:29:35 +02:00
Jiri Denemark
02c1d3a6e1 qemuargv2xmltest: Use mocked virQEMUCapsProbeHostCPU
The qemuTestParseCapabilitiesArch call would eventually lead to the host
CPU being probed via virCPUGetHost. Let's divert this to a mocked
version already used by the qemuxml2argvtest.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2019-06-03 18:07:16 +02:00
Jiri Denemark
dd3fc650de qemu: Make virQEMUCapsProbeHostCPUForEmulator more generic
The function is renamed as virQEMUCapsProbeHostCPU and it does not get
the list of allowed CPU models from qemuCaps anymore. This is
responsibility is moved to the caller. The result is just a very thin
wrapper around virCPUGetHost mostly required mocking in tests.

The generic function is used in place of a direct call to virCPUGetHost
in virQEMUCapsInitHostCPUModel to make sure tests don't accidentally
probe host CPU.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2019-06-03 18:07:16 +02:00
Michal Privoznik
ec6ce6363a virSysinfoReadARM: Try reading DMI table
https://bugzilla.redhat.com/show_bug.cgi?id=1426162

Turns out, some aarch64 systems have SMBIOS info. That means we
can use dmidecode to fetch some information. If that fails, fall
back to the old behaviour.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2019-06-03 17:59:38 +02:00
Michal Privoznik
ac61c9cfc3 virsysinfo: Rename virSysinfoReadX86 to virSysinfoReadDMI
There's nothing x86 specific about this function. Rename the
function so that it has DMI suffix which enables it to be reused
on different arches (as using X86 from say ARM would look
suspicious).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2019-06-03 17:51:12 +02:00
Andrea Bolognani
667a373526 tests: Add aarch64-gigabyte sysinfo test case
This test case uses (anonimized) data pulled from a
GIGABYTE R120-T34 server.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-06-03 17:48:23 +02:00
Andrea Bolognani
43bc35ac1a tests: Tweak x86 sysinfo test case
We have a single mock dmidecode script right now, but we're
going to add another one soon, so we need to make sure its
name contains the test case name as a prefix, just like we
already do with all data files.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-06-03 17:46:03 +02:00
Andrea Bolognani
1462881f4e qemu: Format SMMUv3 IOMMU
https://bugzilla.redhat.com/show_bug.cgi?id=1575526

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-06-03 17:40:57 +02:00
Andrea Bolognani
60f4c41377 conf: Parse and format SMMUv3 IOMMU
SMMUv3 is an IOMMU implementation for ARM virt guests.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-06-03 17:40:48 +02:00
Andrea Bolognani
124eb803fc qemu: Introduce QEMU_CAPS_MACHINE_VIRT_IOMMU
This capability can be used to figure out whether the
QEMU binary at hand supports the machine type property
we need in order to enable SMMUv3 IOMMU support.

Unfortunately we can't avoid probing the RISC-V binaries
along with the ARM ones, since both architectures have
their own 'virt' machine type.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-06-03 17:40:45 +02:00
Jim Fehlig
76b420d003 build: fix linking libqemutestdriver with LTO enabled
openSUSE Factory is in the process of enabling Link Time Optimization [0]
and stumbled upon missing symbols when linking libqemutestdriver

libtool: link: gcc -shared  -fPIC -DPIC  ../src/libvirt_qemu_probes.o  \
-Wl,--whole-archive ../src/.libs/libvirt_driver_qemu_impl.a \
../src/.libs/libvirt_driver_network_impl.a \
../src/.libs/libvirt_driver_storage_impl.a -Wl,--no-whole-archive  \
-lcap-ng -lgnutls -lnl-route-3 -lnl-3 -ldbus-1 -lselinux -lapparmor \
/usr/lib/libxml2.so -ldl -lz -llzma -lm -lblkid -ltirpc  \
-fstack-protector-strong -O2 -fstack-protector-strong -flto=16 -g -O2 \
-fstack-protector-strong -flto=16 -g \
-Wl,-soname -Wl,libqemutestdriver.so -o .libs/libqemutestdriver.so
...
/usr/lib/gcc/i586-suse-linux/9/../../../../i586-suse-linux/bin/ld: ./.libs/libqemutestdriver.so: undefined reference to `mdir_name'
/usr/lib/gcc/i586-suse-linux/9/../../../../i586-suse-linux/bin/ld: ./.libs/libqemutestdriver.so: undefined reference to `rpl_ioctl'
/usr/lib/gcc/i586-suse-linux/9/../../../../i586-suse-linux/bin/ld: ./.libs/libqemutestdriver.so: undefined reference to `rpl_pipe2'
/usr/lib/gcc/i586-suse-linux/9/../../../../i586-suse-linux/bin/ld: ./.libs/libqemutestdriver.so: undefined reference to `recvfd'
/usr/lib/gcc/i586-suse-linux/9/../../../../i586-suse-linux/bin/ld: ./.libs/libqemutestdriver.so: undefined reference to `c_strcasecmp'

The missing symbols are provided by GNUlib. Add it when linking
libqemutestdriver.

[0] https://en.opensuse.org/openSUSE:LTO

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-05-30 09:09:10 -06:00
Daniel P. Berrangé
c6cbe18771 network: delay global firewall setup if no networks are running
Creating firewall rules for the virtual networks causes the kernel to
load the conntrack module. This imposes a significant performance
penalty on Linux network traffic. Thus we want to only take that hit if
we actually have virtual networks running.

We need to create global firewall rules during startup in order to
"upgrade" rules for any running networks created by older libvirt.
If no running networks are present though, we can safely delay setup
until the time we actually start a network.

Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-05-23 16:29:48 +01:00
Andrea Bolognani
a7a78c273e qemu: Introduce qemuDomainDeviceDefValidateIOMMU()
Device validation should not have to wait until command line
generation time. Moving the code to a separate function also
allows us to avoid some unnecessary repetition.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-23 15:19:01 +02:00
Andrea Bolognani
69a8c64f4b tests: Add negative test for Intel IOMMU
Make sure validation is working as intended by trying to use
Intel IOMMU with the i440fx machine type, though we know it's
a q35-only feature, and expecting an error to be returned.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-22 14:54:32 +02:00
Andrea Bolognani
5b0dcbcdef tests: Use DO_TEST_CAPS_*() for Intel IOMMU
We can drop the intel-iommu-machine test case while doing so,
since it is supposed to showcase how we generate different
command lines for older QEMU versions and we can do that
using a single input file now.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-22 14:54:32 +02:00
Andrea Bolognani
4a744b578d tests: Simplify Intel IOMMU testing
Remove a bunch of irrelevant devices and make sure all input
files explicitly opt out of USB controllers: the latter change
will help later, when we start using DO_TEST_CAPS_*().

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-22 14:54:32 +02:00
Peter Krempa
e90d51c4d0 qemu: monitor: Don't pass full flags to qemuMonitorJSONDriveMirror
Split out the 'shallow' and 'reuse' flags as booleans rather than passing
in flags and constructing them in irrelevant APIs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-21 14:22:06 +02:00
Peter Krempa
6b155c41e9 qemu: monitor: Don't pass full flags to qemuMonitorJSONBlockdevMirror
Split out the 'shallow' flag as a boolean argument rather than passing
in flags and constructing them in irrelevant APIs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-21 14:22:06 +02:00
Michal Privoznik
5cdd5d380b lib: Avoid double close when passing FDs with virCommandPassFD()
If an FD is passed into a child using:

  virCommandPassFD(cmd, fd, VIR_COMMAND_PASS_FD_CLOSE_PARENT);

then the parent should refrain from touching @fd thereafter. This
is even documented in virCommandPassFD() comment. The reason is
that either at virCommandRun()/virCommandRunAsync() or
virCommandFree() time the @fd will be closed. Closing it earlier,
e.g. right after virCommandPassFD() call might result in
undesired results. Another thread might open a file and receive
the same FD which is then unexpectedly closed by virCommandFree()
or virCommandRun().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-17 16:01:11 +02:00
Andrea Bolognani
a251095e13 qemu: Only probe available machine types
Since we know the full list of machine types supported
by the QEMU binary when probing machine type properties,
we can save some work (and eventually test suite churn,
as more architecture-specific machine types need to be
probed) by only probing machines that we know exist.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2019-05-17 14:59:40 +02:00
Andrea Bolognani
35e4c15326 tests: Refresh capabilities for QEMU on ppc64
Now that we're probing machine type properties using the
latest machine type rather than the "spapr-machine" parent,
we can finally discover properties that are not available
on all machine types.

This commit refreshes replies for QEMU 4.0.0 as well as
3.1.0 to show not only that we're actually discovering new
machine type properties this way, but also that the number
of available machine type properties increases with each
subsequent QEMU release.

If qom-list-properties had been available in QEMU 2.10.0,
we could now drop the explicit version number checks for
the QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT and
QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT capabilities, but
unfortunately it wasn't, so we have to keep them around
still.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2019-05-17 14:59:37 +02:00
Andrea Bolognani
d22c6221fc qemu: Probe canonicalized machine type
Now that we have the list of machine types available when
probing machine type properties, we can list properties for
the canonicalized version of the "pseries" machine type
instead of having to go through "spapr-machine", which we
know to be the parent type for all "pseries-*-machine"
types. By doing this, we'll be able to find even properties
that are only available from a certain versioned machine
type forward, and can't thus be obtained when looking at
the parent type only.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2019-05-17 14:59:34 +02:00
Andrea Bolognani
295a42e19f qemu: Move call to virQEMUCapsProbeQMPMachineProps()
We're going to need information about available machine types
when probing machine type properties soon, and that means we
have to change the order we call QMP commands.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2019-05-17 14:59:29 +02:00
Christian Ehrhardt
b51bfa7055
qemuxml2argvtest: add test for remove cpu features
CPU features that always were a no-op in qemu got removed there.
We no more specify them as that would trigger errors and fail to start
qemu. This test ensures that those features really are not rendered into
qemu command line.

Without the related fix this test will trigger and fail like:
 In 'tests/qemuxml2argvdata/cpu-no-removed-features.args':
 Offset 371
 Expect [ ]
 Actual [,-osxsave,-ospke ]

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Tested-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2019-05-15 09:33:03 +02:00
Christian Ehrhardt
2900575db8
qemu: do not define known no-op features
Qemu dropped cpu features for osxsave and ospke [1][2].
The reason for the instant removal is that those features were never
configurable as discussed in [3].

Fortunately the use cases adding those flags in the past are rare, but
they exist. One that I identified are e.g. older virt-install when used
with --cpu=host-model and there always could be the case of a user
adding it to the guest xml.

This triggers an issue like:
  qemu-system-x86_64: can't apply global Broadwell-noTSX-x86_64-
  cpu.osxsave=on: Property '.osxsave' not found

Ensure that this does no more break spawning newer qemu versions by
not rendering those features into the qemu command line.

Fixes: https://bugs.launchpad.net/fedora/+source/qemu/+bug/1825195
Resolves: https://bugzilla.redhat.com/1644848

[1]: https://git.qemu.org/?p=qemu.git;a=commit;h=f1a2352
[2]: https://git.qemu.org/?p=qemu.git;a=commit;h=9ccb978
[3]: https://www.mail-archive.com/qemu-devel@nongnu.org/msg561877.html

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Tested-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2019-05-15 09:32:52 +02:00
Jiri Denemark
538d873571 cpu_map: Define md-clear CPUID bit
CVE-2018-12126, CVE-2018-12127, CVE-2018-12130, CVE-2019-11091

The bit is set when microcode provides the mechanism to invoke a flush
of various exploitable CPU buffers by invoking the VERW instruction.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-05-14 19:33:37 +02:00
Jiri Denemark
5cd9db3ac1 cputest: Add data for Intel(R) Xeon(R) CPU E3-1225 v5
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-05-14 19:33:37 +02:00
Michal Privoznik
230243594e storagepoolxml2argvtest: Avoid double free
A double free may occur in testCompareXMLToArgvFiles() when @def
is freed right after virStoragePoolObjNew() failed and the second
time at cleanup label.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-05-14 15:58:37 +02:00
Eric Blake
57387ff54b snapshot: Make virDomainSnapshotDef a virObject
This brings about a couple of benefits:
- use of VIR_AUTOUNREF() simplifies several callers
- Fixes a todo about virDomainMomentObjList not being polymorphic enough

Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
2019-05-09 10:02:53 -05:00
Michal Privoznik
e1de5dd2ba virtestmock: Initialize symbols from stat() and its friends
Introduced by ff376c6283.

Previously, init_syms() was called from stat() mock and its
friends. This is crucial because checkPath() might call
printFile() which in turn calls real_fopen(). But if stat() or
one of its friends is the first function called then because of
lacking init_syms() call no real_* is initialized.

The other thing is that we really want the recorded action to be
"stat" instead of __FUNCTION__ because there's no good in
recording that it was __xstat64 who touched some file.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2019-05-07 11:01:14 +02:00
Michal Privoznik
dd5ae5f240 virfilemock: Init symbols in canonicalize_file_name()
If a program that is using this mock calls canonicalize_file_name()
as the very first function then it will face SIGSEGV because
real_canonicalize_file_name is uninitialized.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2019-05-07 09:56:17 +02:00
Eric Blake
1ec3e39742 conf: Add parameter to virDomainDiskSourceFormat
Commits 4bc42986 and 218c81ea removed virDomainStorageSourceFormat on
the grounds that there were no external callers; however, the upcoming
backup code wants to output a <target> (push mode) or <scratch> (pull
mode) element that is in all other respects identical to a domain's
<source> element, where the previous virDomainStorageSourceFormat fit
the bill nicely. But rather than reverting the commits, it's easier to
just add an additional parameter for the element name to use, and
update all callers.

Signed-off-by: Eric Blake <eblake@redhat.com>
2019-05-06 18:05:17 -05:00
Boris Fiuczynski
6b4aea5e4d tests: domaincaps: Add QEMU 4.0.0 for s390x
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2019-05-06 14:49:26 +02:00