]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
4 years agotests: add capabilities data files for sparc emulator target
Daniel P. Berrangé [Wed, 18 Nov 2020 16:18:43 +0000 (16:18 +0000)]
tests: add capabilities data files for sparc emulator target

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agotests: add fake host CPU for sparc architecture
Daniel P. Berrangé [Wed, 18 Nov 2020 16:53:50 +0000 (16:53 +0000)]
tests: add fake host CPU for sparc architecture

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoqemu: enable support for ESP SCSI controller family
Daniel P. Berrangé [Wed, 18 Nov 2020 16:33:16 +0000 (16:33 +0000)]
qemu: enable support for ESP SCSI controller family

The NCR53C90 is the built-in SCSI controller on all sparc machine types,
but not sparc64. Note that it has the fixed alias "scsi", which differs
from our normal naming convention of "scsi0".

The DC390 and AM53C974 are PCI SCSI controllers that can be added to any
PCI machine.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoqemu: add capabilities for the three ESP family SCSI controllers
Daniel P. Berrangé [Wed, 18 Nov 2020 16:37:54 +0000 (16:37 +0000)]
qemu: add capabilities for the three ESP family SCSI controllers

Probing for the NCR53C90 controller is a little unusual. The
qom-list-types QMP command returns a list of all types known to
the QEMU binary. It does not distinguish devices which are user
creatable from those which are built-in.

Any QEMU target that supports PCI will have the DC390 / AM53C974
devices because they are PCI based. Due to code dependencies
in QEMU though, existence of these two devices will also pull in
the NCR53C90 device (called just 'esp' in QEMU). The NCR53C90 is
not user-creatable and can only be used when built-in to the
machine type.

This is only the case on sparc machines, and certain mips64 and
m68k machines.  IOW, we don't rely on qom-list-types as a guide
for existence of NCR53C90, as it shouldn't really exist in most
QEMU binaries.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoconf: add support for ESP SCSI controller family
Daniel P. Berrangé [Tue, 17 Nov 2020 18:15:44 +0000 (18:15 +0000)]
conf: add support for ESP SCSI controller family

The NCR53C90 is the built-in SCSI controller on all sparc machine types,
and some mips and m68k machine types.

The DC390 and AM53C974 are PCI SCSI controllers that can be added to any
PCI machine.

These are only interesting for emulating obsolete hardware platforms.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoqemu: add helper method for checking if ESP SCSI is builtin
Daniel P. Berrangé [Wed, 18 Nov 2020 16:11:05 +0000 (16:11 +0000)]
qemu: add helper method for checking if ESP SCSI is builtin

The NCR53C90 ESP SCSI controller is only usable when built-in to the
machine type. This method will facilitate checking that restriction
across many places.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoqemu: fix default devices on sparc machines
Daniel P. Berrangé [Wed, 18 Nov 2020 14:59:47 +0000 (14:59 +0000)]
qemu: fix default devices on sparc machines

The sparc machines have little in common with sparc64 machines.

No sparc machine type includes a PCI bus, so we should not be adding one
to the XML. This further means that we should not be adding a memory
balloon device, nor USB controller as these are both PCI based.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoutil: add ARCH_IS_MIPS64 helper macro
Daniel P. Berrangé [Wed, 18 Nov 2020 16:10:07 +0000 (16:10 +0000)]
util: add ARCH_IS_MIPS64 helper macro

In most cases logic for MIPS64 and MIPS64EL will be identical.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agospec: Drop UUID handling for default network
Andrea Bolognani [Sun, 15 Nov 2020 15:42:23 +0000 (16:42 +0100)]
spec: Drop UUID handling for default network

We're no longer generating a UUID during installation, so we
clearly don't need to strip it afterwards; and since the network
driver is perfectly capable of generating a UUID if necessary, we
don't need to do that at %post time either.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agonetwork: Drop UUID handling for default network
Andrea Bolognani [Sun, 15 Nov 2020 15:30:34 +0000 (16:30 +0100)]
network: Drop UUID handling for default network

We are generating a fresh UUID and storing it in the XML for the
default network, but this is unnecessary because the network
driver will automatically generate one if it's missing from the
XML; the fact that we only do this if the uuidgen command happens
to be available on the build machine is further proof that we can
safely skip this step.

This patch is best viewed with 'git show -w'.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agoconf: Write network config to disk after generating UUID
Andrea Bolognani [Thu, 19 Nov 2020 15:08:13 +0000 (16:08 +0100)]
conf: Write network config to disk after generating UUID

While we generally expect libvirt objects to be defined using the
appropriate APIs, there are cases where it's reasonable for an
external entity, usually a package manager, to drop a valid
configuration file under /etc/libvirt and have libvirt take over
from there: notably, this is exactly how the default network is
handled.

For the most part, whether the configuration is saved back to disk
after being parsed by libvirt doesn't matter, because we'll end up
with the same values anyway, but an obvious exception to this is
data that gets randomly generated when not present, namely MAC
address and UUID.

Historically, both were handled by our build system, but commit
a47ae7c004e9 moved handling of the former inside libvirt proper;
this commit extends such behavior to the latter as well.

Proper error handling for the virNetworkSaveConfig() call, which
was missing until now, is introduced in the process.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Thu, 19 Nov 2020 00:19:35 +0000 (01:19 +0100)]
Translated using Weblate (Swedish)

Currently translated at 8.2% (853 of 10399 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Translated using Weblate (Swedish)

Currently translated at 8.0% (833 of 10399 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Translated using Weblate (Swedish)

Currently translated at 7.8% (813 of 10399 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Translated using Weblate (Swedish)

Currently translated at 7.6% (796 of 10399 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Translated using Weblate (Swedish)

Currently translated at 7.0% (736 of 10399 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
4 years agosockettest: testMaskNetwork: use g_auto
Ján Tomko [Thu, 19 Nov 2020 15:57:52 +0000 (16:57 +0100)]
sockettest: testMaskNetwork: use g_auto

This has the added benefit of 'gotnet' only being freed after
it was possibly used in the output string.

../src/internal.h:519:27: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  519 | # define fprintf(fh, ...) g_fprintf(fh, __VA_ARGS__)
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~
../tests/sockettest.c:194:9: note: in expansion of macro ‘fprintf’
  194 |         fprintf(stderr, "Expected %s, got %s\n", networkstr, gotnet);
      |         ^~~~~~~

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reported-by: Jaroslav Suchanek <jsuchane@redhat.com>
Fixes: ba08c5932e556aa4f5101357127a6224c40e5ebe
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agodomain_conf: use g_free() in virDomainPostParseCheckISCSIPath()
Matt Coleman [Fri, 6 Nov 2020 03:32:39 +0000 (22:32 -0500)]
domain_conf: use g_free() in virDomainPostParseCheckISCSIPath()

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoopenvzDomainMigratePrepare3Params: use g_auto
Ján Tomko [Thu, 19 Nov 2020 10:09:43 +0000 (11:09 +0100)]
openvzDomainMigratePrepare3Params: use g_auto

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agoopenvzDomainMigratePrepare3Params: remove else after goto
Ján Tomko [Thu, 19 Nov 2020 10:06:56 +0000 (11:06 +0100)]
openvzDomainMigratePrepare3Params: remove else after goto

We jump to the error label if the 'if' condition is true.
Remove the explicit else to make it more obvious that 'hostname'
is filled on both branches of 'if (!uri_in)'.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agoopenvzDomainMigratePrepare3Params: correctly use hostname
Ján Tomko [Thu, 19 Nov 2020 09:58:09 +0000 (10:58 +0100)]
openvzDomainMigratePrepare3Params: correctly use hostname

In case no uri_in was supplied, we forgot to set the hostname
to the current hostname and formatted a useless uri_out.

src/util/glibcompat.h:57:26: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  57 | # define g_strdup_printf vir_g_strdup_printf
src/openvz/openvz_driver.c:2136:16: note: in expansion of macro ‘g_strdup_printf’
2136 |     *uri_out = g_strdup_printf("ssh://%s", hostname);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reported-by: Jaroslav Suchanek <jsuchane@redhat.com>
Fixes: e3c626a61d6c3d808555653684c0fb1e7c4d74ec
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agogitlab-ci: add coverity job
Pavel Hrdina [Thu, 12 Nov 2020 13:56:25 +0000 (14:56 +0100)]
gitlab-ci: add coverity job

Introduce new job to make a coverity build and upload coverity data to
scan.coverity.com where the analysis is then executed.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agosrc: rework static analysis detection
Pavel Hrdina [Mon, 16 Nov 2020 09:57:56 +0000 (10:57 +0100)]
src: rework static analysis detection

Inspired by QEMU code.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agodomain_capabilities: Assert enums fit into unsigned int bitmask
Michal Privoznik [Wed, 18 Nov 2020 10:58:01 +0000 (11:58 +0100)]
domain_capabilities: Assert enums fit into unsigned int bitmask

The way our domain capabilities work currently, is that we have
virDomainCapsEnum struct which contains 'unsigned int values'
member which serves as a bitmask. More complicated structs are
composed from this struct, giving us whole virDomainCaps
eventually.

Whenever we want to report that a certain value is supported, the
'1 << value' bit is set in the corresponding unsigned int member.
This works as long as the resulting value after bitshift does not
overflow unsigned int. There is a check inside
virDomainCapsEnumSet() which ensures exactly this, but no caller
really checks whether virDomainCapsEnumSet() succeeded. Also,
checking at runtime is a bit too late.

Fortunately, we know the largest value we want to store in each
member, because each enum of ours ends with _LAST member.
Therefore, we can check at build time whether an overflow can
occur.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agocpu_map: Add Phytium FT-2000+ and Tengyun-S2500
Shaojun Yang [Thu, 19 Nov 2020 00:26:15 +0000 (08:26 +0800)]
cpu_map: Add Phytium FT-2000+ and Tengyun-S2500

Signed-off-by: Shaojun Yang <yangshaojun@phytium.com.cn>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agocgroup: add stub for virCgroupNew
Ján Tomko [Thu, 19 Nov 2020 10:16:27 +0000 (11:16 +0100)]
cgroup: add stub for virCgroupNew

The previous commit exported the function but forgot to add
a non-Linux stub.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 126cb34a206a44f04e364700b46426dff9f387d5
4 years agovirt-host-validate: fix detection with cgroups v2
Pavel Hrdina [Wed, 18 Nov 2020 12:08:22 +0000 (13:08 +0100)]
virt-host-validate: fix detection with cgroups v2

Using virtCgroupNewSelf() is not correct with cgroups v2 because the
the virt-host-validate process is executed from from the same cgroup
context as the terminal and usually not all controllers are enabled
by default.

To do a proper check we need to use the root cgroup to see what
controllers are actually available. Libvirt or systemd ensures that
all controllers are available for VMs as well.

This still doesn't solve the devices controller with cgroups v2 where
there is no controller as it was replaced by eBPF. Currently libvirt
tries to query eBPF programs which usually works only for root as
regular users will get permission denied for that operation.

Fixes: https://gitlab.com/libvirt/libvirt/-/issues/94
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoNEWS: restore backtick balance
Ján Tomko [Wed, 18 Nov 2020 15:47:17 +0000 (16:47 +0100)]
NEWS: restore backtick balance

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reported-by: Michal Prívozník <mprivozn@redhat.com>
Fixes: db98d17709eeb13603730352a70f3817becd7372
4 years agonews: Document recent OpenSSH authorized key file mgmt APIs
Michal Privoznik [Tue, 10 Nov 2020 14:00:45 +0000 (15:00 +0100)]
news: Document recent OpenSSH authorized key file mgmt APIs

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemu: Implement OpenSSH authorized key file mgmt APIs
Michal Privoznik [Tue, 10 Nov 2020 11:35:12 +0000 (12:35 +0100)]
qemu: Implement OpenSSH authorized key file mgmt APIs

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1888537
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemu_agent: add qemuAgentSSH{Add,Remove,Get}AuthorizedKeys
Marc-André Lureau [Sat, 7 Nov 2020 09:12:53 +0000 (13:12 +0400)]
qemu_agent: add qemuAgentSSH{Add,Remove,Get}AuthorizedKeys

In QEMU 5.2, the guest agent learned to manipulate a user
~/.ssh/authorized_keys. Bind the JSON API to libvirt.

https://wiki.qemu.org/ChangeLog/5.2#Guest_agent

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirsh: Expose OpenSSH authorized key file mgmt APIs
Michal Privoznik [Tue, 10 Nov 2020 08:25:27 +0000 (09:25 +0100)]
virsh: Expose OpenSSH authorized key file mgmt APIs

The new virsh commands are:

  get-user-sshkeys
  set-user-sshkeys

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoremote: Implement OpenSSH authorized key file mgmt APIs
Michal Privoznik [Mon, 9 Nov 2020 21:23:44 +0000 (22:23 +0100)]
remote: Implement OpenSSH authorized key file mgmt APIs

Since both APIs accept/return an array of strings we can't have
client/server dispatch code generated. But implementation is
fairly trivial, although verbose.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoIntroduce OpenSSH authorized key file mgmt APIs
Michal Privoznik [Mon, 9 Nov 2020 19:45:36 +0000 (20:45 +0100)]
Introduce OpenSSH authorized key file mgmt APIs

When setting up a new guest or when a management software wants
to allow access to an existing guest the
virDomainSetUserPassword() API can be used, but that might be not
good enough if user want to ssh into the guest. Not only sshd has
to be configured to accept password authentication (which is
usually not the case for root), user have to type in their
password. Using SSH keys is more convenient. Therefore, two new
APIs are introduced:

virDomainAuthorizedSSHKeysGet() which lists authorized keys for
given user, and

virDomainAuthorizedSSHKeysSet() which modifies the authorized
keys file for given user (append, set or remove keys from the
file).

It's worth nothing that while authorized_keys file entries have
some structure (as defined by sshd(8)), expressing that structure
goes beyond libvirt's focus and thus "keys" are nothing but an
opaque string to libvirt.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemu_conf: fix a typo in comment
Ján Tomko [Wed, 18 Nov 2020 13:59:37 +0000 (14:59 +0100)]
qemu_conf: fix a typo in comment

Ceci n'est pas un objet.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 7db61843b05a6e4295b1d2e27a3d86f162ef04a0
4 years agonews: Mention Cooperlake cpu model in v6.4.0
Han Han [Wed, 28 Oct 2020 07:51:48 +0000 (15:51 +0800)]
news: Mention Cooperlake cpu model in v6.4.0

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoDo not disable incompatible-pointer-types-discards-qualifiers
Martin Kletzander [Thu, 12 Nov 2020 12:58:53 +0000 (13:58 +0100)]
Do not disable incompatible-pointer-types-discards-qualifiers

This reverts commit b3710e9a2af402a2b620de570b062294e11190eb.

That check is very valuable for our code, but it causes issue with glib >=
2.67.0 when building with clang.

The reason is a combination of two commits in glib, firstly fdda405b6b1b which
adds a g_atomic_pointer_{set,get} variants that enforce stricter type
checking (by removing an extra cast) for compilers that support __typeof__, and
commit dce24dc4492d which effectively enabled the new variant of glib's atomic
code for clang.  This will not be necessary when glib's issue #600 [0] (8 years
old) is fixed.  Thankfully, MR #1719 [1], which is supposed to deal with this
issue was opened 3 weeks ago, so there is a slight sliver of hope.

[0] https://gitlab.gnome.org/GNOME/glib/-/issues/600
[1] https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
4 years agoqemu_validate: Deduplicate code for graphics type check
Michal Privoznik [Tue, 17 Nov 2020 10:00:31 +0000 (11:00 +0100)]
qemu_validate: Deduplicate code for graphics type check

Similarly to previous commits, we can utilize domCaps to check if
graphics type is supported.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
4 years agodomcaps: Report egl-headless graphics type
Michal Privoznik [Tue, 17 Nov 2020 10:00:26 +0000 (11:00 +0100)]
domcaps: Report egl-headless graphics type

QEMU supports egl-headless if QEMU_CAPS_EGL_HEADLESS capability
is present. There are some additional requirements but those are
checked for in qemuValidateDomainDeviceDefGraphics() and depend
on domain configuration and thus are not representable in domain
capabilities. Let's stick with plain qemuCaps check then.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
4 years agoqemu_validate: Deduplicate code for RNG model check
Michal Privoznik [Tue, 17 Nov 2020 09:37:10 +0000 (10:37 +0100)]
qemu_validate: Deduplicate code for RNG model check

In my recent commit of 5216304bfe I've moved RNG model check
from domain capabilities validator into qemu validator. During
that I had to basically duplicate RNG model to qemuCaps checks.
Problem with this approach is that after my commit qemu validator
and domCaps are disconnected and thus domCaps might report (in
general) different set of supported RNG models.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
4 years agoqemu_validate: Deduplicate code for video model check
Michal Privoznik [Tue, 17 Nov 2020 09:26:14 +0000 (10:26 +0100)]
qemu_validate: Deduplicate code for video model check

In my recent commit of a33279daa8 I've moved video model check
from domain capabilities validator into qemu validator. During
that I had to basically duplicate video model to qemuCaps checks.
Problem with this approach is that after my commit qemu validator
and domCaps are disconnected and thus domCaps might report (in
general) different set of supported video models.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
4 years agodomain_capabilities: Introduce VIR_DOMAIN_CAPS_ENUM_IS_SET
Michal Privoznik [Tue, 17 Nov 2020 09:23:33 +0000 (10:23 +0100)]
domain_capabilities: Introduce VIR_DOMAIN_CAPS_ENUM_IS_SET

This is a convenient macro for querying whether particular domain
caps enum value is set or not.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
4 years agonodedev: report errors about missing integer properties
Daniel P. Berrangé [Tue, 17 Nov 2020 10:17:48 +0000 (10:17 +0000)]
nodedev: report errors about missing integer properties

The helper methods for getting integer properties ignore a missing
property setting its value to zero. This lack of error reporting
resulted in missing the regression handling hotplug of USB devices
with the vendor and model IDs getting set to zero silently.

The few callers which relied on this silent defaulting have been fixed,
so now we can report fatal errors immediately.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agonodedev: drop DKD_MEDIA_AVAILABLE property check
Daniel P. Berrangé [Tue, 17 Nov 2020 12:22:34 +0000 (12:22 +0000)]
nodedev: drop DKD_MEDIA_AVAILABLE property check

The access of DKD_MEDIA_AVAILABLE for floppy disks, is mistakenly
protected by a check for ID_CDROM_MEDIA, introduced in:

  commit 10427db77983edfaafec74ec13cc5015bab6aa95
  Author: Ján Tomko <jtomko@redhat.com>
  Date:   Fri Jun 3 16:10:21 2016 +0200

    Only return two values in udevGetUintProperty

Thus the check of DKD_MEDIA_AVAILABLE never run. In practice this didn't
matter since this property is set by the DeviceKit-Disks daemon which
was only around for 3 Fedora releases before being killed off around
F13. Thus we can just remove this legacy property.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agonodedev: dont rely on ignoring errors on missing properties
Daniel P. Berrangé [Tue, 17 Nov 2020 11:56:46 +0000 (11:56 +0000)]
nodedev: dont rely on ignoring errors on missing properties

The udevProcessStorage method relies on udevGetIntProperty ignoring
errors about non-existant properties and instead setting the value to
zero. In theory when seeing ID_CDROM=1, you might expect that devices
which are not CDs will get ID_CDROM=0, but that's not what happens in
practice. Instead the property simply won't get set at all.

IOW, the code does not need to care about the value of the property,
merely whether it exists or not.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agonodedev: improve debugging logs from udev device/event processing
Daniel P. Berrangé [Tue, 17 Nov 2020 11:54:54 +0000 (11:54 +0000)]
nodedev: improve debugging logs from udev device/event processing

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoapparmor: allow kvm-spice compat wrapper
Christian Ehrhardt [Mon, 16 Nov 2020 12:21:10 +0000 (13:21 +0100)]
apparmor: allow kvm-spice compat wrapper

'kvm-spice' is a binary name used to call 'kvm' which actually is a wrapper
around qemu-system-x86_64 enabling kvm acceleration. This isn't in use
for quite a while anymore, but required to work for compatibility e.g.
when migrating in old guests.

For years this was a symlink kvm-spice->kvm and therefore covered
apparmor-wise by the existing entry:
   /usr/bin/kvm rmix,
But due to a recent change [1] in qemu packaging this now is no symlink,
but a wrapper on its own and therefore needs an own entry that allows it
to be executed.

[1]: https://salsa.debian.org/qemu-team/qemu/-/commit/9944836d3

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Reviewed-by: Michal Privoznik <mprivozn redhat com>
4 years agotests: Add tests for kvm-poll-control feature
Tim Wiederhake [Fri, 13 Nov 2020 08:49:44 +0000 (09:49 +0100)]
tests: Add tests for kvm-poll-control feature

Update the KVM feature tests for QEMU's kvm-poll-control performance
hint.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: support kvm-poll-control performance hint
Tim Wiederhake [Fri, 13 Nov 2020 08:49:43 +0000 (09:49 +0100)]
qemu: support kvm-poll-control performance hint

QEMU version 4.2 introduced a performance feature under commit
d645e13287 ("kvm: i386: halt poll control MSR support").

This patch adds a new KVM feature 'poll-control' to set this performance
hint for KVM guests. The feature is off by default.

To enable this hint and have libvirt add "-cpu host,kvm-poll-control=on"
to the QEMU command line, the following XML code needs to be added to the
guest's domain description:

  <features>
    <kvm>
      <poll-control state='on'/>
    </kvm>
  </features>

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agonode_device: Use "udev" monitor source
Michal Privoznik [Tue, 17 Nov 2020 11:56:39 +0000 (12:56 +0100)]
node_device: Use "udev" monitor source

In v6.3.0-rc1~67 I've made a switch: instead of listening on udev
events the nodedev driver started listening for kernel events.
This was because when a device changes its name (e.g. NICs) we
will get "move" event with DEVPATH_OLD property set, which we can
then use to remove the old device and thus keep our internal list
up to date. The switch to "kernel" source was made because if the
old NICs naming (eth0, eth1, ...) is enabled (e.g. via
net.ifnames=0 on the kernel cmd line) then udev overwrites the
property with the new name making our internal list go out of
sync. Interestingly, when the od NICs naming is not enabled then
the DEVPATH_OLD contains the correct value.

But as it turns out, "kernel" source might be missing some other
important properties, e.g. USB vendor/product IDs. Therefore,
switch back to "udev" source and wish the best of luck to users
using the old NICs naming.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1897625
Fixes: 9a13704818e4a018723e0ec5b9e97b176f1c8584
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agorpm: enable wireshark build for RHEL-8 and later
Daniel P. Berrangé [Fri, 13 Nov 2020 11:14:29 +0000 (11:14 +0000)]
rpm: enable wireshark build for RHEL-8 and later

wireshark plugin was disabled in RHEL because RHEL-7 was too old, but we
forgot to enable it in RHEL-8 where it builds fine.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agorpm: remove version checks for wireshark
Daniel P. Berrangé [Fri, 13 Nov 2020 11:13:21 +0000 (11:13 +0000)]
rpm: remove version checks for wireshark

We only turn on with_wireshark if we already know the distro is
guaranteed to have new enough packages. The versioned dep is thus not
required.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agomeson: bump min wireshark to 2.6.0
Daniel P. Berrangé [Fri, 13 Nov 2020 11:08:47 +0000 (11:08 +0000)]
meson: bump min wireshark to 2.6.0

If using the declared min version of wireshark, 2.4.0, libvirt plugin
fails to build. This min version isn't present in any supported distros
and thus not tested by CI.

We don't support wireshark on RHEL-7 since it has 1.x.x series. The next
oldest version present in supported distros is 2.6.2 on RHEL-8.

Thus we should bump the min version to 2.6.0. This also lets us assume
that the "plugindir" variable exists in pkg-config.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agomeson: assume pkg-config support for yajl
Daniel P. Berrangé [Fri, 13 Nov 2020 10:43:04 +0000 (10:43 +0000)]
meson: assume pkg-config support for yajl

Per the platform support rules, we no longer need to consider SLES 12 as
a target, and so can now assume pkg-config support in yajl.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoqemu: Remove virQEMUDomainCapsCache code
Michal Privoznik [Fri, 13 Nov 2020 20:22:47 +0000 (21:22 +0100)]
qemu: Remove virQEMUDomainCapsCache code

Now that the domCaps cache is history, this code is no longer
used and thus can be removed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemu: Don't cache domCaps in virQEMUDriverGetDomainCapabilities()
Michal Privoznik [Fri, 13 Nov 2020 20:09:33 +0000 (21:09 +0100)]
qemu: Don't cache domCaps in virQEMUDriverGetDomainCapabilities()

Currently, whenever a domain capabilities is needed (fortunately,
after cleanup done by previous commits it is now only in
virConnectGetDomainCapabilities()), the object is stored in a
cache. But there is no invalidation mechanism for the cache
(except the implicit one - the cache is part of qemuCaps and thus
share its lifetime, but that is not enough). Therefore, if
something changes - for instance new firmware files are
installed, or old are removed these changes are not reflected in
the virConnectGetDomainCapabilities() output.

Originally, the caching was there because domCaps were used
during device XML validation and they were used a lot from our
test suite. But this is no longer the case. And therefore, we
don't need the cache and can construct fresh domCaps on each
virConnectGetDomainCapabilities() call.

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

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoconf: Drop virDomainCapsDeviceDefValidate()
Michal Privoznik [Fri, 13 Nov 2020 19:46:58 +0000 (20:46 +0100)]
conf: Drop virDomainCapsDeviceDefValidate()

Now that nothing uses virDomainCapsDeviceDefValidate() it can be
removed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemu: Validate video model
Michal Privoznik [Fri, 13 Nov 2020 19:43:39 +0000 (20:43 +0100)]
qemu: Validate video model

The aim is to eliminate virDomainCapsDeviceDefValidate(). And in
order to do so, the domain video model has to be validated in
qemuValidateDomainDeviceDefVideo().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemu: Validate RNG model
Michal Privoznik [Fri, 13 Nov 2020 19:29:30 +0000 (20:29 +0100)]
qemu: Validate RNG model

The aim is to eliminate virDomainCapsDeviceDefValidate(). And in
order to do so, the domain RNG model has to be validated in
qemuValidateDomainRNGDef().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemu_tpm.c: fix 'shortName' leak
Daniel Henrique Barboza [Sat, 14 Nov 2020 12:56:41 +0000 (09:56 -0300)]
qemu_tpm.c: fix 'shortName' leak

This is a Coverity fix pointed out by John in IRC. This code
was introduced in 19d74fdf0eb, when the TPM Proxy device for
for ppc64 was introduced.

This will leak in case we have 2 TPMs in the same domain, a
possible scenario with the protected Ultravisor execution in
PowerPC guests.

Fixes: 19d74fdf0eb5d2e89e80ceedea736425160ffccb
Reported-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agotestutils: call va_end before return
Pavel Hrdina [Mon, 16 Nov 2020 15:12:09 +0000 (16:12 +0100)]
testutils: call va_end before return

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovboxGetDriverConnection: unlock vbox_driver_lock before return
Pavel Hrdina [Mon, 16 Nov 2020 15:06:01 +0000 (16:06 +0100)]
vboxGetDriverConnection: unlock vbox_driver_lock before return

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirdevmapper: fix stat comparison in virDMSanitizepath
Pavel Hrdina [Fri, 13 Nov 2020 09:45:30 +0000 (10:45 +0100)]
virdevmapper: fix stat comparison in virDMSanitizepath

Introduced by commit <22494556542c676d1b9e7f1c1f2ea13ac17e1e3e> which
fixed a CVE.

If the @path passed to virDMSanitizepath() is not a DM name or not a
path to DM name this function could return incorrect sanitized path as
it would always be the first device under /dev/mapper/.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoremoteDomainGetFSInfo: remove unreachable cleanup code
Pavel Hrdina [Mon, 16 Nov 2020 16:16:35 +0000 (17:16 +0100)]
remoteDomainGetFSInfo: remove unreachable cleanup code

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoremoteDomainGetIOThreadInfo: remove unreachable cleanup code
Pavel Hrdina [Mon, 16 Nov 2020 16:15:51 +0000 (17:15 +0100)]
remoteDomainGetIOThreadInfo: remove unreachable cleanup code

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemuProcessHandleGraphics: no need to check for NULL
Pavel Hrdina [Fri, 13 Nov 2020 09:25:23 +0000 (10:25 +0100)]
qemuProcessHandleGraphics: no need to check for NULL

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agointerface_backend_udev: refactor udevListInterfacesByStatus
Pavel Hrdina [Mon, 16 Nov 2020 13:48:10 +0000 (14:48 +0100)]
interface_backend_udev: refactor udevListInterfacesByStatus

Commit <2f3b7a5555c4cf4127ff3f8e00746eafcc91432c> replaced VIR_STRDUP
by g_strdup which made the error: path mostly useless.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agohyperv_wmi: remove unreachable cleanup code
Pavel Hrdina [Fri, 13 Nov 2020 09:58:12 +0000 (10:58 +0100)]
hyperv_wmi: remove unreachable cleanup code

In the cleanup section @data will always be NULL.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agodomain_conf: fix NULL dereference on error in virDomainObjCopyPersistentDef
Pavel Hrdina [Wed, 11 Mar 2020 12:25:59 +0000 (13:25 +0100)]
domain_conf: fix NULL dereference on error in virDomainObjCopyPersistentDef

The issue was introduced together with the function itself by commit
<da1eba6bc8f58bfce34136710d1979a3a44adb17>.  Calling
`virDomainObjGetPersistentDef` may return NULL which is later passed
to `virDomainDefFormat` where the `def` attribute is marked as NONNULL
and later in `virDomainDefFormatInternalSetRootName` it is actually
defererenced without any other check.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agodomain_conf: remove unused rc variable
Pavel Hrdina [Fri, 13 Nov 2020 09:15:25 +0000 (10:15 +0100)]
domain_conf: remove unused rc variable

Leftover after commit <479a8c1fa1e0f58d3165c0446cd1abd72160256e>.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemu: backup: Install bitmap for incremental backup to appropriate node only
Peter Krempa [Tue, 10 Nov 2020 07:55:03 +0000 (08:55 +0100)]
qemu: backup: Install bitmap for incremental backup to appropriate node only

Libvirt's backup code has two modes:

1) push - where qemu actively writes the difference since the checkpoint
          into the output file

2) pull - where we instruct qemu to expose a frozen disk state along
          with a bitmap of blocks which changed since the checkpoint

For push mode qemu needs the temporary bitmap we use where we calculate
the actual changes to be present on the block node backing the disk.

For pull mode where we expose the bitmap via NBD qemu actually wants the
bitmap to be present for the exported block node which is the scratch
file.

Until now we've calculated the bitmap twice and installed it both to the
scratch file and to the disk node, but we don't need to since we know
when it's needed.

Pass in the 'pull' flag and decide where to install the bitmap according
to it and also when to register the bitmap name with the blockjob.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoNEWS: Mention change of default for TLS certificate verification
Peter Krempa [Fri, 13 Nov 2020 14:24:51 +0000 (15:24 +0100)]
NEWS: Mention change of default for TLS certificate verification

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: conf: Enable 'backup_tls_x509_verify' by default
Peter Krempa [Fri, 13 Nov 2020 14:20:58 +0000 (15:20 +0100)]
qemu: conf: Enable 'backup_tls_x509_verify' by default

The NBD server used to export pull-mode backups doesn't have any other
form of client authentication on top of the TLS transport, so the only
way to authenticate clients is to verify their certificate.

Enable this option by defauilt when both 'backup_tls_x509_verify' and
'default_tls_x509_verify' were not configured.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1879477
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoqemu: conf: Enable 'migrate_tls_x509_verify' by default
Peter Krempa [Fri, 13 Nov 2020 14:20:58 +0000 (15:20 +0100)]
qemu: conf: Enable 'migrate_tls_x509_verify' by default

The migration stream connection and also the NBD server for non-shared
storage migration don't have any other form of client authentication on
top of the TLS transport, so the only way to authenticate clients is to
verify their certificate.

Enable this option by defauilt when both 'migrate_tls_x509_verify' and
'default_tls_x509_verify' were not configured.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1879477
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoqemu: conf: Enable 'chardev_tls_x509_verify' by default
Peter Krempa [Fri, 13 Nov 2020 14:20:58 +0000 (15:20 +0100)]
qemu: conf: Enable 'chardev_tls_x509_verify' by default

Chardevs don't have any other form of client authentication on top of
the TLS transport, so the only way to authenticate clients is to verify
their certificate.

Enable this option by defauilt when both 'chardev_tls_x509_verify' and
'default_tls_x509_verify' were not configured.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1879477
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: conf: Clarify default of "vnc_tls_x509_verify"
Peter Krempa [Fri, 13 Nov 2020 14:18:37 +0000 (15:18 +0100)]
qemu: conf: Clarify default of "vnc_tls_x509_verify"

If both "vnc_tls_x509_verify" and "default_tls_x509_verify" are missing
from the config file the client certificate validation is disabled. VNC
provides a layer of authentication so client certificate validation is
not strictly required.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: conf: Allow individual control of default value for *_tls_x509_verify
Peter Krempa [Fri, 13 Nov 2020 14:13:29 +0000 (15:13 +0100)]
qemu: conf: Allow individual control of default value for *_tls_x509_verify

Store whether "default_tls_x509_verify" was provided and enhance the
SET_TLS_VERIFY_DEFAULT macro so that indiviual users can provide their
own default if "default_tls_x509_verify" config option was not provided.

For now we keep setting it to 'false'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuDomainControllerIsBusy: Fully populate switch statement
Peter Krempa [Fri, 13 Nov 2020 13:16:45 +0000 (14:16 +0100)]
qemuDomainControllerIsBusy: Fully populate switch statement

Typecast the controller type variable to the appropriate type and add
the missing controller types for future extension.

Note that we currently allow only unplug of
VIR_DOMAIN_CONTROLLER_TYPE_SCSI thus the other controller types which
are not implemented return false now.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuDomainDiskControllerIsBusy: Optimize checking for SCSI hostdevs
Peter Krempa [Fri, 13 Nov 2020 13:15:19 +0000 (14:15 +0100)]
qemuDomainDiskControllerIsBusy: Optimize checking for SCSI hostdevs

Iterate through hostdevs only when the controller type is
VIR_DOMAIN_CONTROLLER_TYPE_SCSI.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuDomainDiskControllerIsBusy: Fix logic of matching disk bus to controller type
Peter Krempa [Fri, 13 Nov 2020 13:07:40 +0000 (14:07 +0100)]
qemuDomainDiskControllerIsBusy: Fix logic of matching disk bus to controller type

The tests which match the disk bus to the controller type were backwards
in this function. This meant that any disk bus type (such as
VIR_DOMAIN_DISK_BUS_SATA) would not skip the controller index comparison
even if the removed controller was of a different type.

Switch the internals to a switch statement with selects the controller
type in the first place and a proper type so that new controller types
are added in the future.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1870072
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuDomain(Disk)ControllerIsBusy: Fix function header format
Peter Krempa [Fri, 13 Nov 2020 12:53:57 +0000 (13:53 +0100)]
qemuDomain(Disk)ControllerIsBusy: Fix function header format

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agodocs: kbase: Reorder some articles in the 'Usage' section
Peter Krempa [Wed, 4 Nov 2020 16:31:57 +0000 (17:31 +0100)]
docs: kbase: Reorder some articles in the 'Usage' section

Historically we've added them in chronological order, but certain
articles are more likely to be needed and thus are easier to find when
placed earlier.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodocs: css: Modify appearance of the kbase directory page
Peter Krempa [Mon, 3 Aug 2020 10:01:39 +0000 (12:01 +0200)]
docs: css: Modify appearance of the kbase directory page

Re-style the knowledge base to look like the 'docs.html' page.

We still have room to add one more column.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodocs: xsl: Unify stylability of main container element
Peter Krempa [Wed, 4 Nov 2020 15:27:32 +0000 (16:27 +0100)]
docs: xsl: Unify stylability of main container element

page.xsl was adding '<div id="content">' wrapper for the content picked
up from the <body> element from the original input file. Optionally
class="$DOCNAME" was added for some documents taken from <body>.

Since docs generated from RST by docutils have a '<div class='document'
id='$DOCNAME>' we actually don't need an extra wrapper for them.

Additionally if we standardize on one of them we can use the same styles
for both. I've picked the latter because it makes more sense to use the
document name as 'id'.

This patch:
1) Modifies the XSL trasformation to add the wrapper only if it's not
   present.

2) Modifies the XSL transformation to use 'id' for document name and
   class='document' for the wrapper element.

3) Changes docs.html/index.html/hvsupport.html to use 'id' instead of
   'class' for document name.

4) Modifies the main stylesheet to keep styling the elements properly

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodocs: kbase: Split articles into sections
Peter Krempa [Wed, 4 Nov 2020 14:51:17 +0000 (15:51 +0100)]
docs: kbase: Split articles into sections

Split the existing list of kbase articles into a 'Usage' category and
into 'Internals/Debugging'. This will later represent the two columns on
the web page.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodocs: kbase: Remove extra container from index page
Peter Krempa [Wed, 4 Nov 2020 14:37:46 +0000 (15:37 +0100)]
docs: kbase: Remove extra container from index page

The container was used to apply CSS classes to the content, so the looks
are degraded. The idea is to have a similar layout to the 'docs.html'
page with multiple columns, which will be added later.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodocs: kbase: Move index page to docs/kbase
Peter Krempa [Wed, 4 Nov 2020 14:18:29 +0000 (15:18 +0100)]
docs: kbase: Move index page to docs/kbase

Move docs/kbase.rst to docs/kbase/index.rst so that the directory itself
shows our index page rather than the autogenerated list of files by the
webserver.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodocs: css: Add a gray box around table of contents of RST based docs
Peter Krempa [Mon, 3 Aug 2020 06:33:58 +0000 (08:33 +0200)]
docs: css: Add a gray box around table of contents of RST based docs

Emphasise the table of contents visually.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodocs: xslt: Use 'Link' rather than 'Permalink' in header links
Peter Krempa [Tue, 3 Nov 2020 13:28:21 +0000 (14:28 +0100)]
docs: xslt: Use 'Link' rather than 'Permalink' in header links

The anchors are based on the article or chapter headers, thus they are
not 100% permanent. Especially with pages generated from RST.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodocs: Fix title of 'docs' page
Peter Krempa [Wed, 4 Nov 2020 13:33:21 +0000 (14:33 +0100)]
docs: Fix title of 'docs' page

XSLT transformation generates the page title from the topmost <h1>
element which is not present in 'docs.html.in'. Add it and hide it in
the CSS.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agonews: Fix vertical and horizontal spacing
Andrea Bolognani [Mon, 16 Nov 2020 11:42:09 +0000 (12:42 +0100)]
news: Fix vertical and horizontal spacing

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
4 years agonews: Document apparmor improvements in v6.7.0
Jianan Gao [Mon, 16 Nov 2020 01:17:34 +0000 (09:17 +0800)]
news: Document apparmor improvements in v6.7.0

Add news about apparmor improvements.

Signed-off-by: Jianan Gao <jgao@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoutil: Make virFileClose() quiet on success
Andrea Bolognani [Thu, 12 Nov 2020 18:42:00 +0000 (19:42 +0100)]
util: Make virFileClose() quiet on success

While it's certainly good to log events like "failed to close fd"
and "tried to close invalid fd", which are likely to be the
consequence of some bug in libvirt, logging a message every single
time a file descriptor is closed successfully is perhaps excessive
and can lead to useful information being missed among the noise.

Log filters don't help in this situation, because filtering out all
of util.file is too big a hammer and would cause important messages
to be left out as well.

To give an idea of just how much noise this single debug statement
can cause, here's a real life example from a quite large libvirtd
log I had to look at recently:

  $ grep virFile libvirt.log | wc -l
  1307
  $ grep virFile libvirt.log | grep -v 'Closed fd' | wc -l
  343

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: remove ATTRIBUTE_NONNULL from virDirClose declaration
Laine Stump [Fri, 13 Nov 2020 17:13:59 +0000 (12:13 -0500)]
util: remove ATTRIBUTE_NONNULL from virDirClose declaration

Before commit 24d8968c, virDirClose took a DIR**, and that was never
NULL, so its declaration included ATTRIBUTE_NONNULL(1). Since that
commit, virDirClose takes a DIR*, and it may be NULL (e.g. if the DIR*
is initialized to NULL and was never closed).

Even though virDirClose() is currently only called implicitly (as the
cleanup for a g_autoptr(DIR)), and (as I've just newly learned) the
autocleanup function g_autoptr will only be called if the pointer in
question is non-null (see the definition of
_GLIB_AUTOPTR_CLEAR_FUNC_NAME in
/usr/include/glib-2.0/glib/gmacros.h), it does still cause Coverity to
complain that it *could* be called with a NULL, and it's also possible
that in the future someone might add code that explicitly calls
virDirClose.

To eliminate the Coverity complaints, and protect against the
hypothetical future where someone both explicitly calls virDirClose()
with a potentially NULL value, *and* re-enables the nonnull directive
when not building with Coverity (disabled by commit eefb881) this
patch removes the ATTRIBUTE_NONNULL(1) from the declaration of
virDirClose().

Fixes: 24d8968cd0a718af4badbbc858b1b449fea7205a
Reported-by: John Ferlan <jferlan@redhat.com>
Details-Research-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Laine Stump <laine@redhat.com>
4 years agoqemu_driver.c: do not redefine 'event' in qemuDomainDefineXMLFlags()
Daniel Henrique Barboza [Fri, 13 Nov 2020 17:46:49 +0000 (14:46 -0300)]
qemu_driver.c: do not redefine 'event' in qemuDomainDefineXMLFlags()

A bad merge while rebasing 74b2834333a caused the @event variable
to be defined twice, inside the 'cleanup' label, causing coverity
errors.

This code was originally moved outside of the label by commit
773c7c43611a. Delete the unintended code in the 'cleanup'
label.

Fixes: 74b2834333ab3bf500f870e0a6d4e8309379d96a
Reported-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agokbase: Shorten "less verbose QEMU logging" example
Andrea Bolognani [Fri, 13 Nov 2020 15:27:24 +0000 (16:27 +0100)]
kbase: Shorten "less verbose QEMU logging" example

Rationale for the changes:

  * access can be filtered out entirely, as nothing very
    interesting is produced by the only other component in the
    same package (access.accessdriverpolkit);

  * util.udev doesn't exist.

Related filters are also more consistently grouped together.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirnetdevopenvswitch: Fix ATTRIBUTE_NONNULL() tag for virNetDevOpenvswitchGetVhostuse...
Michal Privoznik [Fri, 13 Nov 2020 17:10:29 +0000 (18:10 +0100)]
virnetdevopenvswitch: Fix ATTRIBUTE_NONNULL() tag for virNetDevOpenvswitchGetVhostuserIfname()

After e4c29e2904 the function has one argument more and the
argument that can't be NULL moved from second to third position.

Reported-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodocs: compiling.html: pass -d to xz to decompress
Jonathan Watt [Fri, 13 Nov 2020 13:30:45 +0000 (13:30 +0000)]
docs: compiling.html: pass -d to xz to decompress

tar on macOS recognizes XZ compression automatically, but that is
not the case for GNU tar (1.32 at least).  On Fedora 33 the current
instructions result in the following error:

  $ xz -c libvirt-6.9.0.tar.xz | tar xvf -
  tar: Archive is compressed. Use -J option
  tar: Error is not recoverable: exiting now

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Jonathan Watt <jwatt@jwatt.org>
4 years agoqemu_domain.c: modernize qemuMonitorGetCpuHalted()
Daniel Henrique Barboza [Thu, 12 Nov 2020 21:19:40 +0000 (18:19 -0300)]
qemu_domain.c: modernize qemuMonitorGetCpuHalted()

Use g_autoptr() and remove the 'cleanup' label.

Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemu_domain.c: modernize qemuDomainWriteMasterKeyFile()
Daniel Henrique Barboza [Thu, 12 Nov 2020 21:14:54 +0000 (18:14 -0300)]
qemu_domain.c: modernize qemuDomainWriteMasterKeyFile()

Use VIR_AUTOCLOSE with 'fd' and delete the 'cleanup' label.

Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemu_domain.c: modernize qemuDomainFixupCPUs()
Daniel Henrique Barboza [Thu, 12 Nov 2020 20:50:58 +0000 (17:50 -0300)]
qemu_domain.c: modernize qemuDomainFixupCPUs()

Use g_autoptr() to deprecate the 'cleanup' label.

Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemu_domain.c: remove unneeded cleanup labels
Daniel Henrique Barboza [Thu, 12 Nov 2020 20:37:31 +0000 (17:37 -0300)]
qemu_domain.c: remove unneeded cleanup labels

Remove obsolete 'cleanup' labels after the changes from the
previous patch.

Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemu_domain.c: use g_autoptr() with virDomainDef pointers
Daniel Henrique Barboza [Thu, 12 Nov 2020 20:27:04 +0000 (17:27 -0300)]
qemu_domain.c: use g_autoptr() with virDomainDef pointers

Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemu_snapshot.c: remove uneeded 'cleanup' label in qemuSnapshotDelete()
Daniel Henrique Barboza [Thu, 12 Nov 2020 18:45:41 +0000 (15:45 -0300)]
qemu_snapshot.c: remove uneeded 'cleanup' label in qemuSnapshotDelete()

Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>