]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
18 months agovirDomainDiskGetDetectZeroesMode: Return proper type
Peter Krempa [Thu, 19 Oct 2023 13:11:15 +0000 (15:11 +0200)]
virDomainDiskGetDetectZeroesMode: Return proper type

Change the return value type to 'virDomainDiskGetDetectZeroes'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemuBlockStorageSourceGetBackendProps: Unify cases for '!onlytarget' and '!legacy'
Peter Krempa [Wed, 18 Oct 2023 11:58:29 +0000 (13:58 +0200)]
qemuBlockStorageSourceGetBackendProps: Unify cases for '!onlytarget' and '!legacy'

At this point only a single code path (for formatting -drive for legacy
SD cards) uses the 'legacy' output and that code path doesn't populate
the node name. Thus we can unify the code block and simplify the JSON
formatters.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agosrc: Remove duplicated VIR_REQUIRE_FLAG_GOTO() call
Andrea Bolognani [Tue, 31 Oct 2023 10:07:49 +0000 (11:07 +0100)]
src: Remove duplicated VIR_REQUIRE_FLAG_GOTO() call

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
18 months agologging: lockdown the systemd service configuration
Daniel P. Berrangé [Fri, 4 Mar 2022 11:59:23 +0000 (11:59 +0000)]
logging: lockdown the systemd service configuration

The 'systemd-analyze security' command looks at the unit file
configuration and reports on any settings which increase the
attack surface for the daemon. Since most systemd units are
fairly minimalist, this is generally informing us about settings
that we never put any thought into using before.

In its current configuration it reports

  # systemd-analyze security virtlogd.service
  ...snip...
  → Overall exposure level for virtlogd.service: 9.6 UNSAFE 😨

which is pretty terrible as a score.

If we apply all of the recommendations that appear possible
without (knowingly) breaking functionality it reports:

  # systemd-analyze security virtlogd.service
  ...snip...
  → Overall exposure level for virtlogd.service: 2.2 OK 🙂

which is a pretty decent improvement.

Some of the settings we would like to enable require a systemd
version that is newer than that available in our oldest distro
target - RHEL-8 at v239.

NB, RestrictSUIDSGID is technically newer than 239, but RHEL-8
backported it, and other distros we target have it by default.

Remaining recommendations are

✗ CapabilityBoundingSet=~CAP_(DAC_*|FOWNER|IPC_OWNER)

  We block FOWNER/IPC_OWNER, but can't block the two DAC
  capabilities. Historically apps/users might point QEMU
  to log files in $HOME, pre-created with their own user
  ID.

✗ IPAddressDeny=

  Not required since RestrictAddressFamilies blocks IP
  usage. Ignoring this avoids the overhead of creating
  a traffic filter than will never be used.

✗ NoNewPrivileges=

  Highly desirable, but cannot enable it yet, because it
  will block the ability to transition to the virtlogd_t
  SELinux domain during execve. The SELinux policy needs
  fixing to permit this transition under NNP first.

✗ PrivateTmp=

  There is a decent chance people have VMs configured
  with a serial port logfile pointing at /tmp. We would
  cause a regression to use private /tmp for logging

✗ PrivateUsers=

  This would put virtlogd inside a user namespace where
  its root is in fact unprivileged. Same problem as the
  User= setting below

✗ ProcSubset=

  Libraries we link to might read certain non-PID related
  files from /proc

✗ ProtectClock=

  Requires v245

✗ ProtectHome=

  Same problem as PrivateTmp=. There's a decent chance
  that someone has a VM configured to write a logfile
  to /home

✗ ProtectHostname=

  Requires v241

✗ ProtectKernelLogs

  Requires v244

✗ ProtectProc

  Requires v247

✗ ProtectSystem=

  We only set it to 'full', as 'strict' is not viable for
  our required usage

✗ RootDirectory=/RootImage=

  We are not capable of running inside a custom chroot
  given needs to write log files to arbitrary places

✗ RestrictAddressFamilies=~AF_UNIX

  We need AF_UNIX to communicate with other libvirt daemons

✗ SystemCallFilter=~@resources

  We link to libvirt.so which links to libnuma.so which has
  a constructor that calls set_mempolicy. This is highly
  undesirable todo during a constructor.

✗ User=/DynamicUser=

  This is highly desirable, but we currently read/write
  logs as root, and directories we're told to write into
  could be anywhere. So using a non-root user would have
  a major risk of regressions for applications and also
  have upgrade implications

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
18 months agoPost-release version bump to 9.10.0
Jiri Denemark [Wed, 1 Nov 2023 09:42:48 +0000 (10:42 +0100)]
Post-release version bump to 9.10.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
18 months agoRelease of libvirt-9.9.0
Jiri Denemark [Wed, 1 Nov 2023 10:22:09 +0000 (11:22 +0100)]
Release of libvirt-9.9.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
18 months agodocs: update search form to use hyperkitty search
Daniel P. Berrangé [Fri, 27 Oct 2023 11:24:26 +0000 (12:24 +0100)]
docs: update search form to use hyperkitty search

The hyperkitty search facility does a massively better job
than google docs for mailing lists.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
18 months agogitpublish: update for new devel mailing list address
Daniel P. Berrangé [Fri, 27 Oct 2023 10:05:58 +0000 (11:05 +0100)]
gitpublish: update for new devel mailing list address

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
18 months agodocs: update docs pointing to old mailing list addrs
Daniel P. Berrangé [Fri, 27 Oct 2023 09:59:02 +0000 (10:59 +0100)]
docs: update docs pointing to old mailing list addrs

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
18 months agosrc: update log/error messages pointing to old mailing list addr
Daniel P. Berrangé [Fri, 27 Oct 2023 09:59:02 +0000 (10:59 +0100)]
src: update log/error messages pointing to old mailing list addr

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
18 months agoqemu: Setup host side of VDPA device for block copy
Peter Krempa [Thu, 26 Oct 2023 13:44:34 +0000 (15:44 +0200)]
qemu: Setup host side of VDPA device for block copy

Setup the VDPA bits of the appropriate part of the image chain for block
copy.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: hotplug: Setup host side of VDPA device for disk hotplug
Peter Krempa [Thu, 26 Oct 2023 13:12:35 +0000 (15:12 +0200)]
qemu: hotplug: Setup host side of VDPA device for disk hotplug

The code which opens the VDPA device and prepares it for FD passing was
not called in the hotplug code path, preventing hotplug of VDPA disks
with:

 error: internal error: argument key 'path' must not have null value

Use the new helper qemuProcessPrepareHostStorageDisk to setup the VDPA
definition.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/539
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: process: Extract host setup of disk device into helpers
Peter Krempa [Thu, 26 Oct 2023 13:05:41 +0000 (15:05 +0200)]
qemu: process: Extract host setup of disk device into helpers

Currently the code sets up only VDPA backends but will be used later in
hotplug code too.

This patch also uses normal forward iteration in the loop in
qemuProcessPrepareHostStorage as we don't need to remove disks from the
disk list at that point.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agodocs: formatdomain: Clarify that the SLIC ACPI table config is available for all...
Peter Krempa [Thu, 26 Oct 2023 11:56:46 +0000 (13:56 +0200)]
docs: formatdomain: Clarify that the SLIC ACPI table config is available for all modes

Move the docs for the <acpi><table> element under a common section as
it's not specific for direct kernel boot. In fact the original use was
for Windows activation.

Fixes: 72f652da63255c7f1a9914625cce617dde9128d0
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemublocktest: testBackingXMLjsonXML: Drop 'legacy' mode
Peter Krempa [Wed, 18 Oct 2023 14:55:13 +0000 (16:55 +0200)]
qemublocktest: testBackingXMLjsonXML: Drop 'legacy' mode

Legacy mode used to be needed for use with -drive, which was almost
completely deleted. We now have qemuxml2argvtest test cases checking a
few cases and the rest uses the modern mode only. Thus we don't need to
test the legacy mode any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemublocktest: Fix logical bug in TEST_JSON_FORMAT macro
Peter Krempa [Wed, 18 Oct 2023 14:55:41 +0000 (16:55 +0200)]
qemublocktest: Fix logical bug in TEST_JSON_FORMAT macro

Condition handling failure of the first virTestRun was lacking the 'ret
= -1' line thus the subsequent line was taken as it's body rendering the
first invocation useless.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemublocktest: Drop 'sheepdog' and 'vxhs' test cases
Peter Krempa [Wed, 18 Oct 2023 15:23:46 +0000 (17:23 +0200)]
qemublocktest: Drop 'sheepdog' and 'vxhs' test cases

QEMU deprecated and removed support for those protocols, but due to a
logic bug in the tests it was not caught. Remove the test cases first.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemucapabilitiestest: Update capabilities data for 8.2 dev cycle on x86_64
Peter Krempa [Thu, 26 Oct 2023 08:02:27 +0000 (10:02 +0200)]
qemucapabilitiestest: Update capabilities data for 8.2 dev cycle on x86_64

Update to v8.1.0-2161-ga95260486a

Notable changes:
 - new CPU topology parameters: 'books', 'drawers'
 - new migration parameter 'avail-switchover-bandwidth'
 - new s390x CPU properties: 'dedicated', 'entitlement'
 - new 'hostmem' parameter for 'virtio-gpu'
 - new device 'piix4-isa'
 - new property 'dynamic-memslots' of 'virtio-mem' device
 - new 'gsi*' parameters of 'ICH9-LPC'
 - new experimental 'x-south-bridge' machine option

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
18 months agopo: Refresh potfile for v9.9.0
Jiri Denemark [Thu, 26 Oct 2023 10:03:18 +0000 (12:03 +0200)]
po: Refresh potfile for v9.9.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
18 months agomeson: Rename build_tests -> tests_enabled
Andrea Bolognani [Tue, 3 Oct 2023 13:39:02 +0000 (15:39 +0200)]
meson: Rename build_tests -> tests_enabled

Given that this variable now controls not just whether C tests
are built, but also whether any test at all is executed, the new
name is more appropriate.

Update the description for the corresponding meson option
accordingly.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
18 months agomeson: Disable all tests when tests are disabled
Andrea Bolognani [Tue, 3 Oct 2023 12:58:56 +0000 (14:58 +0200)]
meson: Disable all tests when tests are disabled

Currently, passing -Dtests=disabled only disables a subset of
tests: those that are written in C and thus require compilation.
Other tests, such as the syntax-check ones and those that are
implemented as scripts, are always enabled.

There's a potentially dangerous consequence of this behavior:
when tests are disabled, 'meson test' will succeed as if they
had been enabled. No indication of this will be shown, so the
user will likely make the reasonable assumption that everything
is fine when in fact the significantly reduced coverage might
be hiding failures.

To solve this issues, disable *all* tests when asked to do so,
and inject an intentionally failing test to ensure that 'meson
test' doesn't succeed.

Best viewed with 'git show -w'.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
18 months agomeson: Make -Dexpensive_tests depend on -Dtests
Andrea Bolognani [Tue, 3 Oct 2023 12:53:08 +0000 (14:53 +0200)]
meson: Make -Dexpensive_tests depend on -Dtests

It only makes sense to enable expensive tests when tests are
enabled. Disallow invalid configurations.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
18 months agomeson: Handle -Dtests=enabled with Clang
Andrea Bolognani [Tue, 3 Oct 2023 12:52:45 +0000 (14:52 +0200)]
meson: Handle -Dtests=enabled with Clang

There are some cases in which we automatically disable tests when
using Clang as the compiler. If the user has explicitly asked for
tests to be enabled, however, we should error out instead of
silently disabling things.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
18 months agomeson: Move all handling of test options together
Andrea Bolognani [Tue, 3 Oct 2023 12:46:56 +0000 (14:46 +0200)]
meson: Move all handling of test options together

This will make future patches nicer.

Note that we need to handle these somewhat late because of the
dependency on information about the compiler and the flags it
supports.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
18 months agomeson: Do less when not building from git
Andrea Bolognani [Tue, 3 Oct 2023 12:57:05 +0000 (14:57 +0200)]
meson: Do less when not building from git

As explained in the comment, the syntax-check machinery uses git
to figure out the list of files it should operate on, so we can
only enable it when building from git.

Despite only registering the various tests with meson in that
case, however, we unconditionally perform a bunch of preparation
that is only useful for the purpose of registering and running
the tests. If we're not going to do that, we can skip a few steps
and save a bit of time.

Best viewed with 'git show -w'.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
18 months agoci: Disable optimizations on macOS
Andrea Bolognani [Wed, 25 Oct 2023 15:33:49 +0000 (17:33 +0200)]
ci: Disable optimizations on macOS

Clang can be too aggressive at optimizations, which can end up
breaking our test suite. See f9f5ab57189b for details.

As a result of this, since 7944700b4037 we are automatically
disabling tests when Clang is used unless it supports the
-fsemantic-interposition compiler flag.

Since the version of Clang included in macOS doesn't support that
compiler flag, we end up always disabling the test suite on that
platform.

This is already far from ideal, considering that it was just last
year when we finally managed to get the test suite to successfully
pass on macOS, and it would be a real shame if the situation
regressed again.

With the upcoming changes, which will turn running 'meson test'
into a hard failure if tests are disabled, this behavior will
result in every single pipeline failing.

Work around the problem the only way we can: disabling
optimizations entirely for the macOS CI jobs.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
18 months agotests: Fix some test cases on macOS
Andrea Bolognani [Wed, 25 Oct 2023 14:48:18 +0000 (16:48 +0200)]
tests: Fix some test cases on macOS

Test cases that depend on duplicating fds are using fairly big
values as targets.

This works fine on Linux, where RLIMIT_NOFILE is 1024 by
default, but fails on macOS which uses 256 as the default.

Decrease the values so that they're valid across all platforms.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
18 months agoqemublocktest: Use "target only" mode in 'testJSONtoJSON' and 'testBackingXMLjsonXML'
Peter Krempa [Wed, 18 Oct 2023 14:18:40 +0000 (16:18 +0200)]
qemublocktest: Use "target only" mode in 'testJSONtoJSON' and 'testBackingXMLjsonXML'

Both tests pass a disk source definition which didn't go through the
preparation steps and thus contains only the target information that
were originally present, thus we should be using the
QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_TARGET_ONLY flag.

For the same reason QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_AUTO_READONLY
used in 'testJSONtoJSON' doesn't make sense.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemuBlockStorageSourceGetBlockdevGetCacheProps: Return the cache object rather than...
Peter Krempa [Wed, 18 Oct 2023 11:51:09 +0000 (13:51 +0200)]
qemuBlockStorageSourceGetBlockdevGetCacheProps: Return the cache object rather than appending it

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemuDomainDiskCachemodeFlags: Simplify usage
Peter Krempa [Wed, 18 Oct 2023 11:19:08 +0000 (13:19 +0200)]
qemuDomainDiskCachemodeFlags: Simplify usage

Return whether a relevant cachemode was presented rather than returning
an error, so that callers can be simplified. Use the proper enum type as
argument rather than typecasting in the switch statement.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agovirStorageSource: Use proper type for shadow copies of iomode/cachemode/discard/detec...
Peter Krempa [Wed, 18 Oct 2023 07:55:19 +0000 (09:55 +0200)]
virStorageSource: Use proper type for shadow copies of iomode/cachemode/discard/detect_zeroes

The aforementioned fields in virStorageSource struct are copies of the
disk properties, but were not converted to the proper type yet.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoconf: Move definition of some disk type enums to a common header
Peter Krempa [Wed, 18 Oct 2023 10:56:04 +0000 (12:56 +0200)]
conf: Move definition of some disk type enums to a common header

Certain disk config fields are mirrored between the disk and storage
source definitions, but the proper types are not available for use in
the virStorageSource definition. Move them so they can be used properly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemuBlockStorageSourceGetBackendProps: Remove unnecessary indent for non-nbdkit code...
Peter Krempa [Wed, 18 Oct 2023 07:38:56 +0000 (09:38 +0200)]
qemuBlockStorageSourceGetBackendProps: Remove unnecessary indent for non-nbdkit code path

Formatting of the 'nbdkit' driven backend breaks out of the switch
statement so we don't need to have an unnecessary block and indentation
level for the case when nbdkit is not in use.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemuBuildDriveSourceStr: Absorb only use of qemuDiskSourceGetProps
Peter Krempa [Wed, 18 Oct 2023 07:34:27 +0000 (09:34 +0200)]
qemuBuildDriveSourceStr: Absorb only use of qemuDiskSourceGetProps

'qemuBuildDriveSourceStr' used to build the legacy -drive commandline
for SD cards is the only user of qemuDiskSourceGetProps. Move the helper
directly inline.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: migration: No longer avoid 'auto-read-only' option for migration
Peter Krempa [Tue, 17 Oct 2023 14:10:47 +0000 (16:10 +0200)]
qemu: migration: No longer avoid 'auto-read-only' option for migration

The 'auto-read-only' blockdev option is available in all supported qemu
versions so we can remove the migration hack which disabled it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemuxml2(argv|xml)test: Add network backed disk type='sd'
Peter Krempa [Wed, 18 Oct 2023 07:16:40 +0000 (09:16 +0200)]
qemuxml2(argv|xml)test: Add network backed disk type='sd'

Add a few examples of SD cards backed with network storage to capture
the current state as the formatter code is about to be refactored.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agonews: document `virsh console --resume` and `virsh (start|create) --console` osstest/frozen/xen-4.18-testing
Marc Hartmayer [Wed, 25 Oct 2023 09:03:54 +0000 (11:03 +0200)]
news: document `virsh console --resume` and `virsh (start|create) --console`

Document the following changes:
 + added `virsh console --resume` subcommand option
 + improved `virsh start --console` behavior
 + improved `virsh create --console` behavior

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
18 months agomeson: Fix XDR check for GNU/Hurd
Andrea Bolognani [Mon, 9 Oct 2023 21:17:10 +0000 (23:17 +0200)]
meson: Fix XDR check for GNU/Hurd

The situation is the same as Linux: since glibc no
longer includes the RPC functionality, libtirpc must
be used to complement it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
18 months agosystemd: Tweak service definitions
Andrea Bolognani [Fri, 29 Sep 2023 13:56:17 +0000 (15:56 +0200)]
systemd: Tweak service definitions

Use a consistent style everywhere.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
18 months agosystemd: Make service_extra_in/socket_extra_in required
Andrea Bolognani [Fri, 29 Sep 2023 13:59:34 +0000 (15:59 +0200)]
systemd: Make service_extra_in/socket_extra_in required

We want at least one file to always be present, so that it can
serve as a pointer for users. Ensure that this is the case by
unconditionally using the value of the respective keys.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
18 months agosystemd: Set service_extra_in/socket_extra_in everywhere
Andrea Bolognani [Fri, 29 Sep 2023 13:20:07 +0000 (15:20 +0200)]
systemd: Set service_extra_in/socket_extra_in everywhere

It's somewhat confusing that some of the services have a
corresponding foo.service.extra.in and foo.socket.extra.in, some
have just one of the two, and some have neither.

In order to make things more approachable, make sure that both
files exists for each service.

In most cases the extra units are currently unused, so they will
just contain a comment briefly explaining their purpose and
pointing users to meson.build, where they can find more
information. The same comment is also added to the top of
extra units that already have some contents in them for
consistency.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
18 months agosystemd: Allow comments at the top of units
Andrea Bolognani [Fri, 29 Sep 2023 13:28:25 +0000 (15:28 +0200)]
systemd: Allow comments at the top of units

Currently the script will reject any type of contents outside
of a section, but we want to be able to have some useful
comments at the top of each file to help users understand how
they are processed.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
18 months agosystemd: Introduce systemd_service_oomscoreadjust_extra_in
Andrea Bolognani [Thu, 28 Sep 2023 10:17:58 +0000 (12:17 +0200)]
systemd: Introduce systemd_service_oomscoreadjust_extra_in

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
18 months agosystemd: Introduce systemd_service_limitmemlock_extra_in
Andrea Bolognani [Thu, 28 Sep 2023 10:14:45 +0000 (12:14 +0200)]
systemd: Introduce systemd_service_limitmemlock_extra_in

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
18 months agosystemd: Introduce systemd_service_tasksmax_extra_in
Andrea Bolognani [Thu, 28 Sep 2023 10:07:15 +0000 (12:07 +0200)]
systemd: Introduce systemd_service_tasksmax_extra_in

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
18 months agosystemd: Introduce systemd_service_limitnofile_extra_in
Andrea Bolognani [Thu, 28 Sep 2023 09:51:16 +0000 (11:51 +0200)]
systemd: Introduce systemd_service_limitnofile_extra_in

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
18 months agosystemd: Accept multiple files for service_extra_in/socket_extra_in
Andrea Bolognani [Thu, 28 Sep 2023 09:43:31 +0000 (11:43 +0200)]
systemd: Accept multiple files for service_extra_in/socket_extra_in

Now that the underlying script is able to merge an arbitrary
number of units into the base template, expose this possibility
in the build system.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
18 months agosystemd: Support merging multiple units
Andrea Bolognani [Thu, 28 Sep 2023 09:39:23 +0000 (11:39 +0200)]
systemd: Support merging multiple units

In order to further deduplicate the contents of the various unit
files, we need to be able to merge multiple additional units
into the initial one.

Luckily the merge logic is in no way constrained to working with
just two units, so achieving this is pretty much just a matter
of lifting the existing limitation on the number of arguments
that the script accepts.

As a special case, it's now also possible to call the script
with just the base unit as argument. No merging will be performed
in that case, obviously, but we'll still go through the basic
validation and cleanup steps.

This also fixes a bug in the check for the number of arguments:
sys.argv also contains the name of the script, so we should have
checked that its size was at least 3. The check is now written in
a way that's less prone to misunderstandings.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
18 months agosystemd: libvirtd doesn't need @sockprefix@
Andrea Bolognani [Fri, 29 Sep 2023 13:20:58 +0000 (15:20 +0200)]
systemd: libvirtd doesn't need @sockprefix@

It uses custom templates which already hardcode the correct
value.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
18 months agoImprove `virsh create --console` behavior
Marc Hartmayer [Thu, 28 Sep 2023 15:37:10 +0000 (17:37 +0200)]
Improve `virsh create --console` behavior

When starting a guest via libvirt (`virsh create --console`), early
console output was missed because the guest was started first and then
the console was attached. This patch changes this to the following
sequence:

1. create a paused transient guest
2. attach the console
3. resume the guest

Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
18 months agoImprove `virsh start --console` behavior
Marc Hartmayer [Thu, 28 Sep 2023 15:37:09 +0000 (17:37 +0200)]
Improve `virsh start --console` behavior

When starting a guest via libvirt (`virsh start --console`), early
console output was missed because the guest was started first and then
the console was attached. This patch changes this to the following
sequence:

1. create a paused guest
2. attach the console
3. resume the guest

Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
18 months agovirsh: add `console --resume` support
Marc Hartmayer [Thu, 28 Sep 2023 15:37:08 +0000 (17:37 +0200)]
virsh: add `console --resume` support

This patch adds the command line flag `--resume` to the `virsh console`
command. This resumes a paused guest after connecting to the console.
This might be handy since it's a "common" pattern to start a guest
paused, connect to the console, and then resume it so as not to miss any
console messages.

Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
18 months agospecfile: use correct option for nbdkit in mingw build
Laine Stump [Mon, 23 Oct 2023 02:34:52 +0000 (22:34 -0400)]
specfile: use correct option for nbdkit in mingw build

commit v9.8.0-40-g7cbd8c4230 changed the name of the option that
enables/disables nbdkit support in the build from "libnbd" to
"nbdkit", but one use of "libnbd=disabled" was missed in
libvirt.specfile.in - the meson commandline for mingw.

This patch changes that line to "-Dnbdkit=disabled", thus unbreaking
the rpm build.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/550
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
18 months agoch: support serial and console devices in parallel
Praveen K Paladugu [Tue, 10 Oct 2023 21:42:58 +0000 (16:42 -0500)]
ch: support serial and console devices in parallel

Starting v18, cloud-hypervisor supports serial and console devices in
parallel. Drop related check based on ch version.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
18 months agoch: use payload api to send kernel details
Praveen K Paladugu [Tue, 10 Oct 2023 21:42:57 +0000 (16:42 -0500)]
ch: use payload api to send kernel details

Starting with v28.0 cloud-hypervisor requires the use of "payload" api to pass
kernel, initramfs and cmdline options. Extend ch driver to use the new
api based on ch version.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
18 months agoutil:hostcpu: Report physical address size based on Architecture
Narayana Murty N [Wed, 4 Oct 2023 05:58:41 +0000 (01:58 -0400)]
util:hostcpu: Report physical address size based on Architecture

The function virHostCPUGetPhysAddrSize was introduced with commit be1b7d5b18e
fails on architectures other than x86 and SuperH. The commit 8417c1394cd4d
fixed the issue only for s390 but the problem is still seen on other
architectures like ppc which does not report Physical address size in their
cpuinfo output.

command:
systemctl restart libvirtd.service
Output :
<snip>
dnsmasq[2377]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0
addresses
dnsmasq-dhcp[2377]: read /var/lib/libvirt/dnsmasq/default.hostsfile
libvirtd[3163]: libvirt version: 9.8.0
libvirtd[3163]: hostname: xxxxxxxxxx
libvirtd[3163]: internal error: Missing or invalid CPU address size in
/proc/cpuinfo
 libvirtd.service: Deactivated successfully.
 </snip>

This patch fixes this issue by returning the size=0 for architectures
other than x86 and SuperH.

Signed-off-by: Narayana Murty N <nnmlinux@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
18 months agolxc: fix lxcContainerMountAllFS() DEREF_BEFORE_CHECK
Dmitry Frolov [Thu, 7 Sep 2023 09:04:57 +0000 (12:04 +0300)]
lxc: fix lxcContainerMountAllFS() DEREF_BEFORE_CHECK

vmDef->fss[i]->src->path may be NULL,
so check is needed before passing it to VIR_DEBUG.
Also removed checking vmDef->fss[i]->src for NULL, since it may not be NULL.

Fixes: 57487085dc ("lxc: don't try to reference NULL when mounting filesystems")
Signed-off-by: Dmitry Frolov <frolov@swemel.ru>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
18 months agoqemu: Send event on persistent config modification
Fima Shevrin [Thu, 19 Oct 2023 14:20:36 +0000 (17:20 +0300)]
qemu: Send event on persistent config modification

Currently, libvirt doesn't send events when devices are attached,
detached or updated. Thus, any services that listen to events are
unaware of the change to persistent config.

Signed-off-by: Fima Shevrin <efim.shevrin@virtuozzo.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
18 months agoselinux: Drop dead code in virSecuritySELinuxSetImageLabelInternal()
Sergey Mironov [Wed, 11 Oct 2023 14:31:55 +0000 (17:31 +0300)]
selinux: Drop dead code in virSecuritySELinuxSetImageLabelInternal()

Considering that at the virSecuritySELinuxSetFilecon() function can only
return 0 or -1 and so does the virSecuritySELinuxFSetFilecon(), the check
for '1' at the end of virSecuritySELinuxSetImageLabelInternal() is
effectively a dead code. Drop it.

Co-developed-by: sdl.qemu <sdl.qemu@linuxtesting.org>
Signed-off-by: Sergey Mironov <mironov@fintech.ru>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
18 months agoexamples: Fix printf format string in event-test.c
zhujun2 [Tue, 17 Oct 2023 06:43:50 +0000 (23:43 -0700)]
examples: Fix printf format string in event-test.c

Inside of myDomainEventMemoryFailureCallback() arguments are
printed via printf but '%d' is used to print @flags (of type
uint). Use '0x%x' instead, just like we do everywhere else.

Signed-off-by: zhujun2 <zhujun2@cmss.chinamobile.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
18 months agoconf: Rename 'nodeformat' field of virStorageSource to 'nodenameformat'
Peter Krempa [Thu, 17 Aug 2023 13:36:51 +0000 (15:36 +0200)]
conf: Rename 'nodeformat' field of virStorageSource to 'nodenameformat'

While the name itself doesn't matter, this rename is done to prove that
all places using 'nodeformat' were converted to the appropriate
accessors.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: driver: Use 'format' nodename accessors for disk resize
Peter Krempa [Mon, 16 Oct 2023 14:48:17 +0000 (16:48 +0200)]
qemu: driver: Use 'format' nodename accessors for disk resize

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: migration: Use 'format' nodename accessors in dirty bitmap migration
Peter Krempa [Mon, 16 Oct 2023 14:44:20 +0000 (16:44 +0200)]
qemu: migration: Use 'format' nodename accessors in dirty bitmap migration

The persistent bitmaps are stored in the format layer, using 'effective'
bitmap name is the most reasonable approach in this case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: Convert migration setup code to use 'format' layer node name accessors
Peter Krempa [Mon, 16 Oct 2023 14:42:16 +0000 (16:42 +0200)]
qemu: Convert migration setup code to use 'format' layer node name accessors

The blockjob, NBD export and setup of the cookie data all care about the
effective nodename.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: command: Use 'format' nodename accessors for 'pflash' backend setup
Peter Krempa [Mon, 16 Oct 2023 14:39:46 +0000 (16:39 +0200)]
qemu: command: Use 'format' nodename accessors for 'pflash' backend setup

The frontend device needs to access the blocks directly so it cares
about the effective nodename.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: Use 'format' nodename accessors for block dirty bitmap operations
Peter Krempa [Mon, 16 Oct 2023 14:20:27 +0000 (16:20 +0200)]
qemu: Use 'format' nodename accessors for block dirty bitmap operations

In most cases the bitmap operations are relevant only on qcow2 images
thus the 'format' layer will be present. Although in certain specific
cases temporary bitmaps can be created on top of other images as well,
thus we use the 'effective' bitmap name in all cases for bitmap
operations.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: driver: Convert disk stats code to use 'format' nodename accessors
Peter Krempa [Mon, 16 Oct 2023 14:12:40 +0000 (16:12 +0200)]
qemu: driver: Convert disk stats code to use 'format' nodename accessors

I case of statistics we're interested in the statistics of the effective
bitmap whatever it happens to be.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: Convert disk backend setup code to use 'format' nodename accessors
Peter Krempa [Mon, 16 Oct 2023 14:09:55 +0000 (16:09 +0200)]
qemu: Convert disk backend setup code to use 'format' nodename accessors

The disk backend setup code is concerned only about the effective
nodename. Doing this conversion will also simplify further changes
needed to drop the 'raw' layer in cases when it's not really needed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agotests: Use 'format' layer nodename accessors in test code
Peter Krempa [Mon, 16 Oct 2023 13:55:25 +0000 (15:55 +0200)]
tests: Use 'format' layer nodename accessors in test code

The test code cares mostly about the actual layer nodenames thus,
appropriate accessors are used.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: domain: Use 'format' layer node name accessors for nodename setup code
Peter Krempa [Mon, 16 Oct 2023 13:54:17 +0000 (15:54 +0200)]
qemu: domain: Use 'format' layer node name accessors for nodename setup code

The code setting the nodenames needs to use the 'true' nodename of the
format layer.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: block: Use 'format' nodename accessors in '-blockdev' setup code
Peter Krempa [Thu, 4 Mar 2021 13:54:00 +0000 (14:54 +0100)]
qemu: block: Use 'format' nodename accessors in '-blockdev' setup code

Convert the main -blockdev JSON object setup code to use the new
accessors. In these we use mainly the real 'format' layer node name.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: blockjob: Use 'format' nodename accessors for job naming
Peter Krempa [Mon, 16 Oct 2023 13:41:12 +0000 (15:41 +0200)]
qemu: blockjob: Use 'format' nodename accessors for job naming

Use the effective nodename for naming the job as we use that one now.
It doesn't matter too much which one we pick, because it's used just for
the name of the job, which we preserve in the status XML.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: backup: Use format nodename accessors
Peter Krempa [Mon, 16 Oct 2023 13:36:47 +0000 (15:36 +0200)]
qemu: backup: Use format nodename accessors

Both modified cases in this patch require the effective nodename as they
deal with the data being backed up.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemuBlockStorageSourceGetFormatProps: Use new frontend name accessor
Peter Krempa [Tue, 12 Sep 2023 14:53:01 +0000 (16:53 +0200)]
qemuBlockStorageSourceGetFormatProps: Use new frontend name accessor

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: block: Add accessors for storage source effective nodename
Peter Krempa [Wed, 20 Sep 2023 13:47:51 +0000 (15:47 +0200)]
qemu: block: Add accessors for storage source effective nodename

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: block: Add accessors for format layer node names
Peter Krempa [Wed, 20 Sep 2023 13:24:14 +0000 (15:24 +0200)]
qemu: block: Add accessors for format layer node names

Introduce a set of accessors, which return node names based on
semantics. This will allow to us to modify how we setup the backing
chain in cases when e.g. the format driver can be omitted, without
breaking all the code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoconf: Rename 'nodestorage' field of virStorageSource to 'nodenamestorage'
Peter Krempa [Mon, 11 Sep 2023 13:46:33 +0000 (15:46 +0200)]
conf: Rename 'nodestorage' field of virStorageSource to 'nodenamestorage'

While the name itself doesn't matter, this rename is done to prove that
all places using 'nodestorage' were converted to the appropriate
accessors.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemuDomainSetBlockThreshold: Use 'storage' node name accessor
Peter Krempa [Mon, 25 Sep 2023 15:14:55 +0000 (17:14 +0200)]
qemuDomainSetBlockThreshold: Use 'storage' node name accessor

We need to keep setting the block threshold on the real storage layer
per semantics of the API. Use the appropriate accessor.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemuDomainGetStatsBlockExportDisk: Use 'storage' node name accessors
Peter Krempa [Mon, 25 Sep 2023 15:07:27 +0000 (17:07 +0200)]
qemuDomainGetStatsBlockExportDisk: Use 'storage' node name accessors

In all cases we want to probe stats from the 'storage' layer as we're
interested in the 'threshold' value, which we set there.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: Refactor storage backend 'storage' layer helepr object setup
Peter Krempa [Mon, 25 Sep 2023 15:02:20 +0000 (17:02 +0200)]
qemu: Refactor storage backend 'storage' layer helepr object setup

Use the new nodename accessors for any storage layer helper object.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: Refactor storage backend attach/detach setup code to use 'storage' nodename...
Peter Krempa [Mon, 25 Sep 2023 15:00:36 +0000 (17:00 +0200)]
qemu: Refactor storage backend attach/detach setup code to use 'storage' nodename accessors

Refactor the code settin up data structures used to attach/detach disks
and SCSI hostdevs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: domain: Rework assignment of 'storage' nodenames to use new accessors
Peter Krempa [Mon, 25 Sep 2023 14:57:21 +0000 (16:57 +0200)]
qemu: domain: Rework assignment of 'storage' nodenames to use new accessors

Refactor the code which assigns the 'storage' layer nodenames for disks.
scsi hostdevs and pflash backend.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: block: Convert disk 'storage' backend JSON props generator to new accessors
Peter Krempa [Mon, 25 Sep 2023 14:44:26 +0000 (16:44 +0200)]
qemu: block: Convert disk 'storage' backend JSON props generator to new accessors

We need to use the 'effective' storage nodename (one which includes the
optional storage slice 'raw' intermediate layer) in the code which
formats the 'format' layer props.

All other cases need the real storage driver nodename as they either
generate the 'storage' layer props, or the storage slice, which refers
to the proper storage backend.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: domain: Convert the status XML code for 'storage' nodenames to new accessors
Peter Krempa [Mon, 25 Sep 2023 14:34:39 +0000 (16:34 +0200)]
qemu: domain: Convert the status XML code for 'storage' nodenames to new accessors

Use the new accessors in the private XML formatters and parsers and the
recovery code.

Specifically in all instances we use the proper (not effective) storage
nodename. In the virStorageSource private data it is what we need to
store. In blockjobs status XML it simply serves us to find the
appropriate 'virStorageSource' struct so using the storage layer node
name is simpler.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: block: Use proper accessors for image formatting/creation code
Peter Krempa [Mon, 25 Sep 2023 14:24:07 +0000 (16:24 +0200)]
qemu: block: Use proper accessors for image formatting/creation code

Use 'qemuBlockStorageSourceGetEffectiveStorageNodename' in all the JSON
props formatters for setting up a 'blockdev-create' job of a format
layer.

In case of the blockjob name designator we're okay to use just the
storage layer nodename as that serves only to find the appropriate
entry.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemuDomainVirStorageSourceFindByNodeName: Use proper accessor
Peter Krempa [Tue, 22 Jun 2021 06:26:01 +0000 (08:26 +0200)]
qemuDomainVirStorageSourceFindByNodeName: Use proper accessor

The lookup by nodename requires the proper storage nodename which we use
also in status XML.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agotests: Use 'storage' layer nodename accessors in tests
Peter Krempa [Mon, 25 Sep 2023 14:19:34 +0000 (16:19 +0200)]
tests: Use 'storage' layer nodename accessors in tests

Convert all places in tests to use the 'storage' layer nodename
accessors instead of (virStorageSource)->nodestorage.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: block: Add accessors for protocol/storage node names
Peter Krempa [Mon, 21 Jun 2021 15:01:12 +0000 (17:01 +0200)]
qemu: block: Add accessors for protocol/storage node names

Introduce a set of accessors, which return node names based on
semantics. This will allow to us to modify how we setup the backing
chain in cases when e.g. the format driver can be omitted, without
breaking all the code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: block: Rename qemuBlockStorageSourceGetBlockdevProps
Peter Krempa [Tue, 12 Sep 2023 14:43:53 +0000 (16:43 +0200)]
qemu: block: Rename qemuBlockStorageSourceGetBlockdevProps

Use qemuBlockStorageSourceGetFormatProps as it formats the properties of
the 'format' driver in qemu. Adjust the comment which was hinting
otherwise.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: block: Refactor logic in qemuBlockStorageSourceGetBlockdevProps
Peter Krempa [Tue, 12 Sep 2023 14:36:31 +0000 (16:36 +0200)]
qemu: block: Refactor logic in qemuBlockStorageSourceGetBlockdevProps

Restructure the conditions so that we can use virJSONValueObjectAdd with
a clearer logic for backing store control.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: domain: Identify blockjobs by storage nodename in VM status XML
Peter Krempa [Thu, 4 Mar 2021 15:12:20 +0000 (16:12 +0100)]
qemu: domain: Identify blockjobs by storage nodename in VM status XML

Use the node name of the storage access driver to identify the block job
volumes. This will prepare the blockjob code for the possibility that the
format layer may be missing. Our lookup code can find either of them,
thus we can safely switch.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agotests: qemucapabilitiesdata: Add test data for qemu-8.2 dev cycle on x86_64
Peter Krempa [Mon, 25 Sep 2023 12:58:26 +0000 (14:58 +0200)]
tests: qemucapabilitiesdata: Add test data for qemu-8.2 dev cycle on x86_64

Add the test data based on v8.1.0-1639-g63011373ad

Notable changes in comparison with qemu-8.1 release:
 - new 8.2 machine types added
 - removed machine types: 'pc-i440fx-1.4', 'pc-i440fx-1.5', 'pc-i440fx-1.6', 'pc-i440fx-1.7'
 - 'rom' parameter for 'memory-backend-file' added
 - 'qemu-text-console', 'qemu-graphic-console',
   'qemu-fixed-text-console' QOM types added
 - 'qemu-console' -object removed
 - 'ufs-lu', 'ufs' devices added
 - 'sd-card-spi' device added
 - 'cryptodev-backend-lkcf' added
 - 'calc-dirty-rate' paramters 'calc-time-unit' added
 - 'guest_uso4', 'guest_uso6' 'host_uso' options for 'virtio-net-pci' added
 - new cpu flags: 'vmx-any-errcode', 'gds-no', 'vmx-complex',
   'vmx-enable-user-wait-pause'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agosecurity: apparmor: Use translated disk definitions for disk type=volume
Peter Krempa [Thu, 12 Oct 2023 14:03:41 +0000 (16:03 +0200)]
security: apparmor: Use translated disk definitions for disk type=volume

The 'virt-aa-helper' process gets a XML of the VM it needs to create a
profile for. For a disk type='volume' this XML contained only the
pool and volume name.

The 'virt-aa-helper' needs a local path though for anything it needs to
label. This means that we'd either need to invoke connection to the
storage driver and re-resolve the volume. Alternative which makes more
sense is to pass the proper data in the XML already passed to it via the
new XML formatter and parser flags.

This was indirectly reported upstream in
https://gitlab.com/libvirt/libvirt/-/issues/546

The configuration in the issue above was created by Cockpit on Debian.
Since Cockpit is getting more popular it's more likely that users will
be impacted by this problem.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoconf: Save translated disk definition for disk type='volume' to status XML
Peter Krempa [Thu, 12 Oct 2023 14:08:01 +0000 (16:08 +0200)]
conf: Save translated disk definition for disk type='volume' to status XML

Re-translating the disk source pools when reconnecting to a VM makes no
sense as the volume might have changed or pool became inactive. The VM
still uses the original volume though. Failing to re-translate the pool
also causes the VM to be killed.

Fix this by storing the original translation in the status XML.

Resolves: https://issues.redhat.com/browse/RHEL-7345
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemustatusxml2xmltest: Demonstrate use of VIR_DOMAIN_DEF_(PARSE|FORMAT)_VOLUME_TRANSLATED
Peter Krempa [Thu, 12 Oct 2023 13:56:59 +0000 (15:56 +0200)]
qemustatusxml2xmltest: Demonstrate use of VIR_DOMAIN_DEF_(PARSE|FORMAT)_VOLUME_TRANSLATED

Enable the flags in the status xml2xmtest and add an exaple to the test
data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoqemu: domain: Allow preserving translated disk type='volume' data into XML if needed
Peter Krempa [Thu, 12 Oct 2023 13:42:29 +0000 (15:42 +0200)]
qemu: domain: Allow preserving translated disk type='volume' data into XML if needed

Re-translating a disk type='volume' definition from a storage pool is
not a good idea in cases when the volume might have changed or we might
not have access to the storage driver.

Specific cases are if a storage pool is not activated on daemon restart,
then re-connecting to a VM fails, or if the virt-aa-helper program tries
to setup labelling for apparmor.

Add a new flag which will preserve the translated data in the
definition.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agovirDomainDiskTranslateSourcePool: Don't re-translate already translated defs
Peter Krempa [Thu, 12 Oct 2023 14:18:12 +0000 (16:18 +0200)]
virDomainDiskTranslateSourcePool: Don't re-translate already translated defs

If a disk definition was already translated re-doing it makes no sense.

Skip the translation if the 'actualtype' is already populated.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agovirDomainDiskSourcePoolDefParse: Refactor cleanup
Peter Krempa [Thu, 12 Oct 2023 13:07:52 +0000 (15:07 +0200)]
virDomainDiskSourcePoolDefParse: Refactor cleanup

Register autoptr cleanup function for virStorageSourcePoolDef and
refactor the parser to simplify the logic.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agovirStorageSourcePoolDef: Turn 'mode' member into proper enum type
Peter Krempa [Thu, 12 Oct 2023 13:13:52 +0000 (15:13 +0200)]
virStorageSourcePoolDef: Turn 'mode' member into proper enum type

Use proper enum type and refactor the formatter accordingly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
18 months agoTranslated using Weblate (Korean)
김인수 [Wed, 11 Oct 2023 10:36:12 +0000 (12:36 +0200)]
Translated using Weblate (Korean)

Currently translated at 100.0% (10413 of 10413 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>