]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
2 years agoconf: virdomainobjlist: Introduce 'virDomainObjListCollectAll'
Peter Krempa [Wed, 13 Jul 2022 13:18:56 +0000 (15:18 +0200)]
conf: virdomainobjlist: Introduce 'virDomainObjListCollectAll'

Introduce a helper which will return a list of all domain objects inside
of the list without filtering and thus without the need to lock
individual members.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agoconf: virdomainobjlist: Convert header to contemporary style
Peter Krempa [Thu, 4 Aug 2022 13:25:08 +0000 (15:25 +0200)]
conf: virdomainobjlist: Convert header to contemporary style

Use the new style which doesn't require re-aligning the argument list
once you change the return type.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agodatatypes: Clean up whitespace in definition of struct _virConnect
Peter Krempa [Thu, 7 Jul 2022 14:00:23 +0000 (16:00 +0200)]
datatypes: Clean up whitespace in definition of struct _virConnect

Remove extraneous spaces and put comment on a single line.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agodatatypes: Simplify error path of 'virGetDomain'
Peter Krempa [Thu, 4 Aug 2022 13:47:31 +0000 (15:47 +0200)]
datatypes: Simplify error path of 'virGetDomain'

'virObjectNew' can't return NULL. If we pre-check the arguments we don't
need a cleanup label.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agonwfilter: use time_t for timeout for consistency
Shaleen Bathla [Wed, 28 Dec 2022 14:47:12 +0000 (20:17 +0530)]
nwfilter: use time_t for timeout for consistency

Coverity scan reports:
"A time_t value is stored in an integer with too few bits to accommodate
it. The expression timeout is cast to unsigned int"

We are already casting and storing time_t timeout variable into unsigned int.
We can use time_t for timeout and cast it to unsigned long (should be big enough)
instead of unsigned int in sscanf, g_strdup_printf as required.

Signed-off-by: Shaleen Bathla <shaleen.bathla@oracle.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Fix Commnad -> Command typo
Martin Kletzander [Thu, 5 Jan 2023 13:14:06 +0000 (14:14 +0100)]
qemu: Fix Commnad -> Command typo

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu: fix several codecheck in qemu_monitor.c
Jiang Jiacheng [Thu, 8 Dec 2022 12:52:35 +0000 (20:52 +0800)]
qemu: fix several codecheck in qemu_monitor.c

1.clear passwd in debug log
2.alignment
3.use the same variable name for function definition and declaration

Signed-off-by: Jiang Jiacheng <jiangjiacheng@huawei.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agostorage/util: replace unnecessary while loop by if
Jiang Jiacheng [Thu, 5 Jan 2023 11:51:08 +0000 (19:51 +0800)]
storage/util: replace unnecessary while loop by if

These while loops exit directly due to break after entering.
Use if instead of these while loops.

Signed-off-by: Jiang Jiacheng <jiangjiacheng@huawei.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoremote: fix misspelling in the documation of 'daemonCreateClientStream'
Jiang Jiacheng [Thu, 5 Jan 2023 11:51:07 +0000 (19:51 +0800)]
remote: fix misspelling in the documation of 'daemonCreateClientStream'

Fix a misspelling in the documation of 'daemonCreateClientStream'.

Signed-off-by: Jiang Jiacheng <jiangjiacheng@huawei.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemuProcessLaunch: fix a misspelling in log
Jiang Jiacheng [Thu, 5 Jan 2023 11:51:06 +0000 (19:51 +0800)]
qemuProcessLaunch: fix a misspelling in log

Signed-off-by: Jiang Jiacheng <jiangjiacheng@huawei.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu_namespace: Move umount() call into #fdef __linux__
Michal Privoznik [Thu, 5 Jan 2023 15:23:58 +0000 (16:23 +0100)]
qemu_namespace: Move umount() call into #fdef __linux__

In a recent commit I've introduced an umount() call. But the
function where the call lives is compiled on all OSes, not just
Linux. But umount() is Linux specific. Other OSes have unmount
(FreeBSD), or maybe something else. But since namespaces are
Linux specific, we can wrap the call in #ifdef __linux__ and not
care about other OSes.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2 years agovirQEMUDriverGetDomainCapabilities: Validate arguments
Michal Privoznik [Thu, 22 Dec 2022 09:25:38 +0000 (10:25 +0100)]
virQEMUDriverGetDomainCapabilities: Validate arguments

When calling virConnectGetDomainCapabilities() (exposed as virsh
domcapabilities) users have option to specify whatever sub-set of
{ emulatorbin, arch, machine, virttype } they want. Then we have
a logic (hidden in virQEMUCapsCacheLookupDefault()) that picks
qemuCaps that satisfy values passed by user. And whatever was not
specified is then set to the default value as specified by picked
qemuCaps. For instance: if no machine type was provided but
emulatorbin was, then the machine type is set to the default one
as defined by the emulatorbin.

Or, when just virttype was set then the remaining three values
are set to their respective defaults. Except, we have a crasher
in this case:

  # virsh domcapabilities --virttype hvf
  error: Disconnected from qemu:///system due to end of file
  error: failed to get emulator capabilities
  error: End of file while reading data: Input/output error

This is because for 'hvf' virttype (at least my) QEMU does not
have any machine type. Therefore, @machine is set to NULL and the
rest of the code does not expect that.

What we can do about this is to validate all arguments. Well,
except for the emulatorbin which is obtained from passed
qemuCaps. This also fixes the issue when domcapabilities for a
virttype of a different driver are requested, or a different
arch.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu_namespace: Fix detection of nested mount points
Michal Privoznik [Tue, 3 Jan 2023 14:51:42 +0000 (15:51 +0100)]
qemu_namespace: Fix detection of nested mount points

When deciding whether to bind mount a path in domain's namespace,
we look at the QEMU mount table (/proc/$pid/mounts) and try to
match prefix of given path with one of mount points. Well, we
do that in a bit clumsy way. For instance, if there's
"/dev/hugepages" already mounted inside the namespace and we are
deciding whether to bind mount "/dev/hugepages1G/..." we decide
to skip over the path and NOT bind mount it. This is because
plain STRPREFIX() is used and yes, the former is prefix of the
latter. What we need to check also is whether the next character
after the prefix is slash.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu_namespace: Umount the original /dev before replacing it with tmpfs
Michal Privoznik [Fri, 16 Dec 2022 13:58:25 +0000 (14:58 +0100)]
qemu_namespace: Umount the original /dev before replacing it with tmpfs

Our code relies on mount events propagating into the namespace we
create for a domain. However, there's one caveat. In v8.8.0-rc1~8
I've tried to make us detect differences in mount tables between
the namespace in which libvirtd runs and the domain namespace.
This is crucial for any mounts that happen after the domain was
started (for instance new hugetlbfs can be mounted on say
/dev/hugepages1G).

Therefore, we take a look into /proc/$(pgrep qemu)/mounts to see
what filesystems are mounted under /dev. Now, since we don't
umount the original /dev, just mount a tmpfs over it, we get all
the events (e.g. aforementioned hugetlbfs mount on
/dev/hugepages1G), but we are not really able to access it
because of the tmpfs that's placed on top. This then confuses our
algorithm for detecting which filesystems are mounted (the
algorithm is implemented in qemuDomainGetPreservedMounts()).

To break the link between host's and guest's /dev we just need to
umount() the original /dev in the namespace. Just before our
artificially created tmpfs is moved into its place.

Fixes: 46b03819ae8d833b11c2aaccb2c2a0361727f51b
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2151869#c6
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu_capabilities: Report Hyper-V Enlightenments in domcapabilities
Michal Privoznik [Wed, 21 Dec 2022 15:09:29 +0000 (16:09 +0100)]
qemu_capabilities: Report Hyper-V Enlightenments in domcapabilities

Inside of qemuCaps (for the corresponding accelerator) we have
full host CPU expansion stored, among with supported Hyper-V
Enlightenments. To report them in the domain capabilities, we
just have to pick those starting with "hv-" and see if we know
them.

You may notice that neither of our domaincapsdata test shows any
enlightenment. This is because the test works by parsing
corresponding qemucapabilitiesdata/caps_*.xml file and none of
these store the full host CPU expansion (hostCPU.fullQEMU)
because that is runtime piece of information and not formatted
into virQEMUCaps XML.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1717611
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu_capabilities: Query for Hyper-V Enlightenments
Michal Privoznik [Mon, 19 Dec 2022 14:48:02 +0000 (15:48 +0100)]
qemu_capabilities: Query for Hyper-V Enlightenments

Now that we have qemuMonitorGetCPUModelExpansion() aware of
Hyper-V Enlightenments, we can start querying it. Two conditions
need to be met:

  1) KVM is in use,
  2) Arch is either x86 or arm.

It may look like modifying the first call to
qemuMonitorGetCPUModelExpansion() inside of
virQEMUCapsProbeQMPHostCPU() would be sufficient but it is not.
We really need to ask QEMU for full expansion and the first call
does not guarantee that.

For the test data, I've just copied whatever
'query-cpu-model-expansion' returned earlier, therefore there are
no hv-* props. But that's okay - the full expansion is not stored
in cache (and thus not formatted in
tests/qemucapabilitiesdata/caps_*.replies files either). This is
purely runtime thing.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemuMonitorJSONGetCPUModelExpansion: Introduce @hv_passthrough argument
Michal Privoznik [Mon, 19 Dec 2022 14:27:08 +0000 (15:27 +0100)]
qemuMonitorJSONGetCPUModelExpansion: Introduce @hv_passthrough argument

This continues and finishes propagation of the @hv_passthrough
argument started in the previous commit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemuMonitorJSONMakeCPUModel: Introduce @hv_passthrough argument
Michal Privoznik [Mon, 19 Dec 2022 13:45:45 +0000 (14:45 +0100)]
qemuMonitorJSONMakeCPUModel: Introduce @hv_passthrough argument

Apart from setting @migratable prop to the
query-cpu-model-expansion command, we will need @hv-passthrough
so that we can query for expansion of Hyper-V Enlightenments
supported on the current host. The idea is to run:

{
  "execute": "query-cpu-model-expansion",
  "arguments": {
    "type": "full",
    "model": {
      "name": "host",
      "props": {
        "hv-passthrough": true
      }
    }
  }
}

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agodomain_capabilities: Expose Hyper-V Enlightenments
Michal Privoznik [Wed, 21 Dec 2022 14:14:54 +0000 (15:14 +0100)]
domain_capabilities: Expose Hyper-V Enlightenments

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agovirDomainCapsEnumFormat: Retrun void
Michal Privoznik [Thu, 5 Jan 2023 07:37:16 +0000 (08:37 +0100)]
virDomainCapsEnumFormat: Retrun void

The virDomainCapsEnumFormat() function does not return anything
but zero and none of its callers is interested in the failure
anyways. Switch its return type from integer to void.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agovirDomainCapsEnumFormat: Switch to virXMLFormatElement()
Michal Privoznik [Thu, 5 Jan 2023 07:31:27 +0000 (08:31 +0100)]
virDomainCapsEnumFormat: Switch to virXMLFormatElement()

We are formatting <enum/> element and its children using
virBufferAddLit(), virBufferAsprintf(), virBufferAdjustIndent(),
etc. Well, we can avoid that when switching to
virXMLFormatElement().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agovirQEMUCapsLoadCache: Parse <selfvers/> properly
Michal Privoznik [Tue, 3 Jan 2023 16:54:57 +0000 (17:54 +0100)]
virQEMUCapsLoadCache: Parse <selfvers/> properly

In a recent commit, when ditching virXPathULong() the parsing of
<selfvers/> was changed. But it was changed to virXMLPropUInt()
which is not correct because the value we're interested in is not
in an attribute but element itself.

Fixes: a3c7426839df25f4026707c5877be75f2461f5e9
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2 years agoutil: qemu: Remove 'skipKey' argument from virQEMUBuildCommandLineJSONArrayFormatFunc...
Peter Krempa [Mon, 19 Dec 2022 08:59:36 +0000 (09:59 +0100)]
util: qemu: Remove 'skipKey' argument from virQEMUBuildCommandLineJSONArrayFormatFunc prototype

Since we really only need to handle key skipping in the top level object
the caller doesn't at this point even pass it to the array formatting
helper function. Remove the unused argument.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agovirqemu: Don't strip the requested key from nested objects
Peter Krempa [Fri, 16 Dec 2022 16:00:26 +0000 (17:00 +0100)]
virqemu: Don't strip the requested key from nested objects

Skipping of a specific key is needed only for the top level object to
specially handle the object type. We must not pass it to any recursed
printing of nested objects as skipping keys there might be surprising
and also is unhandlable later when formatting the commandline.

Until now this did not pose a problem but was discovered when adding a
new netdev backend which has a nested config object which also has the
'type' key which was being skipped.

Modern usage will prefer JSON directly but fix the commandline generator
to prevent surprises.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu_capabilities: Decrease scope of @hash in virQEMUCapsProbeQMPHostCPU()
Michal Privoznik [Wed, 21 Dec 2022 08:55:50 +0000 (09:55 +0100)]
qemu_capabilities: Decrease scope of @hash in virQEMUCapsProbeQMPHostCPU()

The @hash variable inside of virQEMUCapsProbeQMPHostCPU() is used
only within a block, but declared at the beginning of the
function. Bring the variable declaration into the said block.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agodomain_capabilities: s/qemuDomainCapsFeatureFormatSimple/virDomainCapsFeatureFormatSi...
Michal Privoznik [Wed, 21 Dec 2022 14:15:58 +0000 (15:15 +0100)]
domain_capabilities: s/qemuDomainCapsFeatureFormatSimple/virDomainCapsFeatureFormatSimple/

There's nothing qemu specific about
qemuDomainCapsFeatureFormatSimple() and in fact, the function
lives in hypervisor agnostic location and thus mustn't have qemu
prefix.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agodocs: Recommend static seclabels for migration on shared storage
Michal Privoznik [Wed, 21 Dec 2022 07:31:01 +0000 (08:31 +0100)]
docs: Recommend static seclabels for migration on shared storage

There are some network FSs (ceph, CIFS) that propagate XATTRs
properly and thus SELinux labels too. In such case using dynamic
seclabels would get in the way of migration as new seclabel is
assigned to the domain on the destination and thus two processes
with different labels (the source and the destination QEMU/helper
process) would try to access the same file. One of them is
necessarily going to be denied access.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu_security: Drop qemuSecurityStartTPMEmulator()
Michal Privoznik [Wed, 14 Dec 2022 09:35:20 +0000 (10:35 +0100)]
qemu_security: Drop qemuSecurityStartTPMEmulator()

After previous cleanup this function is no longer used and thus
can be dropped.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu_tpm: Open code qemuSecurityStartTPMEmulator()
Michal Privoznik [Wed, 14 Dec 2022 09:33:51 +0000 (10:33 +0100)]
qemu_tpm: Open code qemuSecurityStartTPMEmulator()

When starting swtpm binary, the qemuSecurityStartTPMEmulator() is
called which sets seclabel on the TPM state and then uses
qemuSecurityCommandRun() to execute the swtpm binary with proper
seclabel. Well, the aim is to ditch
qemuSecurityStartTPMEmulator() because it entangles two distinct
operations. Just call functions for them separately.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu_tpm: Restore TPM labels on failed start
Michal Privoznik [Wed, 14 Dec 2022 14:12:38 +0000 (15:12 +0100)]
qemu_tpm: Restore TPM labels on failed start

If swtpm binary fails to start after successful exec() (e.g. it
fails to initialize itself), the seclabels set in
qemuSecurityStartTPMEmulator() are not restored. This is due to
lacking qemuSecurityRestoreTPMLabels() call in the error path.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu_security: Introduce qemuSecuritySetTPMLabels()
Michal Privoznik [Wed, 14 Dec 2022 09:27:57 +0000 (10:27 +0100)]
qemu_security: Introduce qemuSecuritySetTPMLabels()

Now that we have qemuSecurityRestoreTPMLabels() we might as well
have qemuSecuritySetTPMLabels(). The aim here is to remove
qemuSecurityStartTPMEmulator() which couples two separate things
into a single function call.

Therefore, introduce qemuSecuritySetTPMLabels() which does only
set seclabels on the TPM state.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu_security: Rename qemuSecurityCleanupTPMEmulator()
Michal Privoznik [Wed, 14 Dec 2022 09:18:54 +0000 (10:18 +0100)]
qemu_security: Rename qemuSecurityCleanupTPMEmulator()

The qemuSecurityCleanupTPMEmulator() function calls
virSecurityManagerRestoreTPMLabels() and thus the proper name is
qemuSecurityRestoreTPMLabels(). Rename it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu_security: Rework qemuSecurityCleanupTPMEmulator()
Michal Privoznik [Wed, 14 Dec 2022 13:53:10 +0000 (14:53 +0100)]
qemu_security: Rework qemuSecurityCleanupTPMEmulator()

Currently, qemuSecurityCleanupTPMEmulator() returns nothing which
means a caller (well, there's only one - qemuExtTPMStop()) can't
produce a warning when restoring seclabels on TPM state failed.
True, qemuSecurityCleanupTPMEmulator() does report a warning
itself, but only in one specific error path.

Make the function return an integer, just like the rest of
qemuSecurity*Restore() functions.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu: Use '-machine hpet=off' instead of '-no-hpet'
Peter Krempa [Tue, 3 Jan 2023 09:03:06 +0000 (10:03 +0100)]
qemu: Use '-machine hpet=off' instead of '-no-hpet'

qemu is about to deprecate the '-no-hpet' option in favor of configuring
the timer via '-machine'.

Use the QEMU_CAPS_MACHINE_HPET capability to switch to the new syntax
and mask out the old QEMU_CAPS_NO_HPET capability at the same time to
prevent using the old syntax.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
2 years agoqemu: capabilities: Introduce QEMU_CAPS_MACHINE_HPET capability
Peter Krempa [Tue, 3 Jan 2023 08:51:33 +0000 (09:51 +0100)]
qemu: capabilities: Introduce QEMU_CAPS_MACHINE_HPET capability

The capability represents that qemu accepts the configuration of the
HPET timer via -machine hpet=on/off rather than the
soon-to-be-deprecated '-no-hpet' option.

The capability is detected from 'query-command-line-options' which
recently added the 'hpet' option.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
2 years agotests: qemucapabilitiesdata: Add test data for the qemu-8.0 dev cycle
Peter Krempa [Wed, 14 Dec 2022 08:44:23 +0000 (09:44 +0100)]
tests: qemucapabilitiesdata: Add test data for the qemu-8.0 dev cycle

Add test data based on qemu commit v7.2.0-333-g222059a0fc

- query-command-line-options now reports more accurate data
- machine types for the 8.0 cycle were added
- vhost-vdpa device support was added
- default value of 'noreboot' changed from 'true' to 'false'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoTranslated using Weblate (Korean)
김인수 [Sun, 1 Jan 2023 08:20:06 +0000 (09:20 +0100)]
Translated using Weblate (Korean)

Currently translated at 100.0% (10368 of 10368 strings)

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

Co-authored-by: 김인수 <simmon@nplob.com>
Signed-off-by: 김인수 <simmon@nplob.com>
2 years agoTranslated using Weblate (German)
Ettore Atalan [Sun, 1 Jan 2023 08:20:05 +0000 (09:20 +0100)]
Translated using Weblate (German)

Currently translated at 47.7% (4953 of 10368 strings)

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

Co-authored-by: Ettore Atalan <atalanttore@googlemail.com>
Signed-off-by: Ettore Atalan <atalanttore@googlemail.com>
2 years agoTranslated using Weblate (Finnish)
Jan Kuparinen [Sun, 1 Jan 2023 08:20:04 +0000 (09:20 +0100)]
Translated using Weblate (Finnish)

Currently translated at 22.8% (2369 of 10368 strings)

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

Co-authored-by: Jan Kuparinen <copper_fin@hotmail.com>
Signed-off-by: Jan Kuparinen <copper_fin@hotmail.com>
2 years agoFix null pointer dereference in virXMLPropStringRequired
Gedalya [Tue, 3 Jan 2023 11:39:36 +0000 (19:39 +0800)]
Fix null pointer dereference in virXMLPropStringRequired

Fixes: 65eaf58335f
Signed-off-by: Gedalya <gedalya@gedalya.net>
2 years agorpc: Check client limits in more places
Martin Kletzander [Mon, 2 Jan 2023 15:23:08 +0000 (16:23 +0100)]
rpc: Check client limits in more places

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2033879
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agorpc: Fix error message in virNetServerSetClientLimits
Martin Kletzander [Mon, 2 Jan 2023 15:21:24 +0000 (16:21 +0100)]
rpc: Fix error message in virNetServerSetClientLimits

That way it actually fits with what the condition checks for.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: Check error message in virnetdaemontest
Martin Kletzander [Mon, 2 Jan 2023 15:26:31 +0000 (16:26 +0100)]
tests: Check error message in virnetdaemontest

This way we actually check for the proper error, not any error like invalid JSON
format.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoFix test case to actually test something
Martin Kletzander [Mon, 2 Jan 2023 14:03:25 +0000 (15:03 +0100)]
Fix test case to actually test something

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemumonitortestutils: Fix line counting in qemuMonitorTestProcessFileEntries()
Michal Privoznik [Wed, 21 Dec 2022 10:08:02 +0000 (11:08 +0100)]
qemumonitortestutils: Fix line counting in qemuMonitorTestProcessFileEntries()

It just so happens that our JSON snippets in
qemucapabilitiesdata/*.replies files are separated by an empty
line. These empty lines are then overwritten to make a single
line JSON. Nevertheless, the line counter @line is not
incremented which then leads to a misleading numbers in errors.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agosecret: Inhibit shutdown for ephemeral secrets
Michal Privoznik [Tue, 20 Dec 2022 08:04:48 +0000 (09:04 +0100)]
secret: Inhibit shutdown for ephemeral secrets

Our secret driver divides secrets into two groups: ephemeral
(stored only in memory) and persistent (stored on disk). Now, the
aim of ephemeral secrets is to define them shortly before being
used and then undefine them. But 'shortly before being used' is a
very vague time frame. And since we default to socket activation
and thus pass '--timeout 120' to every daemon it may happen that
just defined ephemeral secret is gone among with the virtsecretd.

This is no problem for persistent secrets as their definition
(and value) is restored when the virtsecretd starts again, but
ephemeral secrets can't be restored.

Therefore, we could view ephemeral secrets as active objects that
the daemon manages and thus inhibit automatic shutdown (just like
hypervisor daemons do when a guest is running).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agolibxl: adjust 'ich6' sound card name
Marek Marczykowski-Górecki [Tue, 20 Dec 2022 22:52:06 +0000 (23:52 +0100)]
libxl: adjust 'ich6' sound card name

Xen 4.17 has strict parsing of 'soundhw' option that allows only
specific values (instead of passing through any value directly to
qemu's -soundhw option, it uses -device now). For 'intel-hda' audio
device, it requires "hda" string. "hda" works with older libxl too.
Other supported models are the same as in libvirt XML.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agolibxl: add validation if sound device is supported
Marek Marczykowski-Górecki [Tue, 20 Dec 2022 22:52:05 +0000 (23:52 +0100)]
libxl: add validation if sound device is supported

Xen supports only subset of libvirt's sound devices, and starting with
Xen 4.17 it is enforced by libxl. Verify it early.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agovirSecretGetSecretString: Refactor cleanup
Peter Krempa [Thu, 8 Dec 2022 11:28:13 +0000 (12:28 +0100)]
virSecretGetSecretString: Refactor cleanup

Automatically free 'sec' and remove the 'cleanup' section and 'ret'
variables.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodatatypes: Register autoptr cleanup for virSecret
Peter Krempa [Thu, 8 Dec 2022 11:27:23 +0000 (12:27 +0100)]
datatypes: Register autoptr cleanup for virSecret

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirStorageBackendRBDOpenRADOSConn: Don't log the RBD key
Peter Krempa [Fri, 9 Dec 2022 15:49:12 +0000 (16:49 +0100)]
virStorageBackendRBDOpenRADOSConn: Don't log the RBD key

'virStorageBackendRBDRADOSConfSet' logs its arguments but it's also
used to set the RBD secret/key.

All the security theatre with securely erasing the string we do to fetch
the secret would be quite pointless if we log it thus introduce
virStorageBackendRBDRADOSConfSetQuiet and use it to avoid logging the
password.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirCryptoEncryptDataAESgnutls: Properly initialize data structures
Peter Krempa [Thu, 8 Dec 2022 11:37:30 +0000 (12:37 +0100)]
virCryptoEncryptDataAESgnutls: Properly initialize data structures

The initialization vector is not optional thus we also don't need to
check whether the caller passed it in. Additionally we can use c99
initializers for the gnutls_datum_t structs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirCryptoEncryptDataAESgnutls: Don't secure erase gnutls_datum_t structs
Peter Krempa [Thu, 8 Dec 2022 09:56:28 +0000 (10:56 +0100)]
virCryptoEncryptDataAESgnutls: Don't secure erase gnutls_datum_t structs

'gnutls_datum_t' simply holds pointers to the encryption key and its
length. There's absolutely no point in securely erasing that.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: add tests for external swtpm
Ján Tomko [Mon, 17 Oct 2022 14:05:08 +0000 (16:05 +0200)]
qemu: add tests for external swtpm

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: add external backend for tpm
Ján Tomko [Mon, 17 Oct 2022 13:20:24 +0000 (15:20 +0200)]
qemu: add external backend for tpm

Introduce a new backend type 'external' for connecting to a swtpm daemon
not managed by libvirtd.

Mostly in one commit, thanks to -Wswitch and the way we generate
capabilities.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agotests: qemucapabilitiesdata: Final update of qemu-7.2 capabilities on x86
Peter Krempa [Mon, 28 Nov 2022 08:18:24 +0000 (09:18 +0100)]
tests: qemucapabilitiesdata: Final update of qemu-7.2 capabilities on x86

QEMU 7.2 was released, update the capabilities data to the final state.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agokbase: Reorder deployments
Andrea Bolognani [Wed, 14 Dec 2022 18:31:47 +0000 (19:31 +0100)]
kbase: Reorder deployments

List the various options so that the most likely ones come
first.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2 years agokbase: Reorder sections
Andrea Bolognani [Wed, 14 Dec 2022 18:30:07 +0000 (19:30 +0100)]
kbase: Reorder sections

Users are likely more interested in the main deployment
scenarios than in the detailed list of every existing RPM
package. Reorder sections accordingly.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2 years agoqemu: tpm: fix spacing
Ján Tomko [Mon, 17 Oct 2022 13:02:17 +0000 (15:02 +0200)]
qemu: tpm: fix spacing

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2 years agodocs: replace footer link to the bird site with mastodon
Daniel P. Berrangé [Mon, 12 Dec 2022 11:44:14 +0000 (11:44 +0000)]
docs: replace footer link to the bird site with mastodon

Since the takeover of the bird site, the bulk of tech people who want
a more friendly and inclusive media site have jumped over to Mastodon.
With its decentralized nature, there's no one replacement that captures
everything, but the fosstodon.org site is a topic relevant choice.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agospec: List more directories
Andrea Bolognani [Tue, 13 Dec 2022 10:09:40 +0000 (11:09 +0100)]
spec: List more directories

The storage-backend/ and storage-file/ directories are currently
considered unowned by RPM. Have the libvirt-daemon package take
ownership of them, just as it already owns the connection-driver/
and lock-driver/ directories.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2 years agospec: Add trailing backslash
Andrea Bolognani [Tue, 13 Dec 2022 10:09:27 +0000 (11:09 +0100)]
spec: Add trailing backslash

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2 years agovirnuma: Allow multiple nodes for preferred policy
Michal Privoznik [Fri, 9 Dec 2022 13:41:24 +0000 (14:41 +0100)]
virnuma: Allow multiple nodes for preferred policy

In the past, the preferred policy
(VIR_DOMAIN_NUMATUNE_MEM_PREFERRED) required exactly one (host)
NUMA node. This made sense because:

  1) the libnuma API - numa_set_preferred() allowed exactly one
     node, because
  2) corresponding kernel syscall (__NR_set_mempolicy) accepted
     exactly one node (for MPOL_PREFERRED mode).

But things have changed since then. Firstly, kernel introduced
new MPOL_PREFERRED_MANY mode (v5.15-rc1~107^2~21) which was then
exposed in libnuma as numa_set_preferred_many() (v2.0.15~24).

Fortunately, libnuma also exposes numa_has_preferred_many() which
returns whether the kernel has support for the new mode (1) or
not (0).

Putting this all together, we can lift our check for sufficiently
new kernel and libnuma.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2151064
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu_migration: Fix p2p post-copy recovery
Jiri Denemark [Fri, 9 Dec 2022 23:04:41 +0000 (00:04 +0100)]
qemu_migration: Fix p2p post-copy recovery

Although the qemuMigrationSrcPerformResume actually got called
indirectly via qemuMigrationSrcPerformNative and the recovery process
worked, wrong job phases were used for the "perform" phase, which could
cause issues when libvirt daemon crashed (or was otherwise restarted)
during post-copy recovery.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu_migration: Move qemuMigrationSrcPerformResume up
Jiri Denemark [Mon, 12 Dec 2022 12:52:07 +0000 (13:52 +0100)]
qemu_migration: Move qemuMigrationSrcPerformResume up

It will need to be called from a place above its current definition.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu: Don't warn when releasing a released job
Jiri Denemark [Wed, 7 Dec 2022 11:33:13 +0000 (12:33 +0100)]
qemu: Don't warn when releasing a released job

When qemuDomainObjReleaseAsyncJob is called when the current async job
is already released we emit quite useless warning which was implemented
to warn about releasing a job owned by another thread.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agocpu: Improve debug message in virCPUGetVendorForModel
Jiri Denemark [Wed, 7 Dec 2022 11:31:17 +0000 (12:31 +0100)]
cpu: Improve debug message in virCPUGetVendorForModel

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu: Fix warning in qemuMigrationDstPostcopyFailed
Jiri Denemark [Mon, 5 Dec 2022 11:17:56 +0000 (12:17 +0100)]
qemu: Fix warning in qemuMigrationDstPostcopyFailed

The function is called even if QEMU reports migration as
postcopy-paused, i.e., it's not migrating anymore. And while changing
the warning, we can drop the part about unattended migration to make the
warning shorter and consistent with qemuMigrationSrcPostcopyFailed.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu_process: add tray changed event to queue in refresh disks
Kristina Hanicova [Tue, 13 Dec 2022 12:40:26 +0000 (13:40 +0100)]
qemu_process: add tray changed event to queue in refresh disks

There are some cases when the internal state of disks can change
without qemu sending events about it (e.g. a disk can close
during reset). In case this happens, we should emit an event
about the modified disk.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1824722#c20

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoTranslated using Weblate (Korean)
김인수 [Wed, 7 Dec 2022 12:17:14 +0000 (13:17 +0100)]
Translated using Weblate (Korean)

Currently translated at 100.0% (10368 of 10368 strings)

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

Translated using Weblate (Korean)

Currently translated at 100.0% (10368 of 10368 strings)

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

Co-authored-by: 김인수 <simmon@nplob.com>
Signed-off-by: 김인수 <simmon@nplob.com>
2 years agoTranslated using Weblate (Korean)
Ján Tomko [Wed, 7 Dec 2022 12:17:13 +0000 (13:17 +0100)]
Translated using Weblate (Korean)

Currently translated at 100.0% (10368 of 10368 strings)

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

Translated using Weblate (Chinese (Simplified) (zh_CN))

Currently translated at 98.9% (10255 of 10368 strings)

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

Translated using Weblate (Swedish)

Currently translated at 51.8% (5400 of 10423 strings)

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

Translated using Weblate (Korean)

Currently translated at 99.9% (10366 of 10368 strings)

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

Translated using Weblate (Japanese)

Currently translated at 98.8% (10247 of 10368 strings)

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

Co-authored-by: Jan Tomko <jtomko@redhat.com>
Co-authored-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Jan Tomko <jtomko@redhat.com>
2 years agorpc: securely erase the message buffers
Daniel P. Berrangé [Mon, 12 Dec 2022 10:23:46 +0000 (05:23 -0500)]
rpc: securely erase the message buffers

While only a couple of the message types include sensitive data,
the overhead of calling secure erase is not noticable enough
to worry about making the erasure selective per type. Thus it is
simplest to unconditionally securely erase the buffer.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agorpc: fix buffer offset updates after decoding payload
Daniel P. Berrangé [Mon, 12 Dec 2022 10:21:49 +0000 (05:21 -0500)]
rpc: fix buffer offset updates after decoding payload

The buffer length refers to the allocated buffer memory size,
while the offset refers to have much of the buffer we have
read/written. After reading the message payload we must thus
update the latter.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoutil: implement secure erase with explicit_bzero
Daniel P. Berrangé [Mon, 12 Dec 2022 10:20:36 +0000 (05:20 -0500)]
util: implement secure erase with explicit_bzero

This is available on at least FreeBSD and GLibc >= 2.25.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: Provide default values for nonexistent xenlight pkgconfig vars
Michal Privoznik [Mon, 12 Dec 2022 11:46:41 +0000 (12:46 +0100)]
meson: Provide default values for nonexistent xenlight pkgconfig vars

It may happen that xenlight pkgconfig file does not contain
'xenfirmwaredir' and/or 'libexec_bin' variables, which is okay
and we have code that deals with this situation. But that code is
executed when the queried value is an empty string. This may not
always be the case and we should specifically set 'default_value'
so that the empty string is returned if pkgconfig variable
doesn't exist.

Fixes: 968479adcfa5c49b29b7b6680dcaffde1408f044
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoformatcaps: Update capabilities example
Michal Privoznik [Mon, 12 Dec 2022 09:54:35 +0000 (10:54 +0100)]
formatcaps: Update capabilities example

In the formatcaps.rst we give an example output of capabilities.
Well, there are couple of issues with it:

1) We show <features/> nested under /capabilities/host/cpu.
   There's no such element and never was.

2) The ordering of elements is corrupted.

3) There is plenty of elements missing.

Fix these by showing an actual output of 'virsh capabilities' as
obtained on my machine.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agorpm: switch to using %mingw_find_lang
Daniel P. Berrangé [Mon, 12 Dec 2022 10:52:49 +0000 (10:52 +0000)]
rpm: switch to using %mingw_find_lang

We currently list the locale file paths via a wildcard in %files, but the
normal pattern for mingw RPMs in Fedora is to use %mingw_find_lang.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for BPF_CGROUP_DEVICE
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for BPF_CGROUP_DEVICE

The BPF_CGROUP_DEVICE constant was introduced to Linux in

  commit ebc614f687369f9df99828572b1d85a7c2de3d92
  Author: Roman Gushchin <roman.gushchin@linux.dev>
  Date:   Sun Nov 5 08:15:32 2017 -0500

    bpf, cgroup: implement eBPF-based device controller for cgroup v2

This is old enough that all our supported platforms can be assumed
to have this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for BPF_PROG_QUERY
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for BPF_PROG_QUERY

The BPF_PROG_QUERY constant was introduced to Linux in

  commit defd9c476fa6b01b4eb5450452bfd202138decb7
  Author: Alexei Starovoitov <ast@kernel.org>
  Date:   Mon Oct 2 22:50:26 2017 -0700

    libbpf: sync bpf.h

This is old enough that all our supported platforms can be assumed
to have this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for VHOST_VSOCK_SET_GUEST_CID
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for VHOST_VSOCK_SET_GUEST_CID

The VHOST_VSOCK_SET_GUEST_CID constant was introduced to Linux in

  commit 433fc58e6bf2c8bd97e57153ed28e64fd78207b8
  Author: Asias He <asias@redhat.com>
  Date:   Thu Jul 28 15:36:34 2016 +0100

    VSOCK: Introduce vhost_vsock.ko

This is old enough that all our supported platforms can be assumed
to have this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for linux/magic.h
Daniel P. Berrangé [Thu, 8 Dec 2022 12:37:26 +0000 (12:37 +0000)]
meson: remove obsolete check for linux/magic.h

The linux/magic.h header has existed since

  commit e18fa700c9a31360bc8f193aa543b7ef7b39a06b
  Author: Jeff Garzik <jeff@garzik.org>
  Date:   Sun Sep 24 11:13:19 2006 -0400

    Move several *_SUPER_MAGIC symbols to include/linux/magic.h.

This is old enough that all our supported platforms can be assumed
to have this header.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for DEVLINK_CMD_ESWITCH_GET
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for DEVLINK_CMD_ESWITCH_GET

The DEVLINK_CMD_ESWITCH_GET constant was introduced to Linux in

  commit adf200f31c000d707e4afe238ed1d1199e0cce7c
  Author: Jiri Pirko <jiri@mellanox.com>
  Date:   Thu Feb 9 15:54:33 2017 +0100

    devlink: fix the name of eswitch commands

This is old enough that all our supported platforms can be assumed
to have this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: simplify check for virnetdevbridge.c headers
Daniel P. Berrangé [Thu, 8 Dec 2022 10:07:19 +0000 (10:07 +0000)]
meson: simplify check for virnetdevbridge.c headers

The headers required by virnetdevbridge.c have all exited since
before Linux moved to git. It is sufficient to check for just
one of them in order to give an error message about needing
kernel headers installed.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for GET_VLAN_VID_CMD
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for GET_VLAN_VID_CMD

The GET_VLAN_VID_CMD constant has existed since before Linux moved
to git.

This is old enough that all our supported platforms can be assumed
to have this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for ETHTOOL_GCOALESCE
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for ETHTOOL_GCOALESCE

The ETHTOOL_GCOALESCE constant has existed since before Linux moved
to git.

This is old enough that all our supported platforms can be assumed
to have this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for ETHTOOL_GFEATURES
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for ETHTOOL_GFEATURES

The ETHTOOL_GFEATURES constant was introduced to Linux in

  commit 5455c6998d34dc983a8693500e4dffefc3682dc5
  Author: Michał Mirosław <mirq-linux@rere.qmqm.pl>
  Date:   Tue Feb 15 16:59:17 2011 +0000

    net: Introduce new feature setting ops

This is old enough that all our supported platforms can be assumed
to have this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for ETH_FLAG_RXHASH
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for ETH_FLAG_RXHASH

The ETH_FLAG_RXHASH constant was introduced to Linux in

  commit b00fabb4020d17bda4bea59507e09fadf573088d
  Author: stephen hemminger <shemminger@vyatta.com>
  Date:   Mon Mar 29 14:47:27 2010 +0000

    netdev: ethtool RXHASH flag

This is old enough that all our supported platforms can be assumed
to have this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for ETH_FLAG_NTUPLE
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for ETH_FLAG_NTUPLE

The ETH_FLAG_NTUPLE constant was introduced to Linux in

  commit 15682bc488d4af8c9bb998844a94281025e0a333
  Author: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
  Date:   Wed Feb 10 20:03:05 2010 -0800

    ethtool: Introduce n-tuple filter programming support

This is old enough that all our supported platforms can be assumed
to have this feature.

A typo in the existing condition "NTUBLE" instead of "NTUPLE" meant the
code was never enabled in the first place, which is an illustration of
why it is worth eliminating redundant conditional checks.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for ETH_FLAG_TXVLAN/RXVLAN
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for ETH_FLAG_TXVLAN/RXVLAN

The ETH_FLAG_TXVLAN/RXVLAN constants were introduced to Linux in

  commit d5dbda23804156ae6f35025ade5307a49d1db6d7
  Author: Jesse Gross <jesse@nicira.com>
  Date:   Wed Oct 20 13:56:07 2010 +0000

    ethtool: Add support for vlan accleration.

This is old enough that all our supported platforms can be assumed
to have this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for ETH_FLAG_LRO
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for ETH_FLAG_LRO

The ETH_FLAG_LRO constant was introduced to Linux in

  commit 3ae7c0b2e3747b50c3a6c63ebb67469e0a6b3203
  Author: Jeff Garzik <jeff@garzik.org>
  Date:   Wed Aug 15 16:00:51 2007 -0700

    [ETHTOOL]: Add ETHTOOL_[GS]FLAGS sub-ioctls

This is old enough that all our supported platforms can be assumed
to have this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for ETHTOOL_GFLAGS
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for ETHTOOL_GFLAGS

The ETHTOOL_GFLAGS constant was introduced to Linux in

  commit 3ae7c0b2e3747b50c3a6c63ebb67469e0a6b3203
  Author: Jeff Garzik <jeff@garzik.org>
  Date:   Wed Aug 15 16:00:51 2007 -0700

    [ETHTOOL]: Add ETHTOOL_[GS]FLAGS sub-ioctls

This is old enough that all our supported platforms can be assumed
to have this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for ETHTOOL_GGRO
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for ETHTOOL_GGRO

The ETHTOOL_GGRO constant was introduced to Linux in

  commit b240a0e5644eb817c4a397098a40e1ad42a615bc
  Author: Herbert Xu <herbert@gondor.apana.org.au>
  Date:   Mon Dec 15 23:44:31 2008 -0800

    ethtool: Add GGRO and SGRO ops

This is old enough that all our supported platforms can be assumed
to have this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for ETHTOOL_GGSO
Daniel P. Berrangé [Thu, 8 Dec 2022 09:45:20 +0000 (09:45 +0000)]
meson: remove obsolete check for ETHTOOL_GGSO

The ETHTOOL_GGSO constant was introduced to Linux in

  commit 37c3185a02d4b85fbe134bf5204535405dd2c957
  Author: Herbert Xu <herbert@gondor.apana.org.au>
  Date:   Thu Jun 22 03:07:29 2006 -0700

    [NET]: Added GSO toggle

This is old enough that all our supported platforms can be assumed
to have this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agonetdev: simplify check for ethtool functionality
Daniel P. Berrangé [Thu, 8 Dec 2022 09:42:09 +0000 (09:42 +0000)]
netdev: simplify check for ethtool functionality

ethtool is a Linux specific feature that has existed since before Linux
moved to git. Checking against SIOCETHTOOL + WITH_STRUCT_IFREQ is
overkill for our needs.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: drop check for unshare()
Daniel P. Berrangé [Thu, 8 Dec 2022 09:17:37 +0000 (09:17 +0000)]
meson: drop check for unshare()

The unshare() syscall was introduced to Linux in

  commit 2da436e00f9a5fdd0fb6b31e4b2b2ba82e8f5ab8
  Author: JANAK DESAI <janak@us.ibm.com>
  Date:   Tue Feb 7 12:59:03 2006 -0800

    [PATCH] unshare system call -v5: system call registration for i386

This is old enough that all our supported platforms can be assumed
to have this feature. Furthermore, the virprocess.c file was already
using unshare() with nothing more than a #ifdef __linux__ check.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for LO_FLAGS_AUTOCLEAR
Daniel P. Berrangé [Thu, 8 Dec 2022 09:12:25 +0000 (09:12 +0000)]
meson: remove obsolete check for LO_FLAGS_AUTOCLEAR

The LO_FLAGS_AUTOCLEAR constant was introduced to Linux in

  commit 96c5865559cee0f9cbc5173f3c949f6ce3525581
  Author: David Woodhouse <dwmw2@infradead.org>
  Date:   Wed Feb 6 01:36:27 2008 -0800

    Allow auto-destruction of loop devices

This is old enough that all our supported platforms can be assumed
to have this feature. For added fun this whole meson check was
semantically insane because EPOLL_CLOEXEC is not a valid arg
to unshare().

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for EPOLL_CLOEXEC
Daniel P. Berrangé [Thu, 8 Dec 2022 09:12:25 +0000 (09:12 +0000)]
meson: remove obsolete check for EPOLL_CLOEXEC

The EPOLL_CLOEXEC constant was introduced to Linux in

  commit a0998b50c3f0b8fdd265c63e0032f86ebe377dbf
  Author: Ulrich Drepper <drepper@redhat.com>
  Date:   Wed Jul 23 21:29:27 2008 -0700

    flag parameters: epoll_create

This is old enough that all our supported platforms can be assumed
to have this feature. For added fun this whole meson check was
semantically insane because EPOLL_CLOEXEC is not a valid arg
to unshare().

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agomeson: remove obsolete check for LOOP_CTL_GET_FREE
Daniel P. Berrangé [Thu, 8 Dec 2022 09:03:23 +0000 (09:03 +0000)]
meson: remove obsolete check for LOOP_CTL_GET_FREE

The LOOP_CTL_GET_FREE constant was introduced to Linux in

  commit 770fe30a46a12b6fb6b63fbe1737654d28e84844
  Author: Kay Sievers <kay.sievers@vrfy.org>
  Date:   Sun Jul 31 22:08:04 2011 +0200

    loop: add management interface for on-demand device allocation

This is old enough that all our supported platforms can be assumed
to have this feature. As a plus point, this meson check is going
to start failing with future GCC. It fails to set _GNU_SOURCE, thus
'unshare' is not defined by the header, and its relying on an
implicit function decl. For added fun this whole meson check was
semantically insane because LOOP_CTL_GET_FREE is not a valid arg
to unshare().

Fixes https://fedoraproject.org/wiki/Toolchain/PortingToModernC
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: Add missing elements to formatcaps.rst
Nobuhiro MIKI [Fri, 9 Dec 2022 05:36:26 +0000 (14:36 +0900)]
docs: Add missing elements to formatcaps.rst

Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agovirnetdevtap.c: Disallow pre-existing TAP devices
Michal Privoznik [Thu, 8 Dec 2022 14:35:36 +0000 (15:35 +0100)]
virnetdevtap.c: Disallow pre-existing TAP devices

When starting a guest with <interface/> which has the target
device name set (i.e. not generated by us), it may happen that
the TAP device already exists. This then may lead to all sorts of
problems. For instance: for <interface type='network'/> the TAP
device is plugged into the network's bridge, but since the TAP
device is persistent it remains plugged there even after the
guest is shut off. We don't have a code that unplugs TAP devices
from the bridge because TAP devices we create are transient, i.e.
are removed automatically when QEMU closes their FD.

The only exception is <interface type='ethernet'/> with <target
managed='no'/> where we specifically want to let users use
pre-created TAP device and basically not touch it at all.

There's another reason for denying to use a pre-created TAP
devices: if we ever have bug in TAP name generation, we may
re-use a TAP device from another domain.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2144738
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>