]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
13 months agoqemu: warn on pausing of guest due to watchdog or io error
Lennart Fricke [Thu, 21 Mar 2024 12:46:28 +0000 (13:46 +0100)]
qemu: warn on pausing of guest due to watchdog or io error

Change the log level for pauses of guests due to watchdog timeouts
or io errors from debug to warn to enhance the visibility of such
events.

Signed-off-by: Lennart Fricke <lennart.fricke@drehpunkt.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoAdd test script for loongarch
Xianglai Li [Thu, 21 Mar 2024 03:30:29 +0000 (11:30 +0800)]
Add test script for loongarch

Add domaincapstest qemuxml2argvtest qemuxml2xmltest
related test cases for loongarch.

Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
13 months agoImplement the method of getting host info for loongarch
Xianglai Li [Thu, 21 Mar 2024 03:30:28 +0000 (11:30 +0800)]
Implement the method of getting host info for loongarch

Implement method for loongarch to get host info, such as
cpu frequency, system info, etc.

Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
13 months agoSupport for loongarch64 in the QEMU driver
Xianglai Li [Thu, 21 Mar 2024 03:30:27 +0000 (11:30 +0800)]
Support for loongarch64 in the QEMU driver

Implement support for loongarch64 in the QEMU driver.

Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
13 months agoAdd loongarch cpu support
Xianglai Li [Thu, 21 Mar 2024 03:30:26 +0000 (11:30 +0800)]
Add loongarch cpu support

Add loongarch cpu support, Define new cpu type 'loongarch64'
and implement it's driver functions.

Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
13 months agoremote: check for negative array lengths before allocation
Daniel P. Berrangé [Fri, 15 Mar 2024 10:47:50 +0000 (10:47 +0000)]
remote: check for negative array lengths before allocation

While the C API entry points will validate non-negative lengths
for various parameters, the RPC server de-serialization code
will need to allocate memory for arrays before entering the C
API. These allocations will thus happen before the non-negative
length check is performed.

Passing a negative length to the g_new0 function will usually
result in a crash due to the negative length being treated as
a huge positive number.

This was found and diagnosed by ALT Linux Team with AFLplusplus.

CVE-2024-2494
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Found-by: Alexandr Shashkin <dutyrok@altlinux.org>
Co-developed-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
13 months agoqemu: Tweak augeas schema
Andrea Bolognani [Tue, 28 Nov 2023 15:09:43 +0000 (16:09 +0100)]
qemu: Tweak augeas schema

Current entries should always be listed before obsolete ones.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
13 months agosecurity: Drop virSecurity(DAC|SELinux)SetImageLabelRelative()
Andrea Bolognani [Tue, 21 Nov 2023 17:20:32 +0000 (18:20 +0100)]
security: Drop virSecurity(DAC|SELinux)SetImageLabelRelative()

The single caller for each function passes the same value
for @src and @parent, which means that we don't really need
the additional API.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
13 months agosecurity: Drop virSecurity(DAC|SELinux)RestoreImageLabelSingle()
Andrea Bolognani [Mon, 20 Nov 2023 18:17:02 +0000 (19:17 +0100)]
security: Drop virSecurity(DAC|SELinux)RestoreImageLabelSingle()

Each one only has a single, trivial caller.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
13 months agosecurity: Fix name for _virSecurityDACChardevCallbackData
Andrea Bolognani [Tue, 21 Nov 2023 16:36:56 +0000 (17:36 +0100)]
security: Fix name for _virSecurityDACChardevCallbackData

It was clearly copied over from the SELinux driver without
updating its name in the process.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
13 months agosecurity: Fix alignment
Andrea Bolognani [Tue, 21 Nov 2023 16:17:10 +0000 (17:17 +0100)]
security: Fix alignment

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
13 months agoNEWS: Mention save & restore support for ch driver
Purna Pavan Chandra Aekkaladevi [Mon, 11 Mar 2024 09:44:07 +0000 (09:44 +0000)]
NEWS: Mention save & restore support for ch driver

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agodocs: Update doc for virDomainSave and virDomainRestore
Purna Pavan Chandra Aekkaladevi [Mon, 11 Mar 2024 09:44:06 +0000 (09:44 +0000)]
docs: Update doc for virDomainSave and virDomainRestore

ch_driver expects path to be of a dir for save/restore. So, update
the documentation at global API as well.

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoch_driver: Add additional validation for save/restore
Purna Pavan Chandra Aekkaladevi [Mon, 11 Mar 2024 09:44:05 +0000 (09:44 +0000)]
ch_driver: Add additional validation for save/restore

Save & Restore are supported without any network and hostdev config
defined. So, add a validation for it before performing save.

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoch_driver: cleanup any stale managed save dir before VM creation
Purna Pavan Chandra Aekkaladevi [Mon, 11 Mar 2024 09:44:04 +0000 (09:44 +0000)]
ch_driver: cleanup any stale managed save dir before VM creation

There are chances that libvirt process is killed and it resulting in
stale managed save dirs. So check for it, and cleanup it there's any.

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoch_driver: Implement domain restore callbacks
Purna Pavan Chandra Aekkaladevi [Mon, 11 Mar 2024 09:44:03 +0000 (09:44 +0000)]
ch_driver: Implement domain restore callbacks

Following callbacks have been implemented
* domainRestore
* domainRestoreFlags
The path parameter to these callbacks has to be of the directory where
libvirt has performed save. Additionally, call restore in `domainCreate`
if the domain has managedsave.

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoch_driver: Refactor virCHProcessStart
Purna Pavan Chandra Aekkaladevi [Mon, 11 Mar 2024 09:44:02 +0000 (09:44 +0000)]
ch_driver: Refactor virCHProcessStart

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoch_driver: Implement more save callbacks
Purna Pavan Chandra Aekkaladevi [Mon, 11 Mar 2024 09:44:01 +0000 (09:44 +0000)]
ch_driver: Implement more save callbacks

Following callbacks have been implemented
* domainSaveImageGetXMLDesc
* domainManagedSaveRemove
* domainManagedSaveGetXMLDesc
* domainHasManagedSaveImage

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoch_driver: Add domainManagedSave callback
Purna Pavan Chandra Aekkaladevi [Mon, 11 Mar 2024 09:44:00 +0000 (09:44 +0000)]
ch_driver: Add domainManagedSave callback

Create libvirt managed saveDir and pass it to CH to save the VM

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoch_driver: Add domainSave, domainSaveFlags callbacks
Purna Pavan Chandra Aekkaladevi [Mon, 11 Mar 2024 09:43:59 +0000 (09:43 +0000)]
ch_driver: Add domainSave, domainSaveFlags callbacks

Implemented save callbacks. CH's vmm.snapshot API is called to save the
domain state. The path passed to these callbacks has to be of directory
as CH takes dir as input to snapshot and saves multiple files under it.

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoch_driver: Pass virCHDriverConfig to virCHMonitorNew
Purna Pavan Chandra Aekkaladevi [Mon, 11 Mar 2024 09:43:58 +0000 (09:43 +0000)]
ch_driver: Pass virCHDriverConfig to virCHMonitorNew

Pass virCHDriverConfig to VirCHMonitorNew instead of just stateDir so
that the cfg can be used for any additional purposes.

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoch_driver: Support Save, Restore VM actions from monitor
Purna Pavan Chandra Aekkaladevi [Mon, 11 Mar 2024 09:43:57 +0000 (09:43 +0000)]
ch_driver: Support Save, Restore VM actions from monitor

Implement folowing API calls from CH monitor
* vmm.snapshot -> to save a domain
* vmm.restore -> to restore saved domain

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoNEWS: Announce support for MTP filesystem driver type
Rayhan Faizel [Tue, 19 Mar 2024 19:43:22 +0000 (01:13 +0530)]
NEWS: Announce support for MTP filesystem driver type

Signed-off-by: Rayhan Faizel <rayhan.faizel@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agomeson: Check for sched_get_priority_min()
Andrea Bolognani [Tue, 27 Feb 2024 14:58:27 +0000 (15:58 +0100)]
meson: Check for sched_get_priority_min()

virProcessSetScheduler() uses not just sched_setscheduler() but
also sched_get_priority_{min,max}(). Currently we assume that
the former being available implies that the latter are as well,
but that's not the case for at least GNU/Hurd.

Make sure all functions are actually available before
attempting to use them.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agomeson: Restore check for sched_getaffinity()
Andrea Bolognani [Tue, 27 Feb 2024 14:52:15 +0000 (15:52 +0100)]
meson: Restore check for sched_getaffinity()

Commit c07cf0a68693 replaced this check with one for the
presence of cpu_set_t.

The idea at the time was that only sched_{get,set}affinity()
were visible by default, while making cpu_set_t visible required
defining _WITH_CPU_SET_T. So libvirt would detect the function
and attempt to use it, but the code would not compile because
the necessary data type had not been made accessible.

The commit in question brought three FreeBSD commits as evidence
of this. While [1] and [2] do indeed seem to support this
explanation, [3] from just a few days later made it so that not
just cpu_set_t, but also the functions, required user action to
be visible. This arguably would have made the change unnecessary.

However, [4] from roughly a month later changed things once
again: it completely removed _WITH_CPU_SET_T, making both the
functions and the data type visible by default.

This is the status quo that seems to have persisted until
today. If one were to check any recent FreeBSD build job
performed as part of our CI pipeline, for example [5] and [6]
for FreeBSD 13 and 14 respectively, they would be able to
confirm that in both cases cpu_set_t is detected as available.

Since there is no longer a difference between the availability
of the functions and that of the data type, go back to what we
had before.

This has the interesting side-effect of fixing a bug
introduced by the commit in question.

When detection was changed from the function to the data type,
most uses of WITH_SCHED_GETAFFINITY were replaced with uses of
WITH_DECL_CPU_SET_T, but not all of them: specifically, those
that decided whether qemuProcessInitCpuAffinity() would be
actually implemented or replaced with a no-op stub were not
updated, which means that we've been running the stub version
everywhere except on FreeBSD ever since.

The code has been copied to the Cloud Hypervisor driver in
the meantime, which is similarly affected. Now that we're
building the actual implementation, we need to add virnuma.h
to the includes.

As a nice bonus this also makes things work correctly on
GNU/Hurd, where cpu_set_t is available but
sched_{get,set}affinity() are non-working stubs.

[1] https://cgit.freebsd.org/src/commit/?id=160b4b922b6021848b6b48afc894d16b879b7af2
[2] https://cgit.freebsd.org/src/commit/?id=43736b71dd051212d5c55be9fa21c45993017fbb
[3] https://cgit.freebsd.org/src/commit/?id=90fa9705d5cd29cf11c5dc7319299788dec2546a
[4] https://cgit.freebsd.org/src/commit/?id=5e04571cf3cf4024be926976a6abf19626df30be
[5] https://gitlab.com/libvirt/libvirt/-/jobs/6266401204
[6] https://gitlab.com/libvirt/libvirt/-/jobs/6266401205

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoutil: Add debug print missing from BSD
Andrea Bolognani [Fri, 23 Feb 2024 00:41:15 +0000 (01:41 +0100)]
util: Add debug print missing from BSD

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
13 months agoutil: Prefer cpuset_{get,set}affinity() on BSD
Andrea Bolognani [Fri, 23 Feb 2024 00:37:22 +0000 (01:37 +0100)]
util: Prefer cpuset_{get,set}affinity() on BSD

FreeBSD 14 implements sched_{get,set}affinity() for
compatibility with Linux, but we should still use the native
syscalls instead.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
13 months agoutil: Accept TIDs for virProcess{Get,Set}Affinity() on BSD
Andrea Bolognani [Fri, 23 Feb 2024 00:29:28 +0000 (01:29 +0100)]
util: Accept TIDs for virProcess{Get,Set}Affinity() on BSD

Depending on the situation, the IDs that we pass to these
functions can be either referring to processes or threads.

Linux doesn't have separate interfaces for one or the other,
but FreeBSD does and we're explicitly telling it that the ID
refers to a process. When it refers to a thread instead, the
call will fail, and the VM will not be able to start.

Luckily, another possible choice is CPU_WHICH_TIDPID, which
makes things behave the same as Linux.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
13 months agoqemu_command: Generate command line for MTP filesystem
Rayhan Faizel [Tue, 19 Mar 2024 15:16:30 +0000 (16:16 +0100)]
qemu_command: Generate command line for MTP filesystem

The source tag sets the rootdir property of the device, which is
the directory exposed to the guest via the MTP device. The target
tag sets the desc property.  This device supports read-only mode
as well. Like virtiofs, it does not support additional access
modes.

Signed-off-by: Rayhan Faizel <rayhan.faizel@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoconf: Introduce support for usb-mtp devices
Rayhan Faizel [Tue, 19 Mar 2024 15:15:50 +0000 (16:15 +0100)]
conf: Introduce support for usb-mtp devices

Expose usb-mtp device as another type of <filesystem/>.

Signed-off-by: Rayhan Faizel <rayhan.faizel@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoqemu_capabilities: Add QEMU_CAPS_DEVICE_USB_MTP capability
Rayhan Faizel [Fri, 8 Mar 2024 20:16:45 +0000 (01:46 +0530)]
qemu_capabilities: Add QEMU_CAPS_DEVICE_USB_MTP capability

This capability reflects presence of -device usb-mtp.

Signed-off-by: Rayhan Faizel <rayhan.faizel@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agovirt-admin: Fix segfault when libvirtd dies
Adam Julis [Tue, 19 Mar 2024 11:02:51 +0000 (12:02 +0100)]
virt-admin: Fix segfault when libvirtd dies

vshAdmCatchDisconnect requires non-NULL structure vshControl for
getting connection name (stored at opaque), but
virAdmConnectRegisterCloseCallback at vshAdmConnect called it
with NULL.

Signed-off-by: Adam Julis <ajulis@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
13 months agonode_device_driver: use g_autofree instead of VIR_FREE()
Karim Taha [Sun, 17 Mar 2024 15:19:21 +0000 (17:19 +0200)]
node_device_driver: use g_autofree instead of VIR_FREE()

Signed-off-by: Karim Taha <kariem.taha2.7@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoopenvz_driver: use g_autofree instead of VIR_FREE()
Karim Taha [Sun, 17 Mar 2024 15:19:20 +0000 (17:19 +0200)]
openvz_driver: use g_autofree instead of VIR_FREE()

Signed-off-by: Karim Taha <kariem.taha2.7@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoqemu: virtiofs: error out if getting the group or user name fails
Ján Tomko [Thu, 7 Mar 2024 12:36:45 +0000 (13:36 +0100)]
qemu: virtiofs: error out if getting the group or user name fails

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoqemu: virtiofs: set correct label when creating the socket
Ján Tomko [Wed, 6 Mar 2024 16:26:40 +0000 (17:26 +0100)]
qemu: virtiofs: set correct label when creating the socket

Use svirt_t instead of virtd_t, since virtd_t is not available in the
session mode and qemu with svirt_t won't be able to talk to unconfined_t
socket.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoqemu: virtiofs: do not crash if cgroups are missing
Ján Tomko [Tue, 5 Mar 2024 13:55:26 +0000 (14:55 +0100)]
qemu: virtiofs: do not crash if cgroups are missing

On domain startup, qemuSetupCgroupForExtDevices checks
if a cgroup controller is present and skips the setup if not.

Add a similar check to qemuVirtioFSSetupCgroup to prevent
crashing when hotplugging a virtiofs filesystem.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agovirthreadpool: create threads from the newly expanded workers
Wei Gong [Mon, 18 Mar 2024 13:31:14 +0000 (21:31 +0800)]
virthreadpool: create threads from the newly expanded workers

when the thread pool is dynamically expanded, threads should
not be created from the existing workers; they should be created
from the newly expanded workers

Signed-off-by: Wei Gong <gongwei833x@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoopenvz_conf: Use g_autofree
Rayhan Faizel [Thu, 14 Mar 2024 20:22:49 +0000 (01:52 +0530)]
openvz_conf: Use g_autofree

Signed-off-by: Rayhan Faizel <rayhan.faizel@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoNEWS: Document the fix for migration or vmx enabled domains
Jiri Denemark [Tue, 12 Mar 2024 16:54:41 +0000 (17:54 +0100)]
NEWS: Document the fix for migration or vmx enabled domains

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
13 months agoAdd vmx-* features to Westmere*
Jiri Denemark [Thu, 7 Mar 2024 13:03:38 +0000 (14:03 +0100)]
Add vmx-* features to Westmere*

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
13 months agoAdd vmx-* features to Snowridge
Jiri Denemark [Thu, 7 Mar 2024 13:05:53 +0000 (14:05 +0100)]
Add vmx-* features to Snowridge

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
13 months agoAdd vmx-* features to Skylake*
Jiri Denemark [Thu, 7 Mar 2024 13:00:53 +0000 (14:00 +0100)]
Add vmx-* features to Skylake*

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
13 months agoAdd vmx-* features to SapphireRapids
Jiri Denemark [Thu, 7 Mar 2024 13:05:34 +0000 (14:05 +0100)]
Add vmx-* features to SapphireRapids

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
13 months agoAdd vmx-* features to SandyBridge*
Jiri Denemark [Thu, 7 Mar 2024 13:03:18 +0000 (14:03 +0100)]
Add vmx-* features to SandyBridge*

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
13 months agoAdd vmx-* features to Penryn
Jiri Denemark [Thu, 7 Mar 2024 13:05:20 +0000 (14:05 +0100)]
Add vmx-* features to Penryn

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
13 months agoAdd vmx-* features to Nehalem*
Jiri Denemark [Thu, 7 Mar 2024 13:04:21 +0000 (14:04 +0100)]
Add vmx-* features to Nehalem*

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
13 months agoAdd vmx-* features to kvm*
Jiri Denemark [Thu, 7 Mar 2024 13:06:37 +0000 (14:06 +0100)]
Add vmx-* features to kvm*

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
13 months agoAdd vmx-* features to IvyBridge*
Jiri Denemark [Thu, 7 Mar 2024 13:04:01 +0000 (14:04 +0100)]
Add vmx-* features to IvyBridge*

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
13 months agoAdd vmx-* features to Icelake*
Jiri Denemark [Thu, 7 Mar 2024 13:02:47 +0000 (14:02 +0100)]
Add vmx-* features to Icelake*

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
13 months agoAdd vmx-* features to Haswell*
Jiri Denemark [Thu, 7 Mar 2024 13:01:50 +0000 (14:01 +0100)]
Add vmx-* features to Haswell*

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
13 months agoAdd vmx-* features to core{,2}duo
Jiri Denemark [Thu, 7 Mar 2024 13:06:13 +0000 (14:06 +0100)]
Add vmx-* features to core{,2}duo

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
13 months agoAdd vmx-* features to Cooperlake
Jiri Denemark [Thu, 7 Mar 2024 13:05:01 +0000 (14:05 +0100)]
Add vmx-* features to Cooperlake

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
13 months agoAdd vmx-* features to Conroe
Jiri Denemark [Thu, 7 Mar 2024 13:04:45 +0000 (14:04 +0100)]
Add vmx-* features to Conroe

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
13 months agoAdd vmx-* features to Cascadelake*
Jiri Denemark [Thu, 7 Mar 2024 13:01:25 +0000 (14:01 +0100)]
Add vmx-* features to Cascadelake*

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
13 months agoAdd vmx-* features to Broadwell*
Jiri Denemark [Thu, 7 Mar 2024 13:00:15 +0000 (14:00 +0100)]
Add vmx-* features to Broadwell*

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
13 months agocpu_map: Do not ignore VMX features in sync_qemu_models script
Jiri Denemark [Thu, 7 Mar 2024 12:21:31 +0000 (13:21 +0100)]
cpu_map: Do not ignore VMX features in sync_qemu_models script

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>