Commit Graph

36087 Commits

Author SHA1 Message Date
Ján Tomko
45464db8ba conf: do not generate machine names ending with a dash
As of systemd commit:

commit d65652f1f21a4b0c59711320f34266c635393c89
Author:     Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
CommitDate: 2018-12-10 09:56:56 +0100

    Partially unify hostname_is_valid() and dns_name_is_valid()

Dashes are no longer allowed at the end of machine names.

Trim the trailing dashes from the generated name before passing
it to machined.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2020-01-15 17:10:20 +01:00
Ján Tomko
fdd48f5b73 util: add virBufferTrimChars
A new helper for trimming combinations of specified characters from
the tail of the buffer.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2020-01-15 17:10:20 +01:00
Ján Tomko
46afdc2120 virbuftest: use field names when initalizing test info
Allow adding new fields without changing all the macros.

Otherwise the compiler complains that not all have been initialized:
../../tests/virbuftest.c:419:5: error: missing field 'arg' initializer [-Werror,-Wmissing-field-initializers]
    DO_TEST_ESCAPE("<td></td><td></td>",
    ^
../../tests/virbuftest.c:414:56: note: expanded from macro 'DO_TEST_ESCAPE'
        struct testBufAddStrData info = { data, expect }; \

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2020-01-15 17:10:20 +01:00
Ján Tomko
ebd44715f1 virbuftest: declare testBufAddStrData earlier
Move the declaration to the beginning of the file for reuse.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2020-01-15 17:10:20 +01:00
Ján Tomko
662876723c virbuftest: remove unnecessary labels
Remove the ret variables and labels from functions that no longer need
them.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2020-01-15 17:10:19 +01:00
Ján Tomko
b0138d55f7 virbuftest: use g_autofree
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2020-01-15 17:10:19 +01:00
Ján Tomko
08de39a9c7 virbuftest: remove extra G_GNUC_UNUSED markers
These functions do use the opaque argument.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2020-01-15 17:10:19 +01:00
Ján Tomko
4c121af81b maint: Post-release version bump to 6.1.0
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-01-15 16:51:12 +01:00
Daniel Veillard
10ff7997c5 Release of libvirt-6.0.0
* docs/news.xml: updated for the release

Signed-off-by: Daniel Veillard <veillard@redhat.com>
2020-01-15 16:18:42 +01:00
Michal Privoznik
2b611db882 news: Document <disk type='nvme'/>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2020-01-14 10:06:13 +01:00
Han Han
8475234dbc news: News for RDT-MBM feature
Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2020-01-14 09:22:22 +01:00
Pavel Hrdina
7d60846962 vircgroupv2devices: free BPF map when replacing with new one
This leaks the FD of BPF map which means it will not be freed.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2020-01-13 15:17:54 +01:00
Andrea Bolognani
c2642c4889 news: Update for libvirt 6.0.0
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-01-13 15:11:04 +01:00
Andrea Bolognani
a58b498cbc news: Rearrange a few entries
Some were in the wrong section, some in the wrong version.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-01-13 15:11:04 +01:00
Andrea Bolognani
ca6d115dea news: Fix typo (Libivrt -> Libvirt)
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-01-13 15:11:04 +01:00
Thomas Huth
bfd5f69d60 qemu_capabilities: Do not report USB as subsystem type if it is not available
libvirt currently always reports that USB is available as a bus subsystem
type when running "virsh domcapabilities". However, this is not always
true, for example the qemu-system-s390x binary normally never has support
for USB. Thus we should only report that USB is available if there is
also a USB host controller available where we can attach USB devices.

Reported-by: Sebastian Mitterle <smitterl@redhat.com>
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1759849
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-01-13 13:53:23 +01:00
Thomas Huth
177fbcdfaa domain_conf: Do not use USB by default for <input> devices on s390x
When trying to specify an input device on s390x without bus like this:

 <input type='keyboard'/>

... then libvirt currently complains:

 error: unsupported configuration: USB is disabled for this domain,
 but USB devices are present in the domain XML

This is somewhat confusing since the user did not specify an USB
device here. Since USB is not available on s390x, we should default
to the "virtio" bus here instead.

Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1790189
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-01-13 13:39:37 +01:00
Peter Krempa
3f2d167d9c conf: Always format storage source auth and encryption under <source> for backing files
Historically there are two places where we format authentication and
encryption for a disk. The logich which formats it for backing files was
flawed though and didn't format it at all. This worked if the image
became a backing file through the means of a snapshot but not directly.

Force formatting of the source and encryption for any non-disk case to
fix the issue.

This caused problems in many places as we use the formatter to copy the
definition. Effectively any copy lost the secret definition.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2020-01-13 12:53:58 +01:00
Peter Krempa
23b52d9420 tests: qemuxml2xml: Enable luks-disks-source-qcow2 case
The test data was used only in xml->argv testing but it will have some
interresting fallout soon.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2020-01-13 12:53:58 +01:00
Peter Krempa
ebebf63b9c tests: qemuxml2argv: Run luks-disks-source-qcow2 case with latest caps
Try also the modern incarnation of the test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2020-01-13 12:53:58 +01:00
Peter Krempa
d06391d611 tests: qemuxml2argv: Add disk image with encrypted backing file
Add another disk to luks-disks-source-qcow2 case to cover a backing
chain with encrypted members.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2020-01-13 12:53:58 +01:00
Jiri Denemark
37d51dda5d qemuxml2*test: Fix hugepages-default-system-size tests
Commit v5.10.0-269-g62065a6cb5 moved NUMA validation code to domain
definition time and appropriately adjusted affected test cases except
for hugepages-default-system-size. And since we don't mock
virGetSystemPageSizeKB in our tests, hugepages-default-system-size test
would fail on architectures (ppc64le) with default page size other than
4KiB.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2020-01-13 12:52:06 +01:00
Andrea Bolognani
a2e15167f9 Fix typo (cetificate -> certificate)
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2020-01-13 11:47:41 +01:00
Michal Privoznik
4a09c143f6 virerror: Make it easier to add new error number
In v5.0.0-rc1~94 we switched from one huge switch() to an array
for translating error numbers into error messages. However, the
array is declared to have VIR_ERR_NUMBER_LAST items which makes
it impossible to spot this place by compile checking when adding
new error number.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2020-01-10 13:53:32 +01:00
Peter Krempa
0604b9e627 news: Mention problems with backing image format probing
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-01-10 12:49:03 +01:00
Peter Krempa
30867fb098 util: storage: Link to knowledge base when reporting missing image backing format
Mention the knowledge base article which has tips how to fix the backing
chain to work with current libvirt.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-01-10 12:49:03 +01:00
Daniel P. Berrangé
975f2d1c90 tests: avoid re-execing test once for each mock
When debugging tests under GDB/valgrind there is a significant
delay each time an execve is done as they scan shared libraries
once again. For tests which use many mock libraries, we have
been invoking execve many times which makes the debug experience
horrible. This changes our framework to activate the full
set of mock libraries in one single execve.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-01-10 10:45:34 +00:00
Michael Weiser
66ec00ab3e docs: Add snapshot-revert qemu managedsave force
Add documentation for additional reason why snapshot-revert might need
to be forced. This explains why restoring an inactive snapshot while
there is managed saved state is refused by default.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-01-10 10:42:01 +01:00
Michael Weiser
29773f2a75 docs: Reformat snapshot-revert force reasons
Reformat explanations of the snapshot-revert force reasons in
preparation for more to be added. This is a simple reformat without any
wording changes.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-01-10 10:41:26 +01:00
Michael Weiser
5373f63b30 qemu: Warn of restore with managed save being risky
Internal snapshots of a non-running domain do not carry any memory state
and restoring such a snapshot will not replace existing saved memory
state. This allows a scenario, where a user first suspends a domain into
managedsave, restores a non-running snapshot and then resumes the domain
from managedsave. After that, the guest system will run with its
previous memory state atop a different disk state. The most obvious
possible fallout from this is extensive file system corruption. Swap
content and RAID bitmaps might also be off.

This has been discussed[1] and fixed[2] from the end-user perspective for
virt-manager.

This patch marks the restore operation as risky at the libvirt level,
requiring the user to remove the saved memory state first or force the
operation.

[1] https://www.redhat.com/archives/virt-tools-list/2019-November/msg00011.html
[2] https://www.redhat.com/archives/virt-tools-list/2019-December/msg00049.html

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-01-10 10:36:33 +01:00
Michael Weiser
c27d3ec17a docs: Harmonize hypervisor names for QEMU and LXC
Trivially replace usages of qemu and lxc in the virsh manpage with their
more heavily used and (according to Wikipedia) correct upper-case
spellings QEMU and LXC.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Suggested-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-01-10 10:08:27 +01:00
Jiri Denemark
e0127260fb qemu: Don't use NULL path from qemuDomainGetHostdevPath
Commit v5.10.0-290-g3a4787a301 refactored qemuDomainGetHostdevPath to
return a single path rather than an array of paths. When the function is
called on a missing device, it will now return NULL in @path rather than
a NULL array with zero items and the callers need to be adapted
properly.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-01-10 09:12:57 +01:00
Jiri Denemark
143b71a8ec virsh migrate: Require --tls for --tls-destination
--tls-destination would be just ignored unless --tls is not specified,
which is correct, but let's provide a bit of a guidance is a user
forgets to add --tls.

This is just a virsh-only check targeted to end users as we don't
currently have such checks at the API level for migration parameters
that depend on flags.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
2020-01-10 09:12:57 +01:00
Daniel P. Berrangé
e90a643c90 tests: avoid probing host CPU from bhyve test
bhyveargv2xmlmock calls virBhyveCapsBuild which in turn
calls virCPUProbeHost, probing the real host CPU. This
causes a test failure if the host CPU happens to contain
the 'arch-capabilities' feature as it triggers a call
to virHostCPUGetMSR() which fails on FreeBSD.

Fortunately we already have convenient code for mocking
the host CPU probing.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-01-09 18:05:17 +00:00
Michal Privoznik
8b58b5ee03 schema: Allow iSCSI source to have interleaved children
There is no need to require users to produce iSCSI disk source
following our ordering of children elements. In fact, we don't
even accept our own order in the schema :(.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2020-01-09 09:12:01 +01:00
Michal Privoznik
832656fa8e bhyve_parse_command: Undefine CONSUME_ARG macro when no longer needed
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2020-01-08 12:55:10 +01:00
Michal Privoznik
cbb3bbc66a bhyve_parse_command.c: Don't jump onto non-existent label in CONSUME_ARG()
In v5.10.0-508-gfbf3f3d86a, the 'error' label was removed from
bhyveParseBhyveCommandLine(), however the CONSUME_ARG() macro
still uses it. Fix the macro to return an error instead.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2020-01-08 12:54:33 +01:00
Ján Tomko
264ec9da43 qemu: fix implicit fallthrough warning
src/qemu/qemu_domain_address.c:680:13: error: this statement may fall through [-Werror=implicit-fallthrough=]
             switch ((virDomainFSModel) dev->data.fs->model) {

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: f363af7e35
2020-01-08 10:41:11 +01:00
Michal Privoznik
08cb201dcc vz: Don't try to jump on a non-existent label in prlsdkRemoveBootDevices()
Commit v5.10.0-522-g9000b2f298 was too aggressive and removed the
'error' label from prlsdkRemoveBootDevices() even though it's
used. Luckily, it's used only from one place and we have an
alternative for it that doesn't require the label.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-01-08 10:14:55 +01:00
Michal Privoznik
8fcee47807 qemu_firmware: Accept int in qemuFirmwareOSInterfaceTypeFromOsDefFirmware()
The point of this function is to translate virDomainOsDefFirmware
enum to qemuFirmwareOSInterface enum. However, with my commit
v5.10.0-507-g8e1804f9f6 we are passing a variable type of
virDomainLoader enum. Make the function accept both enums and
make the enum members correspond to each other.

This fixes clang build.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-01-08 10:14:55 +01:00
Ján Tomko
54ba7da585 docs: formatdomain: use 'element' instead of 'block'
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-01-08 09:51:01 +01:00
Ján Tomko
f6d7d8612d qemu: command: take fsdriver type into account
Split the formatting by fsdriver type to allow adding a new type.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-01-08 09:51:01 +01:00
Ján Tomko
f363af7e35 qemu: address: take fsdriver type into account
Split the switch by fsdriver type to allow adding a new one.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-01-08 09:51:01 +01:00
Ján Tomko
83f046458e qemu: pass private data to qemuBuildFilesystemCommandLine
This will be used by a future patch.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-01-08 09:51:01 +01:00
Ján Tomko
801e6da29c qemu: add private data to virDomainFSDef
Wire up the allocation and disposal of private data.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-01-08 09:51:01 +01:00
Ján Tomko
5120577ed7 conf: add private data to virDomainFSDef
Add an object to hold the private data and call the
allocation function if it's present in xmlopt.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-01-08 09:51:01 +01:00
Ján Tomko
a2430cc544 conf: add xmlopt to virDomainFSDefNew
This will be needed in the future for allocating private data.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-01-08 09:51:00 +01:00
Ján Tomko
adadc342c3 qemu: rename gluster_debug_entry
Remove the 'gluster' part and decouple the return from
the gluster_debug_level parsing to allow adding more options
to this section.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-01-08 09:51:00 +01:00
Ján Tomko
d7c5679bc1 build: error out when check-augeas fails
Fixes: 2ffbdabb85

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-01-08 09:51:00 +01:00
Peter Krempa
c314222a01 qemu: backup: Move capability check after inactive check
Inactive VM doesn't have qemuCaps set thus we'd never properly report
that VM backups are supported only for running VMs.

Move the capability check after the active check.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2020-01-08 07:10:46 +01:00