Commit Graph

44715 Commits

Author SHA1 Message Date
Ján Tomko
76deb65613 qemu: fix inactive snapshot revert
The commit splitting out the qemuSnapshotRevertInactive function
dropped the 'defined = true' line by accident and instead
returned -1, leaving the user with a cryptic error:
error: An error occurred, but the cause is unknown

https://bugzilla.redhat.com/show_bug.cgi?id=2039136
https://gitlab.com/libvirt/libvirt/-/issues/266

Fixes: 85e4a13c3f
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2022-01-20 15:16:18 +01:00
Peter Krempa
9911a6f2ff storage: Implement 'checkPool' method for 'disk' type pools
If 'checkPool' is not implemented, the pool will be made inactive when
restarting libvirtd and subsequently re-loading the state from the pool
state XML.

Base the 'checkPool' implementation on logic similar to 'startPool'.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1910856
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-20 14:23:56 +01:00
Peter Krempa
23b0d6a0ff virStoragePoolObjSourceFindDuplicateCb: Fix handling of VIR_STORAGE_POOL_ISCSI_DIRECT
The direct SCSI pool doesn't expose the volumes in the host attempting
to match it using 'virStoragePoolObjSourceMatchTypeDEVICE' which in turn
uses 'virStoragePoolSourceFindDuplicateDevices' doesn't make sense.

Remove it from the source matching completely as we can open multiple
connections to the target.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-20 14:23:56 +01:00
Peter Krempa
a09c5b3cc2 storageDriverAutostartCallback: Refactor control flow
Use early returns to decrease the indentation level and make it more
obvious that the 'cleanup' path is a noop in those cases.

'virStoragePoolObjSetStarting' was called only when the code wanted to
start the pool, so if that was skipped, cleanup is noop as it's
conditional on the return value of 'virStoragePoolObjIsStarting'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-20 14:23:56 +01:00
Peter Krempa
8a80df95ac virStoragePoolObjLoadAllConfigs: Use automatic memory clearing
Refactor the inner loop to automatically free temporary variables and
remove unreachable error paths.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-20 14:23:56 +01:00
Peter Krempa
7cf5b88338 storage: Add debug logs for storage pool config loading
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-20 14:23:56 +01:00
Peter Krempa
755b16d10a docs: man: virsh: Document more carefully that 'guestinfo' can return nothing
When invoking 'virsh guestinfo $VM' without explicitly specifying a
group of information to return, virsh always reports success even when
the guest agent doesn't report any information in the current state.
This is desired in situations when you are okay with stats being missing
and avoids spurious errors being reported.

Clarify that this is really desired in the man page.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2041665
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2022-01-19 19:01:32 +01:00
Peter Krempa
8487772451 kbase: debuglogs: Emphasise 'virt-admin'
It's a tool name so use backticks to format it in monospace.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-01-19 18:52:04 +01:00
Peter Krempa
0e65006747 kbase: debuglogs: Extract client library logging setup
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-01-19 18:52:04 +01:00
Peter Krempa
69349e0902 kbase: debuglogs: Add a section describing log outputs and filters
Outline what the given settings influence.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-01-19 18:52:04 +01:00
Peter Krempa
5e38c32e3d kbase: debuglogs: Section off the settings for legacy libvirt
Move out the settings required to pre libvirt-4.4.0 deployments into a
separate section so that the main point is not cluttered by now mostly
irrelevant settings.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-01-19 18:52:04 +01:00
Peter Krempa
58d0cf480d kbase: debuglogs: Un-nest section on enabling debug logs
Enabling the logs is the focus of this article. Decouple it from the
first section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-01-19 18:52:04 +01:00
Peter Krempa
83f4019f51 kbase: debuglogs: Use common heading hierarchy
Use the heading hierarchy as generated by pandoc which we use in most
of the converted XML format docs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-01-19 18:52:03 +01:00
Peter Krempa
aaec8c91ae spec: Run pre/post-install stuff on 'daemon-driver-storage-core'
'daemon-driver-storage' is just a meta-package, the actual daemon is in
the 'daemon-driver-storage-core' package, so without installing the meta
package the storage daemon is not being enabled.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2025644
Fixes: 50eae3f885, b8ef625544
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-19 17:00:27 +01:00
Peter Krempa
9c800d62ad remote: systemd: Remove unix sockets from filesystem when disabling a '.socket' unit
The existence of the unix socket path is used by the remote driver to
determine whether modular daemons are in use, so if the socket file
stays behind and the user decided to switch from modular to monolithic
daemon which was socket activated, the remote driver will insist on
picking '/var/run/libvirt/virtqemud-sock', even when it's no longer in
use:

 # systemctl start libvirtd.service
 # virsh list
  Id   Name   State
 --------------------

 # systemctl stop libvirtd.service
 Warning: Stopping libvirtd.service, but it can still be activated by:
   libvirtd.socket
   libvirtd-ro.socket
   libvirtd-admin.socket
 # systemctl start virtqemud.socket
 # virsh list
  Id   Name   State
 --------------------

 # systemctl stop virtqemud.socket
 # systemctl start libvirtd.service
 # virsh list
 error: failed to connect to the hypervisor
 error: Failed to connect socket to '/var/run/libvirt/virtqemud-sock': Connection refused

 # virsh -c 'qemu:///system?socket=/var/run/libvirt/libvirt-sock' list
  Id   Name   State
 --------------------

Fix this by instructing systemd to delete the socket file when
deactivating the unit file for the socket.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
2022-01-19 16:54:33 +01:00
Peter Krempa
1652babf15 qemuValidateDomainDeviceDefVideo: Reject non-default video head count for devices not supporting it
Only QXL and virtio-vga actually propagate the 'heads' attribute as
'max_outputs' to the commandline of qemu. Reject the setting when
non-default value is used for any other video type.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2036300
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-19 16:54:33 +01:00
Peter Krempa
37c0a25ca0 qemuValidateDomainDeviceDefVideo: Refactor condition checking for qxl and virtio-vga
Subsequent patch will use the same condition so move the primary device
check into a nested condition.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-19 16:54:32 +01:00
Peter Krempa
4c308ea42e qemuBuildDeviceVideoCmd: Simplify formatting of 'max_outputs' property
Since there's no capability to check now, we can simply move the
formatting of 'max_outputs' earlier.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-19 16:54:32 +01:00
Peter Krempa
49a85978b7 qemu: capabilities: Retire QEMU_CAPS_QXL_MAX_OUTPUTS and QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS
Both are supported by qemu-2.11 and later, so we don't have to check for
them explicitly.

Note that QXL is supported only on x86_64, thus on other arches only the
capability for 'virtio-gpu' is removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-19 16:54:32 +01:00
Peter Krempa
d35ddc6243 qemuBuildDeviceVideoCmd: Always assume support for 'max_outputs' property
Both the QXL video device and 'virtio' video device support
'max_outputs' in all qemu versions libvirt supports. This means we no
longer have to check the QEMU_CAPS_QXL_MAX_OUTPUTS and
QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-19 16:54:32 +01:00
Peter Krempa
6622e3cc33 virDomainDeviceInfoParseXML: Reject '0' value for ACPI index
Value of '0' is treated equivalently to when it's not provided by the
user. Reject an explicit '0' provided by the user as it would get
ignored.

In this rare case we can make the XML parser more strict, as libvirt
would never format the '<acpi/>' element if the index is '0' thus there
are no libvirt-generated XMLs we'd not load back, as of such this is
identical to rejecting it in the validation phase.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2037146
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-19 16:54:32 +01:00
Michal Privoznik
ec7fbdef56 virsh-network: Don't check for virshXXXTypeFromString() >= VIR_XXX_LAST
They way our VIR_ENUM_IMPL() and virXXXTypeFromString() work is
that for any string that's not recognized a negative one is
returned. And, since VIR_XXX_LAST is passed to VIR_ENUM_IMPL() we
can be sure that all enum members are covered. Therefore, there
is no way that virXXXTypeFromString() can return a value that's
bigger or equal to VIR_XXX_LAST.

I've noticed two places where such comparison was made, both in
cmdNetworkUpdate(). Drop them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-19 16:48:33 +01:00
Michal Privoznik
d724ca8fcd virsh: Introduce net-update --section completer
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-19 16:48:33 +01:00
Michal Privoznik
687d6f1d7b virsh: Introduce net-update --command completer
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-19 16:48:33 +01:00
Daniel P. Berrangé
ab96031943 util: set facility when opening syslog channel
We're currently passing '0' which leaves the syslog facility
unset. Since we're passing an explicit facility for syslog
when using journald, it makes sense to be explicit when
using  syslog directly too.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-19 15:32:54 +00:00
Daniel P. Berrangé
017fa1e097 util: fix syslog facility value
We set SYSLOG_PRIORITY when sending to journald to avoid our
messages getting tagged with the default facility which is
used for the kernel.

Unfortunately:

  commit fd00f0e6c7
  Author: Guido Günther <agx@sigxcpu.org>
  Date:   Mon Sep 21 20:06:55 2015 +0200

    Use daemon log facility for journald

used the LOG_nnn constants from the syslog header without realizing
that these values have a bit-shift applied. While Linux defines a
LOG_FAC() macros to undo the bit-shift this doesn't appear to be
standardized. So the safe thing is to just use the raw value since
these values are fixed by RFC 5424.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-19 15:32:45 +00:00
Tim Wiederhake
6c68f120a5 docs: coding-style: One variable declaration per line
This was not mentioned before.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-01-19 14:54:08 +01:00
Tim Wiederhake
95c380d410 docs: coding-style: Clarify on virXXXPtr types
This partially reverts commit 9ccbed6afb.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-01-19 14:54:08 +01:00
Tim Wiederhake
1787a77cf8 manpages: libvirt-guests: Fix typos
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-01-19 14:52:27 +01:00
Ján Tomko
6ba2643257 qemu: simplify qemuProcessSetupRawIO
Remove the now unused 'driver' parameter, as well as the pointless
if (ret == 0) comparison which is always true after removing the
cleanup label.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-19 13:57:59 +01:00
Ján Tomko
8120021860 util: remove {Get,Set}UnprivSGIO
These are no longer used.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-19 13:57:59 +01:00
Ján Tomko
44aaa02992 util: remove virGetDeviceID
It was only used to construct the hash key for the (now removed)
shared devices in the qemu driver.

Remove it and its mocking.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-19 13:57:59 +01:00
Ján Tomko
89803eb5f8 qemu: remove sharedDevices hash table
Its only use was to check conflicts of the sgio attributes between
devices shared with other domains.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-19 13:57:59 +01:00
Ján Tomko
dbd2f26cf0 qemu: remove all use of SGIO
Now that the 'unfiltered' attribute is rejected by the validator,
remove all the code that deals with the feature.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-19 13:57:59 +01:00
Ján Tomko
711f593566 conf: reject unfiltered sgio on validation
No kernels supported by upstream libvirt have the feature.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-19 13:57:59 +01:00
Ján Tomko
f322018c23 util: remove virGetUnprivSGIOSysfsPath
unpriv_sgio was a downstream-only feature in RHEL 6-8.
The libvirt support was merged upstream by mistake.

Remove the function that constructs the sysfs path and assume it
does not exist in all the callers.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-19 13:57:59 +01:00
Ján Tomko
ae8add363a qemu: remove support for transitional virtio-input-host
virtio-input is virtio-1.0 only and these models have been only present
in one upstream QEMU release, then removed by:

      commit d923e30578a65392e50e530e3a29b2edf5c51c5b
          virtio-input-host-pci: cleanup types

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-18 19:13:40 +01:00
Ján Tomko
8b90d0833a qemu: remove support for transitional virtio-input-host
This device was virtio 1.0-only so adding the (non-)transitional model
did not make sense and it was only present in QEMU 4.0.

Report a validation error for both of the users that will ever hit this
code path.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-18 19:13:36 +01:00
Ján Tomko
a829adf24a qemu: capabilities: do not check for transitional input host
The (non-)transitional version of this device was only present in
one upstream QEMU release (4.0), then removed by:

  commit d923e30578a65392e50e530e3a29b2edf5c51c5b
      virtio-input-host-pci: cleanup types

Remove them from probing as well, since they are unlikely to be found.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-18 18:09:33 +01:00
Ján Tomko
a5e8eec7d5 util: openvswitch: do not reuse cmd in InterfaceClearTxQos
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-18 17:48:32 +01:00
Ján Tomko
3ab7df7421 util: openvswitch: do not reuse cmd in InterfaceSetTxQos
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-18 17:48:32 +01:00
Ján Tomko
5d55546e0f util: openvswitch: split out virNetDevOpenvswitchInterfaceSetRxQos
The virNetDevOpenvswitchInterfaceSetQos function is uneven
because setting the Rx Qos is open-coded, while clearing it
is sepearated in another function.

Separate the setting too.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-18 17:48:32 +01:00
Ján Tomko
be82600128 util: openvswitch: split out virNetDevOpenvswitchInterfaceSetTxQos
The virNetDevOpenvswitchInterfaceSetQos function is uneven
because setting the Tx Qos is open-coded, while clearing it
is sepearated in another function.

Separate the setting too.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-18 17:48:32 +01:00
Ján Tomko
186aa292a0 util: openvswitch: unexport InterfaceClear{Rx,Tx}Qos
This also removes the indentation error.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-18 17:48:32 +01:00
Ján Tomko
a6ffb1712b util: openvswitch: move InterfaceClear{Rx,Tx}Qos
These functions are called by virNetDevOpenvswitchInterfaceSetQos
as well as virNetDevOpenvswitchInterfaceClearQos.

Move them above both fuctions.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-18 17:48:32 +01:00
Andrea Bolognani
dbf9b8a6ed util: Stop storing dnsmasq version
We don't do anything with it after checking that it satisfies our
requirements and don't provide a way for users of the module to
access it, so carrying it around is pointless.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-18 16:50:31 +01:00
Andrea Bolognani
cef015e325 spec: Drop BuildRequires on dnsmasq
It's been an optional build time dependency for a long time, so
if Meson couldn't find it the only consequence was that libvirt
would look for it at runtime instead, which is what we are doing
for most of our non-library dependencies anyway.

Since 5c98d1cee0 we've stopped even looking for it at build
time, so there's no point in having it installed in the build
environment.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-18 16:50:15 +01:00
Michal Privoznik
11627e021d virdnsmasq: Join dnsmasqCapsNewEmpty() and dnsmasqCapsNewFromBinary()
After previous cleanups, there's just one caller of
dnsmasqCapsNewEmpty() and it is dnsmasqCapsNewFromBinary().
And the former is pretty short. Therefore, it is not necessary
for the code to live in two separate functions. Dissolve the
former in the latter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-18 16:18:57 +01:00
Michal Privoznik
d730392293 virdnsmasq: Drop dnsmasqCapsNewFromBuffer()
The function is no longer used. Remove it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-18 16:18:57 +01:00
Michal Privoznik
2fc6adcb30 networkxml2conftest: Check if capabilities were created successfully
Now that looking up dnsmasq is handled/mocked we can start
checking whether dnsmasq capabilities were built successfully and
error out if that wasn't the case.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-18 16:18:54 +01:00