]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
21 months agoqemu: S390 does not provide physical address size
Boris Fiuczynski [Fri, 14 Jul 2023 14:38:14 +0000 (16:38 +0200)]
qemu: S390 does not provide physical address size

Commit be1b7d5b18 introduced parsing /proc/cpuinfo for "address size"
which is not including on S390 and therefore reports an internal error.
Lets remove the parsing on S390.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Collin Walling <walling@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
21 months agoconf: domcaps: Add 'async-teardown' domain capability
Boris Fiuczynski [Mon, 17 Jul 2023 15:12:08 +0000 (17:12 +0200)]
conf: domcaps: Add 'async-teardown' domain capability

Add async-teardown to the features list in domain capabilities allowing
high level management to introspect the availability of the asynchronous
teardown feature.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
21 months agoqemu: Add NUMA node automatically for memory hotplug
Michal Privoznik [Thu, 13 Jul 2023 08:10:38 +0000 (10:10 +0200)]
qemu: Add NUMA node automatically for memory hotplug

Up until v2.11.0-rc2~19^2~3 QEMU used to require at least one
NUMA node to be configured when memory hotplug was enabled. After
that commit, QEMU automatically adds a NUMA node if none was
specified on the cmd line. Reflect this in domain XML, i.e.
explicitly add a NUMA node into our domain definition if needed.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2216236
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
21 months agodocs: expand clangd instructions
Jonathon Jongsma [Fri, 14 Jul 2023 15:42:15 +0000 (10:42 -0500)]
docs: expand clangd instructions

Add some additional information about running clangd for LSP when clang
is not your normal compiler.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-By: Tim Small <tim@seoss.co.uk>
21 months agoTranslated using Weblate (Georgian)
Temuri Doghonadze [Tue, 11 Jul 2023 17:34:18 +0000 (17:34 +0000)]
Translated using Weblate (Georgian)

Currently translated at 3.9% (408 of 10395 strings)

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

Signed-off-by: Temuri Doghonadze <temuri.doghonadze@gmail.com>
21 months agoTranslated using Weblate (Georgian)
Mariam Low-Ghelaghutashvili [Tue, 11 Jul 2023 17:33:16 +0000 (17:33 +0000)]
Translated using Weblate (Georgian)

Currently translated at 3.8% (405 of 10395 strings)

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

Signed-off-by: Mariam Low-Ghelaghutashvili <mariamlow@zusmail.xyz>
21 months agoTranslated using Weblate (Georgian)
Temuri Doghonadze [Tue, 11 Jul 2023 17:32:37 +0000 (17:32 +0000)]
Translated using Weblate (Georgian)

Currently translated at 3.8% (405 of 10395 strings)

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

Signed-off-by: Temuri Doghonadze <temuri.doghonadze@gmail.com>
21 months agoTranslated using Weblate (Georgian)
Mariam Low-Ghelaghutashvili [Tue, 11 Jul 2023 17:32:36 +0000 (19:32 +0200)]
Translated using Weblate (Georgian)

Currently translated at 3.8% (403 of 10395 strings)

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

Co-authored-by: Mariam Low-Ghelaghutashvili <mariamlow@zusmail.xyz>
Signed-off-by: Mariam Low-Ghelaghutashvili <mariamlow@zusmail.xyz>
21 months agodocs: Reword ninja invocation note to clarify build directory
Tim Small [Thu, 13 Jul 2023 11:00:04 +0000 (12:00 +0100)]
docs: Reword ninja invocation note to clarify build directory

Minor rewording to clarify purpose of the -C flag in the ninja
invocation, whilst retaining previous meaning.

Signed-off-by: Tim Small <tim@seoss.co.uk>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
21 months agodocs: Fix deprecated use of implicit meson "setup" command
Tim Small [Thu, 13 Jul 2023 11:00:03 +0000 (12:00 +0100)]
docs: Fix deprecated use of implicit meson "setup" command

Use the explicit meson "setup" command instead of the deprecated
implicit invocation. The implied setup usage generates a warning with
meson version 1.0.1:

WARNING: Running the setup command as `meson [options]` instead of
`meson setup [options]` is ambiguous and deprecated.

Additionally the implicit command is likely to be confusing to those
unfamiliar with Meson - the `build` argument in `meson build` resembles
an action rather than an arbitrary path.

Signed-off-by: Tim Small <tim@seoss.co.uk>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
21 months agodocs: Point to mailing list archives from submitting-patches
Tim Small [Thu, 13 Jul 2023 11:00:02 +0000 (12:00 +0100)]
docs: Point to mailing list archives from submitting-patches

Suggest that new contributors should review past patch submissions for
typical style, feedback etc. prior to submitting. Link to archives.

Signed-off-by: Tim Small <tim@seoss.co.uk>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
21 months agodocs: Advise running CI tests prior to submission
Tim Small [Thu, 13 Jul 2023 11:00:01 +0000 (12:00 +0100)]
docs: Advise running CI tests prior to submission

In the preparing patches section, note that it is possible to run CI
tests via gitlab prior to submitting patches.

Signed-off-by: Tim Small <tim@seoss.co.uk>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
21 months agodocs: Reword "Preparing Patches" to clarify
Tim Small [Thu, 13 Jul 2023 11:00:00 +0000 (12:00 +0100)]
docs: Reword "Preparing Patches" to clarify

Clarify that patches should apply cleanly to the master branch. Give
guidance for typical bug fix process for existing releases.

Signed-off-by: Tim Small <tim@seoss.co.uk>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
21 months agodocs: Add config instructions for clangd with libvirt
Tim Small [Thu, 13 Jul 2023 10:59:59 +0000 (11:59 +0100)]
docs: Add config instructions for clangd with libvirt

In build environments which use gcc as the default compiler, use of the
clangd LSP server (for enhanced code editing and navigation etc.) with
libvirt requires some additional configuration.  Detail this and link
from `hacking.rst`.

Signed-off-by: Tim Small <tim@seoss.co.uk>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
21 months agodocs: Point to compiling guide from code contribution guide
Tim Small [Thu, 13 Jul 2023 10:59:58 +0000 (11:59 +0100)]
docs: Point to compiling guide from code contribution guide

The "hacking" doc details where to find the code, but not how to compile
it - link to the instructions contained in `compiling.rst`.

Signed-off-by: Tim Small <tim@seoss.co.uk>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
21 months agodocs: Link main "contributing" from programming-specific guide
Tim Small [Thu, 13 Jul 2023 10:59:57 +0000 (11:59 +0100)]
docs: Link main "contributing" from programming-specific guide

There are two guides to contributing: `hacking.rst` is focused on code
contributions, and `contributing.rst` is more general. Clarify scope of
`hacking.rst` and link to the general guide in its references.

Signed-off-by: Tim Small <tim@seoss.co.uk>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
21 months agodocs: Missing "full-stop"/"period" on some bullet items
Tim Small [Thu, 13 Jul 2023 10:59:56 +0000 (11:59 +0100)]
docs: Missing "full-stop"/"period" on some bullet items

Signed-off-by: Tim Small <tim@seoss.co.uk>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
21 months agodocs: Link to main docs directory from Quick Links
Tim Small [Thu, 13 Jul 2023 10:59:55 +0000 (11:59 +0100)]
docs: Link to main docs directory from Quick Links

Whilst the "docs" documentation map is linked in the navigation bar,
users may scroll down and lose sight of this, so also place at the
bottom of the "Quick Links" section.

Signed-off-by: Tim Small <tim@seoss.co.uk>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
21 months agonodedev: update mdevs from the mdevctl thread
Jonathon Jongsma [Thu, 6 Jul 2023 14:16:35 +0000 (09:16 -0500)]
nodedev: update mdevs from the mdevctl thread

Rather than directly executing mdevctl from the udev event thread when
we determine that we need to re-query, schedule the mdevctl thread to
run. This also helps to coalesce multiple back-to-back updates into a
single one when there are multiple updates in a row or at startup when a
host has a very large number of mdevs.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
21 months agonodedev: refactor mdevctl thread functions
Jonathon Jongsma [Wed, 5 Jul 2023 20:35:59 +0000 (15:35 -0500)]
nodedev: refactor mdevctl thread functions

Factor out a new scheduleMdevctlUpdate() function so that we can re-use
it from other places. Now that other events can make it necessary to
re-query mdevctl for mdev updates, this function will be useful for
coalescing multiple updates in quick succession into a single mdevctl
query.

Also rename a couple functions. The names weren't very descriptive of
their behavior. For example, the old scheduleMdevctlHandler() function
didn't actually schedule anything, it just started a thread. So rename
it to free up the 'schedule' name for the above refactored function.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
21 months agonodedev: transient mdev update on nodeDeviceCreateXML
Boris Fiuczynski [Fri, 30 Jun 2023 11:34:00 +0000 (13:34 +0200)]
nodedev: transient mdev update on nodeDeviceCreateXML

Update the optional mdev attributes by running an mdevctl update on a
new created nodedev object representing an mdev.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2143158
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
21 months agoqemu_domain: Deduplicate targetNode check in qemuDomainDefValidateMemoryHotplugDevice()
Michal Privoznik [Thu, 13 Jul 2023 08:29:11 +0000 (10:29 +0200)]
qemu_domain: Deduplicate targetNode check in qemuDomainDefValidateMemoryHotplugDevice()

If a domain has NUMA configured, then all <memory/> devices
(except for 'virtio-pmem') need to have targetNode set. There are
two checks inside of qemuDomainDefValidateMemoryHotplugDevice()
for this: one inside of big switch() statement, which only checks
'dimm' and 'nvdimm' cases, and the other at the end of the
function that checks all models (except for 'virtio-pmem'). Let's
keep the latter and remove the former as the latter covers the
former too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
21 months agolibxl: Advertise support for VIR_MIGRATE_CHANGE_PROTECTION
Jim Fehlig [Wed, 12 Jul 2023 21:15:08 +0000 (15:15 -0600)]
libxl: Advertise support for VIR_MIGRATE_CHANGE_PROTECTION

The libxl driver has basic support for VIR_MIGRATE_CHANGE_PROTECTION
by starting and stopping modify jobs in the begin/confirm and prepare/finish
phases of migration, but it doesn't advertise that support. This can result
in unterminated jobs because the migration logic skips phases of migration
when the VIR_MIGRATE_CHANGE_PROTECTION feature is absent. Ensure jobs are
terminated properly by advertising support for VIR_MIGRATE_CHANGE_PROTECTION.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
21 months agolibxl: Don't attempt to resume domain on canceled migration
Jim Fehlig [Tue, 11 Jul 2023 16:35:32 +0000 (10:35 -0600)]
libxl: Don't attempt to resume domain on canceled migration

For unknown reasons, the libxl driver attempts to resume a domain in the
confirm phase when a migration operation has been canceled. This has shown
to be problematic when simulating scenarios that result in a canceled
migration. In all scenarios, the domain was in a running state when entering
libxlDomainMigrationSrcConfirm, causing the call to libxl_domain_resume to
fail. Making matters worse, the domain state is changed to paused when in
fact it's running. And finally, libxlDomainMigrationSrcConfirm incorrectly
returns an error.

Remove this incorrect logic from libxlDomainMigrationSrcConfirm. On a
canceled migration it's sufficient to resume the lock process that was
paused in the perform phase.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
21 months agonode_device: Enclose Linux specific code in ifdef __linux__
Michal Privoznik [Tue, 11 Jul 2023 14:13:15 +0000 (16:13 +0200)]
node_device: Enclose Linux specific code in ifdef __linux__

Our CI started to enable udev backend on FreeBSD. And while there
is udev on FreeBSD some parts of our code are highly Linux
specific, e.g. translating SCSI device type to string (from an
integer obtained from the sysfs). Obviously, this doesn't work
anywhere else. This is the reason why we need to include
scsi/scsi.h header file (which actually comes from the Linux
kernel source tree but for some reason glibc started to
distribute it, followed by musl).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
21 months agoqemu: allow use of async teardown in domain
Boris Fiuczynski [Wed, 5 Jul 2023 06:20:26 +0000 (08:20 +0200)]
qemu: allow use of async teardown in domain

Asynchronous teardown can be specified if the QEMU binary supports it by
adding in the domain XML

  <features>
    ...
    <async-teardown enabled='yes|no'/>
    ...
  </features>

By default this new feature is disabled.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
21 months agoqemu: add run-with async-teardown capability
Boris Fiuczynski [Wed, 5 Jul 2023 06:20:25 +0000 (08:20 +0200)]
qemu: add run-with async-teardown capability

QEMU capability is looking in query-command-line-options response for
...
    {
      "parameters": [
        {
          "name": "async-teardown",
          "type": "boolean"
        }
      ],
      "option": "run-with"
    }
...
allow to use the QEMU option -run-with async-teardown=on|off

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
21 months agotests: add capabilities for QEMU 8.1.0 on s390x
Shalini Chellathurai Saroja [Wed, 5 Jul 2023 06:20:24 +0000 (08:20 +0200)]
tests: add capabilities for QEMU 8.1.0 on s390x

Let us introduce the xml and reply files for QEMU 8.1.0 on s390x.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
21 months agotests: remove acpi support from s390x ccw hotplug tests
Boris Fiuczynski [Wed, 5 Jul 2023 06:20:23 +0000 (08:20 +0200)]
tests: remove acpi support from s390x ccw hotplug tests

In newer QEMU libvirt combinations acpi support is no longer tolerated
and ignored. Therfore before upgrading the test capabilities to QEMU
8.1.0 replies removing the acpi feature from the domain XMLs.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
21 months agoqemu: Support removable for scsi disk
Han Han [Mon, 5 Jun 2023 05:07:29 +0000 (13:07 +0800)]
qemu: Support removable for scsi disk

Allow //disk/target@removable for scsi disk devices, since QEMU has support
the removable attribute for scsi-hd device from v0.14.0[1].

[1]: 419e691f8e: scsi-disk: Allow overriding SCSI INQUIRY removable bit

Signed-off-by: Han Han <hhan@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
22 months agoRevert "meson: attr_dep switch to dependency()"
Jim Fehlig [Thu, 6 Jul 2023 17:35:36 +0000 (11:35 -0600)]
Revert "meson: attr_dep switch to dependency()"

openSUSE Leap 15.{4,5} are supported under libvirt's distro support
statement, but they only contain attr version 2.4.47.

Reverts: dffeef89efc2ed1668cb485d6c3e67ef27b824e8
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
22 months agoTranslated using Weblate (Georgian)
Temuri Doghonadze [Wed, 5 Jul 2023 14:21:03 +0000 (16:21 +0200)]
Translated using Weblate (Georgian)

Currently translated at 3.8% (403 of 10395 strings)

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

Co-authored-by: Temuri Doghonadze <temuri.doghonadze@gmail.com>
Signed-off-by: Temuri Doghonadze <temuri.doghonadze@gmail.com>
22 months agoNEWS: Mention overrides for AppArmor profiles and abstractions
Andrea Bolognani [Thu, 29 Jun 2023 12:10:31 +0000 (14:10 +0200)]
NEWS: Mention overrides for AppArmor profiles and abstractions

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
22 months agoapparmor: Make all profiles extensible
Andrea Bolognani [Thu, 29 Jun 2023 10:04:02 +0000 (12:04 +0200)]
apparmor: Make all profiles extensible

Do for all other profiles what we already do for the
virt-aa-helper one. In this case we limit the feature to AppArmor
3.x, as it was never implemented for 2.x.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
22 months agoapparmor: Improve virt-aa-helper include
Andrea Bolognani [Thu, 29 Jun 2023 09:40:16 +0000 (11:40 +0200)]
apparmor: Improve virt-aa-helper include

For AppArmor 3.x we can use 'include if exists', which frees us
from having to create a dummy override. For AppArmor 2.x we keep
things as they are to avoid introducing regressions.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
22 months agoapparmor: Make abstractions extensible
Andrea Bolognani [Thu, 29 Jun 2023 09:49:35 +0000 (11:49 +0200)]
apparmor: Make abstractions extensible

Implement the standard AppArmor 3.x abstraction extension
approach.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
22 months agoapparmor: Only support passt on 3.x
Andrea Bolognani [Thu, 29 Jun 2023 09:47:13 +0000 (11:47 +0200)]
apparmor: Only support passt on 3.x

The subprofile can only work by including the abstraction shipped
in the passt package, which we can't assume is present, and
'include if exists' doesn't work well on 2.x.

No distro that's stuck on AppArmor 2.x is likely to be shipping
passt anyway.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
22 months agoapparmor: Allow version-specific bits in abstractions too
Andrea Bolognani [Thu, 29 Jun 2023 09:45:35 +0000 (11:45 +0200)]
apparmor: Allow version-specific bits in abstractions too

Compared to profiles, we only need a single preprocessing step
here, as there is no variable substitution happening.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
22 months agoapparmor: Allow version-specific bits in profiles
Andrea Bolognani [Thu, 29 Jun 2023 09:35:52 +0000 (11:35 +0200)]
apparmor: Allow version-specific bits in profiles

Perform an additional preprocessing step before the existing
variable substitution. This is the same approach that we already
use to customize systemd unit files based on whether the service
supports TCP connections.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
22 months agomeson: Detect AppArmor 3.x
Andrea Bolognani [Thu, 29 Jun 2023 09:25:12 +0000 (11:25 +0200)]
meson: Detect AppArmor 3.x

We will soon need to base some decisions on whether AppArmor 3.x
or 2.x is present on the system.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
22 months agoNEWS: Fix vertical spacing
Andrea Bolognani [Mon, 3 Jul 2023 12:53:43 +0000 (14:53 +0200)]
NEWS: Fix vertical spacing

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
22 months agoPost-release version bump to 9.6.0
Jiri Denemark [Mon, 3 Jul 2023 10:17:17 +0000 (12:17 +0200)]
Post-release version bump to 9.6.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
22 months agoRelease of libvirt-9.5.0
Jiri Denemark [Mon, 3 Jul 2023 10:08:36 +0000 (12:08 +0200)]
Release of libvirt-9.5.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
22 months agoNEWS: Document changes for the release
Peter Krempa [Fri, 30 Jun 2023 12:06:31 +0000 (14:06 +0200)]
NEWS: Document changes for the release

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
22 months agoNEWS: Move section about 'discard_no_unref' to features
Peter Krempa [Fri, 30 Jun 2023 11:09:04 +0000 (13:09 +0200)]
NEWS: Move section about 'discard_no_unref' to features

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
22 months agoRevert "lxc_fuse: Tell FUSE that /proc/meminfo is nonseekable"
Michal Privoznik [Thu, 29 Jun 2023 06:46:04 +0000 (08:46 +0200)]
Revert "lxc_fuse: Tell FUSE that /proc/meminfo is nonseekable"

After v8.1.0-61-g030faee28d it is no longer necessary to make the
/proc/meminfo file nonseekable as our code that fills the file
with spoofed values can handle seeking just fine.

Previously, `free(1)` was okay with failed lseek(), but this was
ages ago and meanwhile the procps project moved to creating a
library and moved the file parsing code under an exported
function. In attempt to make the function callable multiple
times, it can lseek() multiple times and failure to do so is
fatal.

This reverts commit 766495508650bebd5f4ac23224ecd0a2ee2ca9eb

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/492
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
22 months agoTranslated using Weblate (Ukrainian)
Yuri Chornoivan [Thu, 29 Jun 2023 04:21:01 +0000 (06:21 +0200)]
Translated using Weblate (Ukrainian)

Currently translated at 100.0% (10395 of 10395 strings)

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

Co-authored-by: Yuri Chornoivan <yurchor@ukr.net>
Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
22 months agoTranslated using Weblate (Korean)
김인수 [Thu, 29 Jun 2023 04:21:00 +0000 (06:21 +0200)]
Translated using Weblate (Korean)

Currently translated at 100.0% (10395 of 10395 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>
22 months agoscripts: Fix the flake8 syntax-check failures
Han Han [Mon, 5 Jun 2023 07:40:13 +0000 (15:40 +0800)]
scripts: Fix the flake8 syntax-check failures

Fix the syntax-check failures (which can be seen after
python3-flake8-import-order package is installed) with the help
of isort[1]:

289/316 libvirt:syntax-check / flake8   FAIL   5.24s   exit status 2

[1]: https://pycqa.github.io/isort/

Signed-off-by: Han Han <hhan@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
22 months agoRevert "apparmor: Add support for local profile customizations"
Jim Fehlig [Tue, 27 Jun 2023 23:09:15 +0000 (17:09 -0600)]
Revert "apparmor: Add support for local profile customizations"

As it turns out, apparmor 2.x and 3.x behave differently or have differing
levels of support for local customizations of profiles and profile
abstractions. Additionally the apparmor 2.x tools do not cope well with
'include if exists'. Revert this commit until a more complete solution is
developed that works with old and new apparmor.

Reverts: 9b743ee19053db2fc3da8fba1e9cf81915c1e2f4
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
22 months agoUpdate translation files
Weblate [Tue, 27 Jun 2023 11:46:47 +0000 (13:46 +0200)]
Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

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

Co-authored-by: Weblate <noreply@weblate.org>
Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
22 months agopo: Refresh potfile for v9.5.0
Jiri Denemark [Tue, 27 Jun 2023 11:39:56 +0000 (13:39 +0200)]
po: Refresh potfile for v9.5.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
22 months agoTranslated using Weblate (Korean)
김인수 [Tue, 27 Jun 2023 09:20:59 +0000 (11:20 +0200)]
Translated using Weblate (Korean)

Currently translated at 100.0% (10397 of 10397 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>
22 months agoqemu: prevent SIGSEGV in qemuProcessHandleDumpCompleted
Nikolai Barybin [Tue, 27 Jun 2023 08:43:58 +0000 (11:43 +0300)]
qemu: prevent SIGSEGV in qemuProcessHandleDumpCompleted

If VIR_ASYNC_JOB_NONE flag is present, job.current is equal
to NULL, which leads to SIGSEGV. Thus, this check should be
moved up.

Fixes: v8.0.0-427-gf304de0df6
Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
22 months agoqemu_passt: Actually use @logfd
Michal Privoznik [Tue, 27 Jun 2023 06:51:36 +0000 (08:51 +0200)]
qemu_passt: Actually use @logfd

In one of my previous commits I've introduced @logfd variable
that was supposed to hold FD of passt logfile. But I've forgot to
assign the qemuDomainOpenFile() retval to it.

Fixes: 8511b96a319836700b4829816cdae27c3630060d
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
22 months agodocs: Move passt log file in our example XML
Michal Privoznik [Mon, 12 Jun 2023 07:10:31 +0000 (09:10 +0200)]
docs: Move passt log file in our example XML

In our passt example XML we use /var/log/passt.log as path to the
log file. This is not optimal, because in case of unprivileged
daemon, neither libvirt nor passt has enough permissions to
create the file. Let's move the file under /tmp.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
22 months agoqemu_passt: Precreate passt logfile
Michal Privoznik [Fri, 9 Jun 2023 06:59:18 +0000 (08:59 +0200)]
qemu_passt: Precreate passt logfile

There are a few situations where passt itself is unable to create
a file because it runs under QEMU user (e.g. just like our
example from formatdomain.rst suggests: /var/log/passt.log). If
libvirtd runs with sufficient permissions (e.g. as root) it can
create the file and set seclabels on it so that passt can then
open it.

Ideally, we would just pass pre-opened FD, but this wasn't viewed
as secure enough [1]. So lets just create the file and set
seclabels.

For the case when both libvirtd and passt have the same
permissions, well then we fail before even needing to fork() and
exec().

1: https://archives.passt.top/passt-dev/20230606225836.63aecebe@elisabeth/
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2209191
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
22 months agoExplicitly reject unsupported storage types for legacy config generators
Peter Krempa [Fri, 9 Jun 2023 14:27:57 +0000 (16:27 +0200)]
Explicitly reject unsupported storage types for legacy config generators

New storage types are not implemented in generators for -drive and the
xen config. Explicitly reject them in case of a programming error.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
22 months agotests: qemucapabilitiesdata: Update data for qemu-8.1 dev cycle
Peter Krempa [Fri, 9 Jun 2023 14:20:00 +0000 (16:20 +0200)]
tests: qemucapabilitiesdata: Update data for qemu-8.1 dev cycle

Update to v8.0.0-1739-g5f9dd6a8ce and build on a newer kernel and with
newer libblkio.

Notable changes:
  - 'fdset' feature is supported for the vdpa block backend provided by
    libblkio
  - 'xsaves' feature is optional for EPYC-Rome
  - 'cryptodev-backend-lkcf' and 'PIIX3-xen' devices removed

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
22 months agoutil: don't validate empty params
Oleg Vasilev [Fri, 23 Jun 2023 09:20:50 +0000 (15:20 +0600)]
util: don't validate empty params

If there are no parameters, there is nothing to validate.
If params == NULL, memcpy below results in memcpy(sorted, NULL, 0),
which is UB.

Found by UBSAN. Example of this codepath: virDomainBlockCopy()
(where nparams == 0 is valid) -> qemuDomainBlockCopy()

Signed-off-by: Oleg Vasilev <oleg.vasilev@virtuozzo.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
22 months agoqemuDomainWaitForDeviceRemoval: recheck the value of priv->unplug.alias when timeout
zuoboqun [Mon, 5 Jun 2023 03:59:36 +0000 (11:59 +0800)]
qemuDomainWaitForDeviceRemoval: recheck the value of priv->unplug.alias when timeout

When detaching a device, the following race condition may happen:
Once qemuDomainSignalDeviceRemoval() marks the device for
removal, it returns true, which means it is the caller
that marked the device for removal is going to remove the
device from domain definition.

But qemuDomainWaitForDeviceRemoval() may still receive
timeout from virDomainObjWaitUntil() which is implemented
by pthread_cond_timedwait() due to an unavoidable race
between the expiration of the timeout and the predicate
state(priv->unplug.alias) change.

And then qemuDomainWaitForDeviceRemoval() will return 0,
thus the caller will not remove the device from domain
definition.

In this situation, the device is still present in the domain
definition but doesn't exist in qemu anymore. Worse, there is
no way to remove it from the domain definition.

Solution is to recheck the value of priv->unplug.alias to
determine who is going to remove the device from domain
definition.

Signed-off-by: zuo boqun <zuoboqun@baidu.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
22 months agoNEWS: Update NEWS with new discard_no_unref option
Jean-Louis Dupond [Fri, 9 Jun 2023 10:47:37 +0000 (12:47 +0200)]
NEWS: Update NEWS with new discard_no_unref option

Signed-off-by: Jean-Louis Dupond <jean-louis@dupond.be>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
22 months agoAdd discard_no_unref option for qcow2 images
Jean-Louis Dupond [Fri, 9 Jun 2023 10:47:36 +0000 (12:47 +0200)]
Add discard_no_unref option for qcow2 images

Qemu 8.1.0 will add discard_no_unref option for qcow2 images.
When this option is enabled (default=false), then it will no longer
unreference clusters when guest does a discard, but it will just free
the blocks (useful for incremental backups for example) and pass the
discard to the lower layer.

This was implemented to avoid fragmentation within the qcow2 image.

Signed-off-by: Jean-Louis Dupond <jean-louis@dupond.be>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
22 months agoqemu: capabilities: Introduce QEMU_CAPS_QCOW2_DISCARD_NO_UNREF
Peter Krempa [Fri, 23 Jun 2023 12:12:52 +0000 (14:12 +0200)]
qemu: capabilities: Introduce QEMU_CAPS_QCOW2_DISCARD_NO_UNREF

The qcow2 driver allows passing discards to the storage while keeping
the reference of the block, and just marking it as zeroed. This can
decrease the levels of fragmentation of the qcow2 metadata when
discards are enabled.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
22 months agoqemuxml2(argv|xml)test: Add case for validating proper DIMM slot validation
Peter Krempa [Thu, 22 Jun 2023 11:56:06 +0000 (13:56 +0200)]
qemuxml2(argv|xml)test: Add case for validating proper DIMM slot validation

Add a config where both DIMM and non-DIMM <memory> devices are used so
that it validates that only DIMMs require memory slots.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
22 months agoconf: Allow omitting 'slots' attribute of <maxMemory>
Peter Krempa [Wed, 21 Jun 2023 14:01:26 +0000 (16:01 +0200)]
conf: Allow omitting 'slots' attribute of <maxMemory>

Memory slots are required only for DIMM-like devices, but the maximum
memory address space is relevant also for other non-DIMM memory devices
such as virtio-mem. Allow configurations where no slots are added.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
22 months agoqemu_domain: Properly validate count of memory slots
Peter Krempa [Wed, 21 Jun 2023 13:31:24 +0000 (15:31 +0200)]
qemu_domain: Properly validate count of memory slots

Memory slots are required only for DIMM-like devices, while other
devices defined via <memory> such as virtio-mem may use the PCI bus and
thus do not require/consume a memory slot.

Fix the validation code to calculate the required count of memory
devices only for DIMMs and NVDIMMs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
22 months agoqemu_command: Always use modern syntax of '-m'
Peter Krempa [Wed, 21 Jun 2023 14:31:46 +0000 (16:31 +0200)]
qemu_command: Always use modern syntax of '-m'

Specify the memory size by using '-m size=2048k' instead of just '-m 2'.

The new syntax is used when memory hotplug is enabled. To preserve
memory sizing, if memory hotplug is disabled the size is rounded down to
the nearest mebibyte.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
22 months agovirGlobalInit: Make glib init its own global state
Michal Privoznik [Wed, 21 Jun 2023 06:56:54 +0000 (08:56 +0200)]
virGlobalInit: Make glib init its own global state

This should not be needed, but here's what's happening:
virStrToLong_*() family of functions was switched from strtol*()
to g_ascii_strtol*() in order to handle corner cases on Windows
(most notably parsing hex numbers with base=0) - see
v9.4.0-61-g2ed41d7cd9. But what we did not realize back then, is
the fact that g_ascii_strtol*() family has their own global lock
rendering virStrToLong_*() function unsafe between fork() +
exec(). Worse, if one of the threads has to wait for the lock (or
on its corresponding condition), then errno is mangled and
g_ascii_strtol*() signals an error, even though there's no error.

Read more here:

  https://gitlab.gnome.org/GNOME/glib/-/issues/3034

Nevertheless, if we make glib init the g_ascii_strtol*() global
state (by calling one function from g_ascii_strtol*() family),
then there shouldn't be any congestion on the lock and thus no
errno mangling.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
22 months agoNEWS: Mention an improvement for virConnectBaselineHypervisorCPU
Jiri Denemark [Fri, 9 Jun 2023 16:13:54 +0000 (18:13 +0200)]
NEWS: Mention an improvement for virConnectBaselineHypervisorCPU

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
22 months agoqemu: Include maximum physical address size in baseline CPU
Jiri Denemark [Fri, 9 Jun 2023 16:12:53 +0000 (18:12 +0200)]
qemu: Include maximum physical address size in baseline CPU

The current implementation of virConnectBaselineHypervisorCPU in QEMU
driver can provide a CPU definition that will not work on all hosts in
case they have different maximum physical address size. So when we get
the info from domain capabilities, we need to choose the smallest
physical address size for the computed baseline CPU definition.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
22 months agoqemu: Report physical address size in domain capabilities
Jiri Denemark [Fri, 9 Jun 2023 15:17:36 +0000 (17:17 +0200)]
qemu: Report physical address size in domain capabilities

We already report the hosts physical address size in host capabilities,
but computing a baseline CPU definition is done from domain
capabilities.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
22 months agoconf/nwfilter: Initialize size_t attr to zero
Martin Kletzander [Wed, 14 Jun 2023 10:30:29 +0000 (12:30 +0200)]
conf/nwfilter: Initialize size_t attr to zero

Newer GCC (13.1.1 in my case) wrongly reports "maybe uninitialized"
warning for this variable inside the next condition.  Even though this
accusation is wrong (the condition is guarded by the same condition as
the for cycle initializing it), initialize it during the declaration so
compilation errors don't stop others and maybe also future proof the
code for changes.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
22 months agomeson-dist: Use shutil.copy for copying a file
Martin Kletzander [Mon, 12 Jun 2023 07:49:33 +0000 (09:49 +0200)]
meson-dist: Use shutil.copy for copying a file

Using os.system("cp {0} {1}".format(...)) has two issues, it does not
work on Windows, but more importantly it can cause issues in case one of
the directories has a space in it.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
22 months agoutil: Use g_ascii_strtoll
Martin Kletzander [Fri, 31 Mar 2023 12:44:11 +0000 (14:44 +0200)]
util: Use g_ascii_strtoll

This has two main advantages:

- it parses the number with C locale explicitly

- it behaves the same on Windows as on Linux and BSD

both of which are wanted behaviours.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
22 months agoutil: Remove virStrToLong_l
Martin Kletzander [Fri, 31 Mar 2023 12:22:49 +0000 (14:22 +0200)]
util: Remove virStrToLong_l

With the last user gone this function can be abolished.  It is
preferable to use _ll instead since that is not a subject to 32/64 bit
scaling.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
22 months agoutil: Parse RSS into ullp
Martin Kletzander [Fri, 31 Mar 2023 12:39:34 +0000 (14:39 +0200)]
util: Parse RSS into ullp

It is used to fill an unsigned long long anyway and if it is negative
than there is really an issue somewhere.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
22 months agoconf: virtiofs: validate that the target dir is unique even for hotplug
Ján Tomko [Wed, 7 Jun 2023 15:40:23 +0000 (17:40 +0200)]
conf: virtiofs: validate that the target dir is unique even for hotplug

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
22 months agomeson: Use dependency().found() instead of conf.has()
Michal Privoznik [Thu, 23 Mar 2023 08:15:35 +0000 (09:15 +0100)]
meson: Use dependency().found() instead of conf.has()

So far this change alone doesn't make much sense, but prepares
code for upcoming change. Unfortunately, some conf.has()
statements have to stay, because there's no corresponding
dependency(). But that's okay.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
22 months agomeson: numactl_dep switch to dependency()
Michal Privoznik [Thu, 23 Mar 2023 08:21:17 +0000 (09:21 +0100)]
meson: numactl_dep switch to dependency()

The pkg-config file to libnuma was introduced in 2.0.12 release
(though the comment mistakenly claims 2.0.14 version). Every
supported distro ships at least this version, and thus we can
switch meson detection to dependency().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
22 months agomeson: attr_dep switch to dependency()
Michal Privoznik [Thu, 23 Mar 2023 08:13:52 +0000 (09:13 +0100)]
meson: attr_dep switch to dependency()

The pkg-config file to libattr was introduced in 2.4.48 release.
Now that every supported distro ships at least this version, we
can switch meson detection to dependency().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
22 months agomeson: acl_dep switch to dependency()
Michal Privoznik [Thu, 23 Mar 2023 08:12:52 +0000 (09:12 +0100)]
meson: acl_dep switch to dependency()

The pkg-config file to libacl was introduced in 2.2.53 release.
Now that every supported distro ships at least this version, we
can switch meson detection to dependency().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
22 months agoTranslated using Weblate (German)
Malte Linke [Fri, 9 Jun 2023 13:20:43 +0000 (15:20 +0200)]
Translated using Weblate (German)

Currently translated at 47.4% (4932 of 10397 strings)

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

Co-authored-by: Malte Linke <malte.linke@outlook.com>
Signed-off-by: Malte Linke <malte.linke@outlook.com>
22 months agoqemu: Drop @unionMems argument from qemuProcessSetupPid()
Michal Privoznik [Wed, 7 Jun 2023 11:42:10 +0000 (13:42 +0200)]
qemu: Drop @unionMems argument from qemuProcessSetupPid()

The @unionMems argument of qemuProcessSetupPid() function is not
necessary really as all callers pass 'true'. Drop it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
22 months agoqemu: Allow more generous cpuset.mems for vCPUs and IOThreads
Michal Privoznik [Wed, 7 Jun 2023 06:40:15 +0000 (08:40 +0200)]
qemu: Allow more generous cpuset.mems for vCPUs and IOThreads

The unit that cpuset CGroups controller works with is a
thread/process, not individual memory allocations. Therefore,
after we've set cpuset.mems for emulator (after previous commit
it's set to union of all host NUMA nodes allowed for given
domain), and as we try to set up cpuset.mems for vCPUs/IOThreads,
memory is migrated to selected NUMA node(s). We are effectively
saying: "this thread (vCPU thread) can have memory only from
these NUMA node(s)".

That's not really what we want though. The cpuset controller
doesn't differentiate memory "belonging" to the emulator thread
and vCPU thread or IOThread even.

Therefore, set union of all allowed host NUMA nodes, just like
we're doing for the emulator thread.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2138150
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
22 months agoqemu: Don't try to 'fix up' cpuset.mems after QEMU's memory allocation
Michal Privoznik [Tue, 6 Jun 2023 14:34:59 +0000 (16:34 +0200)]
qemu: Don't try to 'fix up' cpuset.mems after QEMU's memory allocation

In ideal world, my plan was perfect. We allow union of all host
nodes in cpuset.mems and once QEMU has allocated its memory, we
'fix up' restriction of its emulator thread by writing the
original value we wanted to set all along. But in fact, we can't
do it because that triggers memory movement. For instance,
consider the following <numatune/>:

  <numatune>
    <memory mode="strict" nodeset="0"/>
    <memnode cellid="1" mode="strict" nodeset="1"/>
  </numatune>

  <numa>
    <cell id="0" cpus="0-1" memory="1024000" unit="KiB" />
    <cell id="1" cpus="2-3" memory="1048576" unit="KiB"/>
  </numa>

This is meant to create 1:1 mapping between guest and host NUMA
nodes. So we start QEMU with cpuset.mems set to "0-1" (so that it
can allocate memory even for guest node #1 and have the memory
come fro host node #1) and then, set cpuset.mems to "0" (because
that's where we wanted emulator thread to live).

But this in turn triggers movement of all memory (even the
allocated one) to host NUMA node #0. Therefore, we have to just
keep cpuset.mems untouched and rely on .host-nodes passed on the
QEMU cmd line.

The placement still suffers because of cpuset.mems set for vcpus
or iothreads, but that's fixed in next commit.

Fixes: 3ec6d586bc3ec7a8cf406b1b6363e87d50aa159c
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
22 months agoapparmor: Add support for local profile customizations
Jim Fehlig [Tue, 6 Jun 2023 17:05:50 +0000 (11:05 -0600)]
apparmor: Add support for local profile customizations

Apparmor profiles in /etc/apparmor.d/ are config files that can and should
be replaced on package upgrade, which introduces the potential to overwrite
any local changes. Apparmor supports local profile customizations via
/etc/apparmor.d/local/<service> [1].

This change makes the support explicit by adding libvirtd, virtqemud, and
virtxend profile customization stubs to /etc/apparmor.d/local/. The stubs
are conditionally included by the corresponding main profiles.

[1] https://ubuntu.com/server/docs/security-apparmor
See "Profile customization" section

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
23 months agoqemucapabilitiestest: Add data for the qemu-8.1
Peter Krempa [Thu, 18 May 2023 12:07:30 +0000 (14:07 +0200)]
qemucapabilitiestest: Add data for the qemu-8.1

Add data as of v8.0.0-1619-g369081c455:

Notable changes:
 - 'SapphireRapids' cpu model added
 - 'EPYC-Genoa(-v1)' cpu model added
 - 'EPYC-Milan-v2' cpu model added
 - 'EPYC-Rome-(v3|v4)' cpu models added
 - new cpu features:
    'fb-clear', 'cmpccxadd', 'vnmi', 'flush-l1d', 'avx-vnni-int8', 'avx-ifma',
    'no-nested-data-bp', 'null-sel-clr-base', 'amd-psfd', 'auto-ibrs', 'amx-fp16',
    'prefetchiti', 'lfence-always-serializing', 'avx-ne-convert'
 - 8.1 machine types added

 - QMP schema:
   - 'block-latency-histogram-set' gained 'boundaries-zap' property
   - 'qcow2' block driver gained 'discard-no-unref' flag
   - 'input-send-event' now supports the 'mtt' type and corresponding properties
   - 'memory-backend-file' object now has a 'offset' property
   - 'query-blockstats' reports 'failed_zone_append_operations', 'avg_zone_append_latency_ns'
       'avg_zone_append_queue_depth', 'zone_append_bytes', 'zone_append_latency_histogram',
       'zone_append_operations', 'zone_append_merged', 'zone_append_total_time_ns'
   - 'single-step' property of 'query-status' is deprecated
   - 'vcpu' argument of 'trace-events-(set|get'-state' is deprecated

'cpu-host-model' qemuxml2argv test output changed as EPYC-Rome gained
few new cpu flags.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
23 months agoqemumonitorjsontest: Work around deprecation of 'vcpu' argument of 'trace-event-get...
Peter Krempa [Tue, 6 Jun 2023 09:03:39 +0000 (11:03 +0200)]
qemumonitorjsontest: Work around deprecation of 'vcpu' argument of 'trace-event-get-state'

'trace-event-get-state' was used for testing schema validation as it had
simple arguments. Now 'vcpu' is optional and deprecated. Fix the test so
that it won't break with upcoming qemu-8.1.

Drop the 'all-attrs' case, as it's not not really testing anything
special and for the 'missing mandatory attr' case use an empty object.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
23 months agoTranslated using Weblate (Korean)
김인수 [Sat, 3 Jun 2023 18:20:49 +0000 (20:20 +0200)]
Translated using Weblate (Korean)

Currently translated at 100.0% (10397 of 10397 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>
23 months agovirnetsshsession: Adapt to changed libssh2 API
Michal Privoznik [Mon, 5 Jun 2023 12:24:48 +0000 (14:24 +0200)]
virnetsshsession: Adapt to changed libssh2 API

In one of its commits [1] libssh2 changed the 'text' member of
LIBSSH2_USERAUTH_KBDINT_PROMPT struct from 'char' to 'unsigned
char'. But we g_strdup() the member in order to fill 'prompt'
member of virConnectCredential struct. Typecast the value to
avoid warnings. Also, drop @prompt variable, as it's needless.

1: https://github.com/libssh2/libssh2/commit/83853f8aea0e2f739cacd491632eb7fd3d03ad2d
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
23 months agodocs: fix changed API calls
Oleg Vasilev [Fri, 3 Mar 2023 08:24:55 +0000 (14:24 +0600)]
docs: fix changed API calls

Signed-off-by: Oleg Vasilev <oleg.vasilev@virtuozzo.com>
23 months agoconf: nwfilter: Refactor virNWFilterFormatParamAttributes
Peter Krempa [Tue, 11 Apr 2023 16:13:43 +0000 (18:13 +0200)]
conf: nwfilter: Refactor virNWFilterFormatParamAttributes

Use virXMLFormatElement and simplify the formatter.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
23 months agoconf: nwfilter: Refactor virNWFilterIncludeParse
Peter Krempa [Tue, 11 Apr 2023 16:02:28 +0000 (18:02 +0200)]
conf: nwfilter: Refactor virNWFilterIncludeParse

Use automatic memory freeing and modern XML parsers to simplify the
function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
23 months agovirNWFilterRuleDefDetailsFormat: Refactor formatter
Peter Krempa [Thu, 16 Feb 2023 13:09:31 +0000 (14:09 +0100)]
virNWFilterRuleDefDetailsFormat: Refactor formatter

Format the rule attributes in two passes, first for positive 'match' and
second pass for negative. This removes the crazy logic for switching
between match modes inside the formatter.

The refactor makes it also more clear in which cases we actually do
format something.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
23 months agovirNWFilterRuleParse: Refactor attribute parser
Peter Krempa [Thu, 16 Feb 2023 12:56:53 +0000 (13:56 +0100)]
virNWFilterRuleParse: Refactor attribute parser

Use virXMLNodeGetSubelementList to get the elements to process.

The new approach documents the complexity of the parser, which is
designed to ignore unknown attributes and parse only a single kind of
them after finding the first valid one.

Note that the XML schema doesn't actually allow having multiple
sub-elements, but I'm not sure how that translates to actual configs
present.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
23 months agovirNWFilterRuleParse: Parse 'priority' via 'virXMLPropInt'
Peter Krempa [Thu, 16 Feb 2023 12:20:03 +0000 (13:20 +0100)]
virNWFilterRuleParse: Parse 'priority' via 'virXMLPropInt'

Use modern parsing. Invalid numbers are now rejected. Semantis for
numbers out of range is preserved.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
23 months agovirNWFilterRuleDef: Turn 'action' and 'tt' into proper enum types
Peter Krempa [Thu, 16 Feb 2023 12:14:45 +0000 (13:14 +0100)]
virNWFilterRuleDef: Turn 'action' and 'tt' into proper enum types

Convert the fields to the proper types and use virXMLPropEnum for
parsing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
23 months agoconf: nwfilter: Refactor XML formatting in virNWFilterRuleDefFormat
Peter Krempa [Thu, 16 Feb 2023 09:18:46 +0000 (10:18 +0100)]
conf: nwfilter: Refactor XML formatting in virNWFilterRuleDefFormat

Use virXMLFormatElement to simplify the formatter. Drop return value of
virNWFilterRuleDefFormat as there are no errors to report.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
23 months agoconf: network: Refactor XML parsing in virNetworkDHCPDefParseXML
Peter Krempa [Wed, 15 Feb 2023 16:10:18 +0000 (17:10 +0100)]
conf: network: Refactor XML parsing in virNetworkDHCPDefParseXML

Use virXMLNodeGetSubelement(List) instead of the looped parser and
simplify the code.

Note that handling of the 'bootp' element now conforms to the schema
where we allow just one and the 'file' attribute is mandatory.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>