Commit Graph

33033 Commits

Author SHA1 Message Date
Michal Privoznik
d55be92286 virsh: Don't leak disk targets in cmdDomBlkError
The virDomainGetDiskErrors() API copies disk targets into @disks
array that we allocate. But we forgot to free it:

==140828== 16 bytes in 4 blocks are definitely lost in loss record 41 of 242
==140828==    at 0x4C2F08F: malloc (vg_replace_malloc.c:299)
==140828==    by 0x8C406D9: strdup (in /lib64/libc-2.28.so)
==140828==    by 0x5377DD3: virStrdup (virstring.c:966)
==140828==    by 0x54C112F: testDomainGetDiskErrors (test_driver.c:3068)
==140828==    by 0x55C863D: virDomainGetDiskErrors (libvirt-domain.c:10988)
==140828==    by 0x15D1FA: cmdDomBlkError (virsh-domain-monitor.c:1215)
==140828==    by 0x17F1A8: vshCommandRun (vsh.c:1335)
==140828==    by 0x13489E: main (virsh.c:920)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2019-05-13 14:34:11 +02:00
Ilias Stamatis
89320788ac test_driver: implement virDomainGetDiskErrors
Return the number of disks present in the configuration of the test
domain when called with @errors as NULL and @maxerrors as 0.

Otherwise report an error for every second disk, assigning available
error codes in a cyclic order.

Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2019-05-13 14:34:11 +02:00
Andrea Bolognani
4faaaa8b27 examples: Install under $(docdir)
Our build system doesn't currently install the various
example programs provided along libvirt; however, both the
upstream .spec file and the Debian packaging go out of
their way to make sure these useful demos are included in
the respective documentation packages.

Moreover, doing so without help from the upstream build
system is easy to get wrong: the libvirt-docs RPM package,
for example, ends up missing one of the examples and
including a bunch of empty .deps/ directories.

Install the examples in $(docdir) as part of our regular
procedure, so that users and downstreams don't have to do
anything special about them.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-05-13 12:02:17 +02:00
Andrea Bolognani
6716c997f6 docs: Install documentation under $(docdir)
At the moment we allow the user to specify exactly where
they want the HTML documentation to be installed with an
extreme level of precision through the --with-html-dir and
--with-html-subdir configure options.

Most of the time, of course, the user will stick with the
default, that is $(datadir)/doc/$(PACKAGE)-$(VERSION)/html.

So close to $(docdir)! Including the version number in
the path, specifically, seems entirely unnecessary since
different releases of libvirt are not going to be able to
coexist on the same system anyway.

Drop all these custom flexibilty for flexibilty's sake
shenaningans in favor of the standard, well understood
$(docdir).

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-05-13 12:02:13 +02:00
Andrea Bolognani
ca6f602546 docs: Introduce $(devhelphtml_generated)
Our XSLT magic generates one Devhelp-compatible HTML file
per documentation module, but so far we have only shipped
and installed documentation for virterror.

Now that we have $(modules), however, we can generate the
list of files the same way we do for regular documentation
and make sure we always ship and install everything.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-05-13 12:02:11 +02:00
Andrea Bolognani
78b748b94b docs: Introduce $(modules)
This variable contains a lists of documentation modules,
in a neutral format.

Right now is only used to define $(apihtml_generated), but
later on we're gonna reuse it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-05-13 12:02:04 +02:00
Eric Blake
9dd5bc151c qemu: Fix regression with undefine --snapshots-metadata
In refactoring the snapshot code to prepare for checkpoints, I changed
qemuDomainMomentDiscardAll to take a callback that would handle the
cleanup of either a snapshot or a checkpoint, but failed to set the
callback on one of the two snapshot callers.  As a result, 'virsh
undefine $dom --snapshots-metadata' crashed on a NULL function
dereference.

Fixes: a487890d37
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1707708
Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
2019-05-10 10:50:16 -05:00
Martin Kletzander
9639f25e2a Add support for podman in Makefile.ci
This way more users can run our CI builds locally.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-05-10 14:13:06 +02:00
Michal Privoznik
ac10f838f9 virSysinfoParseX86BaseBoard: Free memory upfront if no board detected
If no board was detected then VIR_REALLOC_N() done at the end of
the function will actually free the memory (because nborads ==
0), but @boards will be set to a non-NULL pointer. This makes it
unnecessary harder for a caller to see if any board was detected.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2019-05-10 13:54:26 +02:00
Michal Privoznik
c57b205ccf virSysinfoRead: Simplify #ifdef underbush
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2019-05-10 13:54:26 +02:00
Ján Tomko
44b8df4cb4 build: restore support for libyajl 2.0.1
Commit 105756660f was too eager and did
not consider SLES 12 which still has 2.0.1 that does not ship
a pkg-config file.

Similar to how we check for readline, prefer pkg-config if available
and fall back to the old detection code if not found.

NB: this is not a clean revert because we're not reintroducing support
for YAJL 1.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reported-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2019-05-10 13:10:57 +02:00
Martin Kletzander
c0e31f906c Don't include Makefile.ci in Makefile.am
The way it works now the Makefile needs to be both make valid and automake
valid.  That is fine for now, but if we want to use anything more advanced, like
conditionals, we cannot have it like that any more.

So instead forward all ci-* rules to that file.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2019-05-10 09:12:52 +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
Eric Blake
7fe07761a7 snapshot: Add virDomainSnapshotDefNew
In preparation for making virDomainSnapshotDef a descendant of
virObject, it is time to fix all callers that allocate an object to
use virDomainSnapshotDefNew() instead of VIR_ALLOC().  Fortunately,
there aren't very many :)

Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
2019-05-09 09:51:51 -05:00
Eric Blake
098043eddd snapshot: s/current/parent/ as prep for virObject
VIR_CLASS_NEW insists that descendents of virObject have 'parent' as
the name of their inherited base class member at offset 0. While it
would be possible to write a new class-creation macro that takes the
actual field name 'current', and rewrite VIR_CLASS_NEW to call the new
macro with the hard-coded name 'parent', it seems less confusing if
all object code uses similar naming. Thus, this is a mechanical rename
in preparation of making virDomainSnapshotDef a descendent of
virObject.

Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
2019-05-09 09:48:07 -05:00
Eric Blake
36603bc568 snapshot: s/parent/parent_name/ as prep for virObject
VIR_CLASS_NEW insists that descendents of virObject have 'parent' as
the name of their inherited base class member at offset 0. While it
would be possible to write a new class-creation macro that takes the
actual field name, and rewrite VIR_CLASS_NEW to call the new macro
with the hard-coded name 'parent', so that we could make
virDomainMomentDef use a custom name for its base class, it seems less
confusing if all object code uses similar naming. Thus, this is a
mechanical rename in preparation of making virDomainSnapshotDef a
descendent of virObject, when we can no longer use 'parent' for a
different purpose than the base class.

Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
2019-05-09 09:43:41 -05:00
Peter Krempa
76b9aba2ba qemu: Refactor/simplify qemuDomainStorageSourceAccessAllow
Use qemuDomainStorageSourceAccessModify with correct flags to do the
job.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-09 15:55:36 +02:00
Peter Krempa
b1fe51c4ba qemu: Mark when modifying access to existing source in qemuDomainStorageSourceAccessModify
Some operations e.g. namespace setup are not necessary when modifying
access to a file which the VM can already access. Add a flag which
allows to skip them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-09 15:55:36 +02:00
Peter Krempa
f50d1b7f49 qemu: Allow skipping the revoke step in qemuDomainStorageSourceAccessModify
In some cases when we need to modify access permissions for a storage
source which is already used by the VM we should not revoke all
permissions on a failure. Allow this in qemuDomainStorageSourceAccessModify
by adding a new flag.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-09 15:55:36 +02:00
Peter Krempa
657216b60d qemu: Use bools rather than labels in qemuDomainStorageSourceAccessModify
Rather than jumping to the correct label use a set of booleans to
determine which operation needs to be rolled back. This will allow more
flexibility when e.g. rollback after a failed operation will not be
necessary/desired.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-09 15:55:36 +02:00
Peter Krempa
3bb1423883 qemu: Allow forcing read-only mode in qemuDomainStorageSourceAccessModify
Add a new flag which will set the image as read-only even if the image
data allows writing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-09 15:55:36 +02:00
Peter Krempa
3decae00e9 qemu: Refactor/simplify qemuDomainStorageSourceAccessRevoke
Use qemuDomainStorageSourceAccessModify instead of the individual calls.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-09 15:55:35 +02:00
Peter Krempa
0304fa2fee qemu: Allow using qemuDomainStorageSourceAccessModify on singe images
Add a new flag QEMU_DOMAIN_STORAGE_SOURCE_ACCESS_CHAIN to select whether
to work on single image or full chain.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-09 15:55:35 +02:00
Peter Krempa
6d4136da2a qemu: Convert boolean flags to enum flags in qemuDomainStorageSourceAccessModify
Upcoming patches will add a few more flags. Add an enum to collect them
so that we don't end up with multiple bools.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-09 15:55:35 +02:00
Peter Krempa
0ae504d375 qemu: domain: Rename qemuDomainStorageSourceChainAccessPrepare
The function will be able to deal with non-chains too so drop 'Chain'
and also change the suffix to 'Modify' as it's used both for setup and
teardown.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-09 15:55:35 +02:00
Peter Krempa
45b9ec5b09 qemu: Split entry points to qemuDomainStorageSourceChainAccessPrepare
Introduce qemuDomainStorageSourceChainAccess(Allow|Revoke) as entry
points to qemuDomainStorageSourceChainAccessPrepare for symmetry with
the functions for single backing chain elements.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-09 15:55:35 +02:00
Peter Krempa
3d36d666f8 qemu: Move and rename qemuHotplugPrepareDiskSourceAccess
Move it to qemu_domain.c and call it
qemuDomainStorageSourceChainAccessPrepare.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-09 15:55:35 +02:00
Peter Krempa
1a828a578e qemu: Rename qemuDomainDiskChainElement(Revoke|Prepare)
Use qemuDomainStorageSourceAccess(Allow|Revoke) instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-09 15:55:35 +02:00
Andrea Bolognani
8a1179831b spec: Bump minimum supported Fedora version to 29
Fedora 30 is out, which means that Fedora 28 is going to be
EOL very soon. Let's get ahead of the game and drop support
for it right now.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-05-09 15:08:03 +02:00
Daniel P. Berrangé
c83f5cb4ee news: add note about optional "Removed features" section
Most releases don't need a "Removed features" section so don't include
it in the template by default, but leave a reminder in case it is
relevant.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-05-09 11:36:47 +01:00
Daniel P. Berrangé
75c5ebc8ef tests: perform cross compiler builds on GitLab CI
GitLab CI provides some shared build runners that use Docker containers.
This resource can usefully run cross-compiled builds since all other CI
build testing is currently x86 only, and Travis CI is already very busy
testing native builds.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-05-09 11:34:53 +01:00
Michal Privoznik
f7ab91b61a lib: Build sources before running 'check-access'
If the source tree was freshly configured and no objects are
built yet then 'make check-access' has no test to run. Build
the sources beforehand.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2019-05-07 11:01:21 +02: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
Boris Fiuczynski
fb6c1f16c5 tests: Add capabilities for QEMU 4.0.0 on s390x
In addition adjusting iothreads-virtio-scsi-ccw.s390x-latest.args to prevent
accidential drive id exposure by QEMU fixed by commit a1dce96236
(qemu: Use the 'device_id' property of SCSI disks to avoid regressing),
and also adjusting *s390x-latest.args files to qemu deprecation changes made
in commit e8c2c8bd07 (Prefer '-overcommit mem-lock' over -realtime mlock').

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2019-05-06 14:49:19 +02:00
John Ferlan
9fb14f75b3 docs: Update drivers page to link to storage.html
Rather than duplicate a list of storage pool backends on the
drivers.html page, let's just link directly to the storage driver
page similar to how the node device driver is done.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-05-06 07:33:01 -04:00
Andrea Bolognani
1ec22af93a tests: Add capabilities for QEMU 4.0.0 on ppc64
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
2019-05-06 11:57:59 +02:00
Andrea Bolognani
ce478958a3 tests: Add capabilities for QEMU 4.0.0 on aarch64
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
2019-05-06 11:57:57 +02:00
Andrea Bolognani
0cf8cf7d7c tests: Refresh capabilities for QEMU 4.0.0 on riscv64
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
2019-05-06 11:57:56 +02:00
Andrea Bolognani
f9357d5a51 tests: Refresh capabilities for QEMU 4.0.0 on riscv32
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
2019-05-06 11:56:22 +02:00
Peter Krempa
7dfee399a8 tests: qemucaps: Bump capability test data for qemu-4.0 release on x86_64
Capture and update the 4.0.0 qemu version replies now that it was
released. I opted to keep the CPU differences as there was a qemu bug
which reported an empty string in CPU caps.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2019-05-06 10:10:18 +02:00
Peter Krempa
67c2ddf8a6 qemu: qapi: Implement worker for introspecting alternate types
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-06 09:46:06 +02:00
Peter Krempa
b82f2d837a qemu: qapi: Implement worker for introspecting builtin types
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-06 09:46:06 +02:00
Peter Krempa
8bfb615b4b qemu: qapi: Implement worker for introspecting enums
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-06 09:46:06 +02:00
Peter Krempa
0ea6cd6209 qemu: qapi: Prepare for extension of virQEMUQAPISchemaPathGet docs
Prepare section for boolean queries and make the typed query section
more clear.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-06 09:46:06 +02:00
Peter Krempa
9c2f48de68 qemu: qapi: Report schema and user errors for QAPI queries
We treated broken schema as failure to look up given query. Treat it as
a separate error instead. It is unlikely to happen though.

Also prepare for possibility of user errors if query components which
can't be queired deeper have following components.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-06 09:46:06 +02:00
Peter Krempa
c3944f8fe7 qemu: qapi: Use declarative approach for meta-type parsers in virQEMUQAPISchemaTraverse
Introduce an array of callbacks for given 'meta-type' of the QAPI schema
structure rather than using code to select it. This will simplify
extension for the other meta-types which are not handled yet.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-06 09:46:06 +02:00
Peter Krempa
0b49f891be qemu: qapi: Add helpers for virQEMUQAPISchemaTraverseContext
Rather than modifying the context struct add a helpers that does this.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-06 09:46:06 +02:00