]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
13 months agoqemu: domain: Drop added features from migratable CPU
Jiri Denemark [Mon, 11 Mar 2024 16:04:48 +0000 (17:04 +0100)]
qemu: domain: Drop added features from migratable CPU

Features marked with added='yes' in CPU model definitions have to be
removed before migration, otherwise older libvirt would complain about
unknown CPU features. We only do this for features that were enabled for
a given CPU model even with older libvirt, which just ignored the
features. And only for features we added ourselves when updating CPU
definition during domain startup, that is we do not remove features
which were explicitly mentioned by a user.

That said, this is not the safest thing we could do, but it's
effectively the same thing we did before the affected features were
added: we ignored them completely on both sides of migration.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
13 months agoconf: cpu: Introduce virCPUDefListFeatures
Jiri Denemark [Mon, 11 Mar 2024 14:37:32 +0000 (15:37 +0100)]
conf: cpu: Introduce virCPUDefListFeatures

The function returns a list of explicitly mentioned features in the CPU
definition.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
13 months agoqemu: domain: Check arch in qemuDomainMakeCPUMigratable
Jiri Denemark [Mon, 11 Mar 2024 14:34:37 +0000 (15:34 +0100)]
qemu: domain: Check arch in qemuDomainMakeCPUMigratable

The content is arch specific and checking for Icelake-Server CPU model
on non-x86 architectures does not make sense.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
13 months agocpu: x86: Add support for adding features to existing CPU models
Jiri Denemark [Thu, 7 Mar 2024 13:50:48 +0000 (14:50 +0100)]
cpu: x86: Add support for adding features to existing CPU models

This is not a good idea in general, but we can (and have to) do it in
specific cases when a feature has always been part of a CPU model in
hypervisor's definition, but we ignored it and did not include the
feature in our definition.

Blindly adding the features to the CPU map and not adding them to
existing CPU models breaks migration between old and new libvirt in both
directions. New libvirt would complain the features got unexpectedly
enabled (as they were not mentioned in the incoming domain XML) even
though they were also enabled on the source and the old libvirt just
didn't know about them. On the other hand, old libvirt would refuse to
accept incoming migration of a domain started by new libvirt because the
domain XML would contain CPU features unknown to the old libvirt.

This is exactly what happened when several vmx-* features were added a
few releases back. Migration between libvirt releases before and after
the addition is now broken.

This patch adds support for added these features to existing CPU models
by marking them with added='yes'. The features will not be considered
part of the CPU model and will be described explicitly via additional
<feature/> elements, but the compatibility check will not complain if
they are enabled by the hypervisor even though they were not explicitly
mentioned in the CPU definition and incoming migration from old libvirt
will succeed.

To fix outgoing migration to old libvirt, we also need to drop all those
features from domain XML unless they were explicitly requested by the
user. This will be handled by a later patch.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
13 months agotests: mock __open_2()
Michal Privoznik [Wed, 13 Mar 2024 16:25:35 +0000 (17:25 +0100)]
tests: mock __open_2()

As of commit [1] glibc may overwrite a call to open() with call
to __open_2() (if only two arguments are provided and the code is
compiled with clang). But since we are not mocking the latter our
test suite is broken as tests try to access paths outside of our
repo.

1: https://sourceware.org/git/?p=glibc.git;a=commit;h=86889e22db329abac618c6a41f86c84657a15324
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
13 months agovirusbmock: Switch to VIR_MOCK_REAL_INIT()
Michal Privoznik [Wed, 13 Mar 2024 16:35:15 +0000 (17:35 +0100)]
virusbmock: Switch to VIR_MOCK_REAL_INIT()

Since virusbmock was written 10 years ago, back when we didn't
have virmock.h and its helpers, it open codes symbol resolution
(VIR_MOCK_REAL_INIT). With a bit of cleanup (e.g. renaming
realopen to real_open and so on) it can use virmock.h provided
macros.

And while at it, drop include of virusb.h - there is no
compelling reason for it include the file. The mock just
redirects paths passed to open()/opendir().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
13 months agovsh: remove VSH_OFLAG_REQ
Peter Krempa [Tue, 5 Mar 2024 16:21:05 +0000 (17:21 +0100)]
vsh: remove VSH_OFLAG_REQ

The flag was replaced by the 'required' field in the option definition.
Remove last few uses and all assignments.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovsh: Replace VSH_OT_DATA by VSH_OT_STRING
Peter Krempa [Tue, 5 Mar 2024 15:07:36 +0000 (16:07 +0100)]
vsh: Replace VSH_OT_DATA by VSH_OT_STRING

Use the new 'positional' field to do decisions rather than have a
special type for positional strings.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovshCmddefHelp: Refactor and fix printing of help for _STRING/_INT arguments
Peter Krempa [Tue, 5 Mar 2024 15:53:55 +0000 (16:53 +0100)]
vshCmddefHelp: Refactor and fix printing of help for _STRING/_INT arguments

Use the new flags to do the decisions which will also fix the case when
an _INT option is required but non-positional.

This fixes the help for the 'timeout' argument of 'daemon-timeout'
virt-admin command:

     SYNOPSIS
  -    daemon-timeout <timeout>
  +    daemon-timeout --timeout <number>

[...]
     OPTIONS
  -    [--timeout] <number>  number of seconds the daemon will run without any active connection
  +    --timeout <number>  number of seconds the daemon will run without any active connection

Resolves: https://issues.redhat.com/browse/RHEL-25993
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovshCmdGrpHelp: Refactor formatting of help for VSH_OT_ARGV
Peter Krempa [Tue, 5 Mar 2024 15:32:40 +0000 (16:32 +0100)]
vshCmdGrpHelp: Refactor formatting of help for VSH_OT_ARGV

Use the new properties rather than infer the states.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovshCmddefCheckInternals: Remove refactoring safety checks
Peter Krempa [Tue, 5 Mar 2024 15:23:19 +0000 (16:23 +0100)]
vshCmddefCheckInternals: Remove refactoring safety checks

Now that the code was refactored and proved identical, remove the checks
so that they don't impede further refactors.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovsh: Require that positional non-argv arguments are required
Peter Krempa [Tue, 5 Mar 2024 15:17:21 +0000 (16:17 +0100)]
vsh: Require that positional non-argv arguments are required

This is logically enforced by existing checks, thus we can formalize it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovsh: Fix broken assumption that required VSH_OT_INT must be positional
Peter Krempa [Tue, 5 Mar 2024 15:00:41 +0000 (16:00 +0100)]
vsh: Fix broken assumption that required VSH_OT_INT must be positional

In at least one case we've wanted a mandatory argument which requires
the explicit flag. Fix the assumption before converting everything over
to the new flags.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovsh: Annotate 'required' and 'positional' arguments explicitly
Peter Krempa [Tue, 5 Mar 2024 14:07:47 +0000 (15:07 +0100)]
vsh: Annotate 'required' and 'positional' arguments explicitly

Add 'positional' and 'required' fields to vshCmdOptDef, which will
explicitly track the two properties of arguments.

To ensure that we have proper coverage, add checks to
vshCmddefCheckInternals validating the state of the above flags by
infering it from existing data.

This conversion will allow us:
 - remove VSH_OT_DATA in favor of VSH_OT_STRING
 - use VSH_OT_INT when required both as positional and non-positional
 - properly annotate which VSH_OT_ARGV are positional and which are not
   (currently inferred by whether an previous positional option exists)

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirsh: Inline only use of VIRSH_COMMON_OPT_DOMAIN_OT_ARGV macro
Peter Krempa [Tue, 5 Mar 2024 14:22:35 +0000 (15:22 +0100)]
virsh: Inline only use of VIRSH_COMMON_OPT_DOMAIN_OT_ARGV macro

There's just one command taking a list of domains as argument, thus
declare it inline.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovshCmddefGetOption: Improve readability
Peter Krempa [Tue, 5 Mar 2024 11:35:51 +0000 (12:35 +0100)]
vshCmddefGetOption: Improve readability

Declare one argument per line, separate disticnt conditions by newline,
move some checks earlier.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovshCmddefHelp: Refactor printing of help (argument description)
Peter Krempa [Fri, 1 Mar 2024 13:51:46 +0000 (14:51 +0100)]
vshCmddefHelp: Refactor printing of help (argument description)

Extract flag check to a separate variable and replace ternary operators
by normal conditions and use allocated buffer instead of a static one
to improve readability.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovshCmddefHelp: Refactor printing of help (list of arguments)
Peter Krempa [Fri, 1 Mar 2024 13:51:46 +0000 (14:51 +0100)]
vshCmddefHelp: Refactor printing of help (list of arguments)

Extract flag check to a separate variable and replace ternary operators
by normal conditions and directly output the text rather than using
extra variable to improve readability.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovsh: Refactor store of command help and description
Peter Krempa [Mon, 4 Mar 2024 12:21:50 +0000 (13:21 +0100)]
vsh: Refactor store of command help and description

Store the pointers to 'help' and 'description' information in the struct
directly rather than in a key-value list.

The generic approach never got any extra use.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovsh: Add '--dump-help' option for 'self-test' command
Peter Krempa [Fri, 1 Mar 2024 22:01:54 +0000 (23:01 +0100)]
vsh: Add '--dump-help' option for 'self-test' command

The new option dumps the full help outputs for every command so that
it's possible to conveniently check that subsequent refactors will not
impact any of the external functionality.

No man page entry is needed as the command is internal/undocumented.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirsh-domain: Don't explicitly break lines in help
Peter Krempa [Fri, 1 Mar 2024 14:05:43 +0000 (15:05 +0100)]
virsh-domain: Don't explicitly break lines in help

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirt-admin: Drop trailing whitespaces from description of some commands
Peter Krempa [Fri, 1 Mar 2024 14:04:34 +0000 (15:04 +0100)]
virt-admin: Drop trailing whitespaces from description of some commands

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirsh: Remove uncommon redundant descriptions of virsh commands
Peter Krempa [Fri, 1 Mar 2024 14:02:07 +0000 (15:02 +0100)]
virsh: Remove uncommon redundant descriptions of virsh commands

Some description of virsh commands referenced itself in a multi-line
example of usage, which is pointless as virsh help already shows how to
use the command:

     .data = N_("Get or set the current memory parameters for a guest"
                " domain.\n"
                "    To get the memory parameters use following command: \n\n"
                "    virsh # memtune <domain>")

Change it to just state what the command does and leave the example for
the help printer.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovshCmddefCheckInternals: Fix listing of missing completers for 'VSH_OT_ARGV'
Peter Krempa [Fri, 1 Mar 2024 11:35:46 +0000 (12:35 +0100)]
vshCmddefCheckInternals: Fix listing of missing completers for 'VSH_OT_ARGV'

Use a switch statement to cover all cases and check for missing
completers for arguments declared as VSH_OT_ARGV.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovsh: Remove VSH_CMD_FLAG_ALIAS
Peter Krempa [Fri, 1 Mar 2024 22:14:51 +0000 (23:14 +0100)]
vsh: Remove VSH_CMD_FLAG_ALIAS

It's obvious that a command is an alias when the 'alias' property is
set, thus an extra flag is redundant. Remove it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovsh: Add VSH_OT_NONE option type to catch programming errors
Peter Krempa [Mon, 4 Mar 2024 14:40:40 +0000 (15:40 +0100)]
vsh: Add VSH_OT_NONE option type to catch programming errors

Add a check that the default 0 assignment will not mean that an option
is considered to be VSH_OT_BOOL.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovsh: Don't translate error messages for 'self-test'
Peter Krempa [Fri, 1 Mar 2024 15:39:39 +0000 (16:39 +0100)]
vsh: Don't translate error messages for 'self-test'

The command invoking the code is internal and meant for developers,
there's no point in translating the errors.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovsh: Always assume that command groups are used
Peter Krempa [Mon, 4 Mar 2024 14:51:28 +0000 (15:51 +0100)]
vsh: Always assume that command groups are used

None of the clients use the 'command set' approach and other pieces of
code such as the command validator already assume that command groups
are in use. Remove the unused 'command set' stuff.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agocapabilities: Allow suppressing error message from virCapabilitiesDomainSupported()
Michal Privoznik [Fri, 8 Mar 2024 13:51:44 +0000 (14:51 +0100)]
capabilities: Allow suppressing error message from virCapabilitiesDomainSupported()

In a few cases (CH driver) we want
virCapabilitiesDomainSupported() just to check whether given
virtType is supported and report a different error message (that
suggests how to solve the problem). Introduce reportError
argument which makes the function report an error iff set.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
13 months agocapabilities: Allow suppressing error message from virCapabilitiesDomainDataLookup()
Michal Privoznik [Fri, 8 Mar 2024 13:43:13 +0000 (14:43 +0100)]
capabilities: Allow suppressing error message from virCapabilitiesDomainDataLookup()

In near future we will want to check whether capabilities for
given virtType exist, but report an error on our own. Introduce
reportError argument which makes the function report an error iff
set.

In one specific case (virQEMUCapsGetDefaultVersion()) we were
even overwriting (more specific) error message reportd by
virCapabilitiesDomainDataLookup(). Drop that too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
13 months agoch: Demote error when CH driver fails to init
Michal Privoznik [Fri, 8 Mar 2024 14:12:15 +0000 (15:12 +0100)]
ch: Demote error when CH driver fails to init

If the host doesn't have /dev/kvm nor /dev/mshv, i.e. CH driver
is unable to run any guests, then an error is reported. But the
usual thing to do here is print an info message into the logs and
return VIR_DRV_STATE_INIT_SKIPPED. It is a recoverable error
after all.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
13 months agotests: Introduce chxml2xmlmock
Michal Privoznik [Fri, 8 Mar 2024 14:03:04 +0000 (15:03 +0100)]
tests: Introduce chxml2xmlmock

As of previous commit, the CH driver checks for /dev/kvm and/or
/dev/mshv presence. In order to make chxml2xmltest work
regardless of host configuration, introduce a mock that pretends
both of these files are accessible.

Fixes: 51c14df9670ba2f5d193b700f39e6464e1bc18c6
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
13 months agostorage: Upgrade default qcow2 verion to 1.1
Abhiram Tilak [Tue, 5 Mar 2024 19:50:13 +0000 (01:20 +0530)]
storage: Upgrade default qcow2 verion to 1.1

Change the default to modern qcow2 as it's supported by all qemu
versions supported by libvirt and in fact 'qemu-img' already defaults to
the new format for a long time.

Some Unittests require changes to pass, now that version 1.1 is default.
Unittests like `qcow2-1.1.argv` may not be relevant anymore, but this
patch doesn't affect them.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/602
Signed-off-by: Abhiram Tilak <atp.exp@gmail.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
13 months agovsh: introduce vshEditString
Ján Tomko [Wed, 28 Feb 2024 15:31:35 +0000 (16:31 +0100)]
vsh: introduce vshEditString

Remove some code repetition between desc and net-desc commands.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agovirsh: remove trailing whitespace even when editing the description
Ján Tomko [Wed, 28 Feb 2024 12:33:12 +0000 (13:33 +0100)]
virsh: remove trailing whitespace even when editing the description

When editing the title of a domain or network via the `desc` or
`net-desc` commands, we strip the final newline that is added by some
editors.

Do the same when editing the description as well.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoremote: add VIR_ERR_NO_NETWORK_METADATA to daemonErrorLogFilter
Ján Tomko [Wed, 28 Feb 2024 12:32:42 +0000 (13:32 +0100)]
remote: add VIR_ERR_NO_NETWORK_METADATA to daemonErrorLogFilter

Similar to other VIR_ERR_NO_* errors, we don't want to spam the daemon
log with these messages.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agovirsh: Introduce domdisplay-reload command
Zheng Yan [Tue, 11 May 2021 14:05:21 +0000 (22:05 +0800)]
virsh: Introduce domdisplay-reload command

Introduce the domdisplay-reload command to make the domain reload
its graphics certificates
   #virsh domdisplay-reload <domain> --type <type>

Signed-off-by: Zheng Yan <yanzheng759@huawei.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoqemu: implement qemuDomainGraphicsReload
Zheng Yan [Tue, 11 May 2021 14:05:19 +0000 (22:05 +0800)]
qemu: implement qemuDomainGraphicsReload

The 'display-reload' QMP command had been introduced from QEMU 6.0.0:

https://gitlab.com/qemu-project/qemu/-/commit/9cc07651655ee86eca41059f5ead8c4e5607c734

Currently it only supports reloading TLS certificates for VNC.

Resloves: https://issues.redhat.com/browse/RHEL-16333

Signed-off-by: Zheng Yan <yanzheng759@huawei.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoremote: implement virDomainGraphicsReload
Ján Tomko [Tue, 12 Dec 2023 14:47:31 +0000 (15:47 +0100)]
remote: implement virDomainGraphicsReload

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agolibvirt: Introduce virDomainGraphicsReload API
Zheng Yan [Tue, 11 May 2021 14:05:20 +0000 (22:05 +0800)]
libvirt: Introduce virDomainGraphicsReload API

The new virDomainGraphicsReload API is used to make the domain reload
its certificates without restart, and avoid service interruption.

Currently, only QEMU VNC TLS certificates are supported, but
flags are also reserved for subsequent scenarios.

To reload QEMU VNC TLS certificates as an example, we can call:

  virDomainGraphicsReload(domain, 0, 0);

Then the specified QMP message would be send to QEMU:
{"execute": "display-reload", "arguments":{"type": "vnc", "tls-certs": true}}

Signed-off-by: Zheng Yan <yanzheng759@huawei.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoqemu_capabilities: Add QEMU_CAPS_DISPLAY_RELOAD
Zheng Yan [Tue, 11 May 2021 14:05:18 +0000 (22:05 +0800)]
qemu_capabilities: Add QEMU_CAPS_DISPLAY_RELOAD

The 'display-reload' QMP command was introduced in QEMU 6.0.0, so we
add a compatible capability to check if target QEMU binary supports it.

{"execute":"display-reload", "arguments":{"type": "vnc", "tls-certs": true}}

The new QMP refer to:
https://gitlab.com/qemu-project/qemu/-/commit/9cc07651655ee86eca41059f5ead8c4e5607c734

Signed-off-by: Zheng Yan <yanzheng759@huawei.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoch: Enable hyperv hypervisor
Praveen K Paladugu [Tue, 20 Feb 2024 22:06:03 +0000 (16:06 -0600)]
ch: Enable hyperv hypervisor

Cloud-Hypervisor is capable of running VMs with kvm or mshv as the
hypervisor on Linux Host. Guest to hypevisor ABI with mshv hypervisor is
the same as in the case of VIR_DOMAIN_VIRT_HYPERV. So, VIR_DOMAIN_VIRT_HYPERV
type will be reused to represent the config with Linux Host and mshv as the
hypervisor.

While initializing ch driver, check if either of /dev/kvm or /dev/mshv
device is present on the host. Before starting ch domains, check if the
requested hypervisor device is present on the host.

Users can specify hypervisor in ch guests's domain definitions like
below:

<domain type='kvm'>

_or_

<domain type='hyperv'>

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Signed-off-by: Praveen K Paladugu <praveenkpaladugu@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
14 months agoch: Add support for `Unix` mode to serial port dev
Praveen K Paladugu [Tue, 5 Mar 2024 20:57:04 +0000 (14:57 -0600)]
ch: Add support for `Unix` mode to serial port dev

With Unix mode, pass a socket path to cloud-hypervisor.
Cloud-Hypervisor will attach guest's serial port to this socket path.
Users can connect to the serial port using one of the following commands:

`socat -,crnl UNIX-CONNECT:<path/to/socket>`

OR

`minicom --device unix#<path/to/socket>`

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
14 months agoch: Add Cap checks for unix backend of serial port
Praveen K Paladugu [Tue, 5 Mar 2024 20:57:03 +0000 (14:57 -0600)]
ch: Add Cap checks for unix backend of serial port

Unix Socket backend is only supported for serial port in
cloud-hypervisor. Add relevant checks in chValidateDomainDeviceDef.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
14 months agodocs: Update documentation of CPU models in domain caps
Jiri Denemark [Tue, 5 Mar 2024 15:16:05 +0000 (16:16 +0100)]
docs: Update documentation of CPU models in domain caps

Using check='none' when starting a domain with a CPU model marked as
usable is no longer needed as libvirt will do the right thing even with
check='partial'.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
14 months agotests: Don't advertise features for edk2-loongarch64
Andrea Bolognani [Wed, 6 Mar 2024 13:09:35 +0000 (14:09 +0100)]
tests: Don't advertise features for edk2-loongarch64

The "acpi" feature is not part of the specification[1],
so it will just get ignored.

[1] https://gitlab.com/qemu-project/qemu/-/blob/master/docs/interop/firmware.json

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
14 months agoqemu: command: Remove fallback '-usb' handling
Peter Krempa [Tue, 27 Feb 2024 16:16:56 +0000 (17:16 +0100)]
qemu: command: Remove fallback '-usb' handling

Currently all machine types which do honour '-usb' are already covered
by code which will either select a proper controller model or would
select the same one which '-usb' would use.

Thus all of the legacy -usb controller code can be removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
14 months agoqemu: command: Don't downgrade to '-usb' for arm based machines
Peter Krempa [Wed, 21 Feb 2024 16:41:01 +0000 (17:41 +0100)]
qemu: command: Don't downgrade to '-usb' for arm based machines

 - 'virt*' machines already don't allow downgrade
 - 'versatilepb' and 'realview' machines use 'pci-ohci' controller with '-usb'
 - all other machines ignore '-usb' (some have sysbus-based USB
   controller which we don't even consider)

For the 'versatilepb' and 'realview' machines libvirt would already
resort to picking either an existing controller model or trying to pick
the one which '-usb' would select and thus fail either way.

All other machine types ignore it.

We can thus remove the fallback for all arm-based machines.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
14 months agoqemu: command: Don't downgrade to '-usb' for ppc based machines
Peter Krempa [Wed, 21 Feb 2024 16:41:01 +0000 (17:41 +0100)]
qemu: command: Don't downgrade to '-usb' for ppc based machines

 - 'pseries' machines already don't allow downgrade
 - 'g3beige' and 'mac99' machines use 'pci-ohci' controller with '-usb'
 - all other machines ignore '-usb'

For 'g3beige' and 'mac99' libvirt already has 'pci-ohci' as contoller it
would select as one of the options when picking a model, thus it's
impossible to reach situation when '-usb' would be honoured.

All other machine types ignore it.

We can thus remove the fallback for all ppc-based machines.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
14 months agoqemu: command: Don't downgrade to '-usb' with 'pseries' machines
Peter Krempa [Tue, 20 Feb 2024 15:23:32 +0000 (16:23 +0100)]
qemu: command: Don't downgrade to '-usb' with 'pseries' machines

The default USB device auto-selection code for 'pseries' machines picks
controller models which are also selected when '-usb' is used thus it's
impossible to end up in the case when using '-usb' would be possible:

 $ qemu-system-ppc64 --machine pseries,usb=on
 qemu-system-ppc64: could not find a module for type 'nec-usb-xhci'
 $ qemu-system-ppc64 --machine pseries-2.5,usb=on
 qemu-system-ppc64: could not find a module for type 'pci-ohci'

Remove the impossible downgrade and adjust tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
14 months agoqemu: command: Don't downgrade to '-usb' for x86 based machines
Peter Krempa [Mon, 19 Feb 2024 14:28:33 +0000 (15:28 +0100)]
qemu: command: Don't downgrade to '-usb' for x86 based machines

- 'q35' machine type already explicitly forbids fallback
- 'isapc' never supported USB and '-usb' is ignored
- 'i440fx' does support '-usb' and translates it into 'piix3-uhci' which
  is identical to what libvirt selects
- we currently don't care about 'microvm'

Attempting to start an 'pc' (i440fx) machine with -usb when 'piix3-uhci'
is compiled out will fail and in any other case libvirt will use the
proper explicitly selected controller.

Drop the '-usb' downgrade for x86 arch.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
14 months agoqemuDomainControllerDefPostParse: Use 'pci-ohci' as last-resort fallback USB controller
Peter Krempa [Tue, 27 Feb 2024 11:52:08 +0000 (12:52 +0100)]
qemuDomainControllerDefPostParse: Use 'pci-ohci' as last-resort fallback USB controller

This controller is used as the default/implicit USB controller by
multiple machine types which honour the '-usb' flag of qemu. Add it as
fallback in libvirt too.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
14 months agoqemuDomainDefAddDefaultDevices: Populate default USB for 'versatilepb' and 'realview...
Peter Krempa [Mon, 26 Feb 2024 15:17:41 +0000 (16:17 +0100)]
qemuDomainDefAddDefaultDevices: Populate default USB for 'versatilepb' and 'realview' ARM machines

The machine types historically have a default USB controller populated
via '-usb' which libvirt assumed implicitly. Qemu will use 'pci-ohci'
for both if '-usb' is used.

Unfortunately an USB controller instantiated via '-usb' is unusable as
the bus name libvirt generates doesn't reflect the real name qemu uses,
and thus no libvirt-defined USB devices can be put on the controller.

This patch will populate the default USB controller into the XML and
select it's model to 'pci-ohci' unconditionally as the machine would
fail to start with '-usb' if that controller model is not available.

This patch doesn't try to make any other assumptions about
auto-populated model of USB controllers, which means that for an
explicit USB controller without model a different model will be picked.

Note that this will likely cause ABI differences and break migration for
the two machine types, in the corner case when the default USB
controller would be populated, but given that both are obsolete board
types and USB was unusable it doesn't make sense to keep supporting this
specific case when '-usb' was formatted.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
14 months agoqemuDomainControllerDefPostParse: Use proper enum value for default USB controller...
Peter Krempa [Tue, 27 Feb 2024 12:18:06 +0000 (13:18 +0100)]
qemuDomainControllerDefPostParse: Use proper enum value for default USB controller model

Assign VIR_DOMAIN_CONTROLLER_MODEL_USB_DEFAULT rather than -1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
14 months agoqemuDomainDefAddDefaultDevices: Handle defaults for all ARM arches together
Peter Krempa [Mon, 26 Feb 2024 14:45:41 +0000 (15:45 +0100)]
qemuDomainDefAddDefaultDevices: Handle defaults for all ARM arches together

Most machine types are avaliable in all arches by qemu. This is also
true for the 'versatilepb' machine type example in the tests.

Move all the ARM architectures together so that they are handled in
sync.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
14 months agoqemuxmlconftest: Add test data for USB selection with 'mac99' machine on ppc
Peter Krempa [Wed, 21 Feb 2024 14:30:41 +0000 (15:30 +0100)]
qemuxmlconftest: Add test data for USB selection with 'mac99' machine on ppc

Add an example using the old binary/machine type to also see how legacy
cases are handled.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
14 months agoqemuxmlconftest: Add test data for USB selection with 'powernv' machine on ppc64
Peter Krempa [Wed, 21 Feb 2024 14:30:41 +0000 (15:30 +0100)]
qemuxmlconftest: Add test data for USB selection with 'powernv' machine on ppc64

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
14 months agoqemuxmlconftest: Add test data for USB selection with 'mac99' machine on ppc64
Peter Krempa [Wed, 21 Feb 2024 14:30:41 +0000 (15:30 +0100)]
qemuxmlconftest: Add test data for USB selection with 'mac99' machine on ppc64

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
14 months agoqemuxmlconftest: Add test data for USB selection with 'g3beige' machine on ppc64
Peter Krempa [Wed, 21 Feb 2024 14:30:41 +0000 (15:30 +0100)]
qemuxmlconftest: Add test data for USB selection with 'g3beige' machine on ppc64

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
14 months agoqemuxmlconftest: Add test case when default USB controller for 'pseries' is compiled out
Peter Krempa [Tue, 20 Feb 2024 14:50:04 +0000 (15:50 +0100)]
qemuxmlconftest: Add test case when default USB controller for 'pseries' is compiled out

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
14 months agoqemuxml2conftest: Consolidate usb controller tests for 'pseries' machine
Peter Krempa [Tue, 20 Feb 2024 14:44:00 +0000 (15:44 +0100)]
qemuxml2conftest: Consolidate usb controller tests for 'pseries' machine

Move the test invocation and rename the test files according to the
pattern.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
14 months agoqemuxmlconftest: Add test data for an ARM machine where qemu doesn't honour -usb
Peter Krempa [Tue, 20 Feb 2024 14:05:51 +0000 (15:05 +0100)]
qemuxmlconftest: Add test data for an ARM machine where qemu doesn't honour -usb

The 'borzoi' machine doesn't honour '-usb' in qemu so use it as an
example for the upcoming patch for removing '-usb' support.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
14 months agoqemuxmlconftest: Add test for 'realview' machine
Peter Krempa [Tue, 20 Feb 2024 13:22:05 +0000 (14:22 +0100)]
qemuxmlconftest: Add test for 'realview' machine

Add test data for a 'realview' machine example to validate default USB
controller selection.

Note that it's unlikely that anyone would run 'realview' machines with
'aarch64' architecture, but qemu allows it and it's simpler test-wise in
libvirt.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
14 months agoqemuxmlconfdata: Add tests for USB controller selection with 'versatilepb' machine...
Peter Krempa [Mon, 26 Feb 2024 14:34:12 +0000 (15:34 +0100)]
qemuxmlconfdata: Add tests for USB controller selection with 'versatilepb' machine on arm qemu binary

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
14 months agoqemuxmlconfdata: Add tests for USB controller selection with 'versatilepb' machine...
Peter Krempa [Mon, 26 Feb 2024 14:34:12 +0000 (15:34 +0100)]
qemuxmlconfdata: Add tests for USB controller selection with 'versatilepb' machine on aarch64 qemu binary

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
14 months agoqemucapabilitiestest: Add test dump for 'armv7l' architecture
Peter Krempa [Thu, 22 Feb 2024 13:37:08 +0000 (14:37 +0100)]
qemucapabilitiestest: Add test dump for 'armv7l' architecture

Add capabilities based on a dump from x86_64 host running Fedora for the
qemu-system-arm binary.

The test dump will be used for illustration of USB controller model
selection.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
14 months agotestutilshostcpus: Add support for VIR_ARCH_ARMV7L
Peter Krempa [Thu, 22 Feb 2024 13:35:51 +0000 (14:35 +0100)]
testutilshostcpus: Add support for VIR_ARCH_ARMV7L

Allow using armv7l arch in a capability dump.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
14 months agoqemucapabilitiesdata: Document faked caps dumps
Peter Krempa [Thu, 22 Feb 2024 13:34:25 +0000 (14:34 +0100)]
qemucapabilitiesdata: Document faked caps dumps

Document the reality that some dumps were faked for purpose of testing
corner cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
14 months agotests: Replace mentions of the removed 'qemucapabilitiesnumbering' tool
Peter Krempa [Thu, 22 Feb 2024 13:29:43 +0000 (14:29 +0100)]
tests: Replace mentions of the removed 'qemucapabilitiesnumbering' tool

Mention the new 'scripts/qemu-replies-tool.py'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
14 months agoqemu: Optimize CPU check='partial' for usable CPUs
Jiri Denemark [Fri, 1 Mar 2024 15:56:16 +0000 (16:56 +0100)]
qemu: Optimize CPU check='partial' for usable CPUs

Ideally check='partial' would check exactly the features QEMU would want
to enable when asked for a specific CPU model (and features). But there
is no way we could ask QEMU how a specific CPU would look like. So we
use our definition from CPU map, which may slightly differ as QEMU adds
or removes features from CPU models, and thus we may end up checking
features which QEMU would not enable while missing some required ones.

We can do better in specific cases, though. If a CPU definition uses
only a model and disabled features (or none at all), we already know
whether QEMU can enable all features required by the CPU model as that's
what we use to set usable='yes' attribute in the list of available CPU
models in domain capbilities XML. So when a usable CPU model is
requested without asking for additional features (disabling features is
fine) we can avoid our possible inaccurate check using our CPU map.

For backward compatibility we only consider usable models. If a
specified model is not usable, we still check it the old way and even
let QEMU start it (and disable some features) in case our definition
lacks some features compared to QEMU.

Fixes: https://gitlab.com/libvirt/libvirt/-/issues/608
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
14 months agocpu: x86: Check for invalid CPU data from hypervisor
Jiri Denemark [Thu, 29 Feb 2024 17:28:02 +0000 (18:28 +0100)]
cpu: x86: Check for invalid CPU data from hypervisor

Recently a kernel bug caused QEMU to report a CPU feature as enabled
while listing it in the "unavailable-features" list of features that
were requested, but could not be enabled. The feature was actually
enabled, but we marked it as disabled when starting a domain. Later when
the domain is migrated, the destination requests the feature to be
disabled, which breaks the guest ABI or if we are lucky QEMU just fails
to load the migration stream.

Let's make similar bugs more visible in the future by refusing to even
start the domain.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
14 months agovirsh: Fix overflow error of freepages command
Adam Julis [Tue, 5 Mar 2024 10:43:03 +0000 (11:43 +0100)]
virsh: Fix overflow error of freepages command

Trying to print pages of a size larger than the UINT_MAX of the
given platform (for example, 4G on 64-bit ARM), results in a
system error even though this is a legitimate request.

The vshCommandOptScaledInt() used for parsing the pagesize is
given UINT_MAX as the upper limit. The parsed value is then
divided by 1024 and fed to virNodeGetFreePages() which expects an
unsigned int. We can't change the public API but the upper limit
can be raised by the factor of 1024.

Resolves: https://issues.redhat.com/browse/RHEL-23608

Signed-off-by: Adam Julis <ajulis@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
14 months agoci: refresh with lcitool manifest
Daniel P. Berrangé [Mon, 4 Mar 2024 13:41:43 +0000 (13:41 +0000)]
ci: refresh with lcitool manifest

Picks up the switch from FreeBSD 13.2 to 13.3

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
14 months agotests: Add invalid firmware descriptor
Andrea Bolognani [Thu, 29 Feb 2024 18:34:16 +0000 (19:34 +0100)]
tests: Add invalid firmware descriptor

This is guaranteed to keep failing even after loongarch64
support is introduced.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
14 months agotests: Add firmware descriptor for edk2 on loongarch64
Andrea Bolognani [Thu, 29 Feb 2024 14:29:23 +0000 (15:29 +0100)]
tests: Add firmware descriptor for edk2 on loongarch64

This fails to be parsed because libvirt doesn't yet know about
the architecture, but thanks to the recent improvements this
is a merely a local failure rather than bringing everything
else down with it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
14 months agoqemu: Make firmware parsing failures non-fatal
Andrea Bolognani [Thu, 29 Feb 2024 14:43:45 +0000 (15:43 +0100)]
qemu: Make firmware parsing failures non-fatal

At the moment, any kind of issue being detected in any of the
firmware descriptor files will result in the entire process
being aborted.

In particular, installing a build of edk2 for an architecture
that libvirt doesn't yet know about, for example loongarch64,
will break most firmware-related functionality: it will no
longer be possible to define new EFI VMs, start existing ones,
or even just obtain the domcapabilities for any architecture.

This is obviously unnecessarily harsh. Adopt a more relaxed
approach and simply ignore the firmware descriptors that we
are unable to parse correctly.

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
14 months agoqemu: Rewrite qemuFirmwareFetchParsedConfigs()
Andrea Bolognani [Thu, 29 Feb 2024 15:16:53 +0000 (16:16 +0100)]
qemu: Rewrite qemuFirmwareFetchParsedConfigs()

Instead of returning the list of paths exactly as obtained
from qemuFirmwareFetchConfigs(), and allocating the list of
firmwares to be exactly that size right away, start with two
empty lists and add elements to them one by one.

At the moment this only makes things more verbose, but later
we're going to change things so that it's possible that some
of the paths/firmwares are not included in the lists returned
to the caller, and at that point the changes will pay off.

Note that we can't use g_auto() for the new list of paths,
because until the very last moment it's not null-terminated,
so g_strfreev() wouldn't be able to handle it correctly.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
14 months agoqemu: Add missing early returns
Andrea Bolognani [Thu, 29 Feb 2024 14:40:08 +0000 (15:40 +0100)]
qemu: Add missing early returns

In a couple of cases, we were reporting an error without
actually terminating the parse process.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
14 months agodocs: newapi: Fix generation of type definition tables
Peter Krempa [Thu, 29 Feb 2024 12:50:09 +0000 (13:50 +0100)]
docs: newapi: Fix generation of type definition tables

Ensure that all rows have 3 columns and avoid generation of emtpy
elements which would be turned by the XML formatter into non-pair td/tr
tags which don't work properly with HTML5 parsers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
14 months agodocs: newapi: Properly skip ACL entries if empty
Peter Krempa [Thu, 29 Feb 2024 13:22:58 +0000 (14:22 +0100)]
docs: newapi: Properly skip ACL entries if empty

The source document can contain an empty '@flags' attribute which passes
the test but generates an empty element. Check that flags is non-empty
to trigger the fallback.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
14 months agodocs: newapi: Avoid table where every row has an cell with 'colspan'
Peter Krempa [Thu, 29 Feb 2024 13:11:57 +0000 (14:11 +0100)]
docs: newapi: Avoid table where every row has an cell with 'colspan'

The HTML standard requires that a table column must include at least one
row which defines it exclusively, thus having a table where all rows
unite it via 'colspan' is illegal.

Modify the enum value generator to always output the description field
even when it's empty rather than uniting it, as in case when each value
doesn't have a description the generated document would violate the
standard.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
14 months agodocs: newapi: Avoid empty <div>s when there is no description
Peter Krempa [Thu, 29 Feb 2024 12:06:39 +0000 (13:06 +0100)]
docs: newapi: Avoid empty <div>s when there is no description

The various objects we generate API for may have empty description in
which case an empty div would be generated when processing the API
description. As we're using XML output mode the generator would shorten
such divs to the non-pair empty element version, which doesn't work well
with HTML5 parsers requiring a pair tag for <div>

Avoid empty description <div> elements altogether by skipping it if the
description is empty.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
14 months agodocs: newapi: Don't generate empty <div> in template for ACL permissions
Peter Krempa [Thu, 22 Feb 2024 12:29:07 +0000 (13:29 +0100)]
docs: newapi: Don't generate empty <div> in template for ACL permissions

If an API has no ACLs an empty <div class='acl'/> would be generated
which is mis-interpreted by browsers when creating DOM to nest any
subsequent elements under it.

Don't generate the ACL section div unless it will be filled.

Best viewed with 'git show -w'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
14 months agodocs: index: Fix import of blog planet javascript
Peter Krempa [Thu, 29 Feb 2024 14:47:50 +0000 (15:47 +0100)]
docs: index: Fix import of blog planet javascript

Similarly to previous commit drop the 'type' attribute which is frowned
upon by the HTML standard.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
14 months agodocs: page: Fix declaration of main javascript source
Peter Krempa [Thu, 29 Feb 2024 12:32:59 +0000 (13:32 +0100)]
docs: page: Fix declaration of main javascript source

Per the w3 html validator a HTML/XML comment is not allowed inside the
<script> tag, use a space instead as it must be a pair tag.

Additionally drop the 'type' attribute as it's not needed (validator
warns about it).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
14 months agodocs: page: Add 'lang="en"' for all HTML output documents
Peter Krempa [Thu, 29 Feb 2024 12:06:31 +0000 (13:06 +0100)]
docs: page: Add 'lang="en"' for all HTML output documents

Per the w3 HTML validator the 'lang' attribute is suggested.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
14 months agodocs: site: Don't generate '<?xml' header for HTML documents
Peter Krempa [Thu, 29 Feb 2024 09:39:29 +0000 (10:39 +0100)]
docs: site: Don't generate '<?xml' header for HTML documents

Skip the XML header as it's invalid with <!DOCTYPE HTML> both for the
RST-generated pages and for the API docs generated from the API XML.

Additionally remove the spurious xsl:output directive from newapi.xsl
which is ignored and thus misleading.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
14 months agoPost-release version bump to 10.2.0
Jiri Denemark [Fri, 1 Mar 2024 11:22:04 +0000 (12:22 +0100)]
Post-release version bump to 10.2.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
14 months agoRelease of libvirt-10.1.0
Jiri Denemark [Fri, 1 Mar 2024 11:19:44 +0000 (12:19 +0100)]
Release of libvirt-10.1.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
14 months agoFix off-by-one error in udevListInterfacesByStatus
Martin Kletzander [Tue, 27 Feb 2024 15:20:12 +0000 (16:20 +0100)]
Fix off-by-one error in udevListInterfacesByStatus

Ever since this function was introduced in 2012 it could've tried
filling in an extra interface name.  That was made worse in 2019 when
the caller functions started accepting NULL arrays of size 0.

This is assigned CVE-2024-1441.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reported-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
Fixes: 5a33366f5c0b18c93d161bd144f9f079de4ac8ca
Fixes: d6064e2759a24e0802f363e3a810dc5a7d7ebb15
Reviewed-by: Ján Tomko <jtomko@redhat.com>
14 months agoNEWS: Update for release
Peter Krempa [Fri, 1 Mar 2024 08:44:30 +0000 (09:44 +0100)]
NEWS: Update for release

Mention improvement of virt-admin, and fixes for the VPD xml and disk
migration port bug.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
14 months agoTranslated using Weblate (Korean)
김인수 [Thu, 29 Feb 2024 14:36:08 +0000 (15:36 +0100)]
Translated using Weblate (Korean)

Currently translated at 100.0% (10440 of 10440 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>
14 months agoremote_protocol: Fix ACL on REMOTE_PROC_NODE_DEVICE_DEFINE_XML
Boris Fiuczynski [Wed, 28 Feb 2024 18:46:08 +0000 (19:46 +0100)]
remote_protocol: Fix ACL on REMOTE_PROC_NODE_DEVICE_DEFINE_XML

Adding 'save' ACL to REMOTE_PROC_NODE_DEVICE_DEFINE_XML to make
REMOTE_PROC_NODE_DEVICE_UPDATE ACLs meaningful.

Fixes: 69f9e7dbc24657e85761f03574779540d0f18315
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
14 months agoNEWS: Document my contributions for upcoming release
Michal Privoznik [Thu, 29 Feb 2024 08:30:30 +0000 (09:30 +0100)]
NEWS: Document my contributions for upcoming release

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
14 months agoTranslated using Weblate (Korean)
김인수 [Wed, 28 Feb 2024 13:58:50 +0000 (13:58 +0000)]
Translated using Weblate (Korean)

Currently translated at 99.4% (10386 of 10440 strings)

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

Signed-off-by: 김인수 <simmon@nplob.com>
14 months agoTranslated using Weblate (Ukrainian)
Yuri Chornoivan [Wed, 28 Feb 2024 13:55:39 +0000 (14:55 +0100)]
Translated using Weblate (Ukrainian)

Currently translated at 100.0% (10440 of 10440 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>
14 months agoTranslated using Weblate (Korean)
Weblate [Wed, 28 Feb 2024 13:55:39 +0000 (14:55 +0100)]
Translated using Weblate (Korean)

Currently translated at 99.4% (10385 of 10440 strings)

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

Co-authored-by: Weblate <noreply-mt-weblate@weblate.org>
Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
14 months agoTranslated using Weblate (Korean)
김인수 [Wed, 28 Feb 2024 13:55:38 +0000 (14:55 +0100)]
Translated using Weblate (Korean)

Currently translated at 99.4% (10385 of 10440 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>
14 months agospec: Handle new location of bash-completion .pc file
Cole Robinson [Mon, 19 Feb 2024 16:44:53 +0000 (11:44 -0500)]
spec: Handle new location of bash-completion .pc file

On Fedora 41, bash-completion's .pc file moved to
`bash-completion-devel`.

Using `pkgconfig()` lets us handle this without distro version checks

Signed-off-by: Cole Robinson <crobinso@redhat.com>
14 months agoci: regenerate
Michal Privoznik [Thu, 22 Feb 2024 16:10:59 +0000 (17:10 +0100)]
ci: regenerate

Regenerate the ci files using the latest libvirt-ci:

  commit face9746f9729699ae8525ffac4ee19be82c1ba5
  ci: drop update-alternatives for opensuse tumbleweed

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>