[libvirt PATCH v2 00/15] Support for VFIO variant drivers, Part 2
by Laine Stump
(Thisis "V2 of Part 2". "V1 of Part 2" is here:
https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/5G... )
Part 1 (which simply made it possible to use virsh nodedev-detach to
bind a device to a manually-specified variant driver, and at guest
runtime allowed libvirt to ignore the fact that the driver found to
the device was something other than exactly "vfio-pci") was here:
https://listman.redhat.com/archives/libvir-list/2023-August/241338.html
and pushed upstream as of commit v9.6.0-153-g24beaffec3
Part 2 adds two new pieces of functionality:
1) It is possible to manually specify a VFIO variant driver (or force
the generic vfio-pci driver) for a device in the domain XML with,
e.g.:
<driver name='mlx5_vfio_pci'/>
(for the former) or:
<driver name='vfio-pci'/>
(for the latter).
2) By default libvirt will now find the "best match" VFIO or VFIO
variant driver by comparing the device's modalias file contents (in
sysfs) with vfio drivers found in the running kernel's
modules.alias file. This means that "virsh nodedev-detach" of a
host device will bind it to its appropriate VFIO variant driver (if
one is available), and also if a <hostdev> decice in a domain
config has "managed='yes'", libvirt will bind it to a variant
driver if possible (in order to force binding to the basic vfio-pci
driver instead, you just need to add the <driver> element mentioned
above).
The first 12 patches are all just getting (1) going (a lot of it is
refactoring code to use common code for the four places that use the
hostdev <driver> element), and the final 3 patches implement (2).
More details are spread along the way.
Differences from V1:
I squashed together a couple of the patches, and fixed some things that caused
CI jobs to fail (I'd forgotten to push the branch to gitlab and
trigger CI).
Laine Stump (15):
util: properly deal with module vs. driver when binding device to
driver
schema: consolidate RNG for all hostdev <driver> elements
conf: move/rename hostdev PCI driver type enum to device_conf.h
conf: normalize hostdev <driver> parsing to simplify adding new attr
conf: put hostdev PCI backend into a struct
conf: use virDeviceHostdevPCIDriverInfo in network and networkport
objects
conf: split out hostdev <driver> parse/format to their own functions
conf: use new common parser/formatter for hostdev driver in network
XML
tests: remove explicit <driver name='vfio'/> from hostdev test cases
xen: explicitly set hostdev driver.type at runtime, not in postparse
conf: replace virHostdevIsVFIODevice with virHostdevIsPCIDevice
conf: support manually specifying VFIO variant driver in <hostdev> XML
util: new function virStringSkipToSpace()
tests: mock virPCIDevice(BindTo|UnbindFrom)Stub with nop functions
qemu: automatically bind to a vfio variant driver, if available
docs/formatdomain.rst | 55 ++-
src/conf/device_conf.c | 75 +++
src/conf/device_conf.h | 27 ++
src/conf/domain_capabilities.c | 2 +-
src/conf/domain_capabilities.h | 2 +-
src/conf/domain_conf.c | 98 +---
src/conf/domain_conf.h | 18 +-
src/conf/network_conf.c | 43 +-
src/conf/network_conf.h | 17 +-
src/conf/schemas/basictypes.rng | 20 +
src/conf/schemas/domaincommon.rng | 173 ++++---
src/conf/schemas/network.rng | 10 +-
src/conf/schemas/networkport.rng | 10 +-
src/conf/virconftypes.h | 2 +
src/conf/virnetworkportdef.c | 22 +-
src/conf/virnetworkportdef.h | 4 +-
src/hypervisor/virhostdev.c | 16 +-
src/hypervisor/virhostdev.h | 2 -
src/libvirt_private.syms | 10 +-
src/libxl/libxl_capabilities.c | 2 +-
src/libxl/libxl_domain.c | 65 ++-
src/libxl/libxl_driver.c | 25 +-
src/network/bridge_driver.c | 2 +-
src/qemu/qemu_capabilities.c | 4 +-
src/qemu/qemu_command.c | 14 +-
src/qemu/qemu_domain.c | 29 +-
src/qemu/qemu_hostdev.c | 2 +-
src/qemu/qemu_hotplug.c | 2 +-
src/qemu/qemu_validate.c | 6 +-
src/security/security_apparmor.c | 2 +-
src/security/security_dac.c | 4 +-
src/security/security_selinux.c | 4 +-
src/security/virt-aa-helper.c | 8 +-
src/util/virpci.c | 438 ++++++++++++++++--
src/util/virpci.h | 3 +
src/util/virstring.c | 17 +
src/util/virstring.h | 1 +
tests/domaincapstest.c | 4 +-
tests/libxlxml2domconfigdata/moredevs-hvm.xml | 1 -
tests/networkxml2xmlin/hostdev-pf-old.xml | 8 +
tests/networkxml2xmlin/hostdev-pf.xml | 2 +-
tests/networkxml2xmlout/hostdev-pf-old.xml | 8 +
tests/networkxml2xmlout/hostdev-pf.xml | 2 +-
tests/networkxml2xmltest.c | 6 +
tests/qemuhotplugmock.c | 15 +
.../qemuhotplug-hostdev-pci.xml | 1 -
.../qemuhotplug-base-live+hostdev-pci.xml | 2 +-
...uhotplug-pseries-base-live+hostdev-pci.xml | 2 +-
tests/qemustatusxml2xmldata/modern-in.xml | 2 +-
.../hostdev-pci-address-unassigned.xml | 4 -
.../hostdev-pci-multifunction.xml | 7 -
.../hostdev-vfio-multidomain.xml | 1 -
.../hostdev-vfio-zpci-autogenerate-fids.xml | 2 -
.../hostdev-vfio-zpci-autogenerate-uids.xml | 2 -
.../hostdev-vfio-zpci-autogenerate.xml | 1 -
.../hostdev-vfio-zpci-boundaries.xml | 2 -
.../hostdev-vfio-zpci-ccw-memballoon.xml | 1 -
.../hostdev-vfio-zpci-duplicate.xml | 2 -
...ostdev-vfio-zpci-invalid-uid-valid-fid.xml | 1 -
.../hostdev-vfio-zpci-multidomain-many.xml | 8 -
.../hostdev-vfio-zpci-set-zero.xml | 1 -
.../hostdev-vfio-zpci-uid-set-zero.xml | 1 -
.../hostdev-vfio-zpci-wrong-arch.xml | 1 -
tests/qemuxml2argvdata/hostdev-vfio-zpci.xml | 1 -
.../hostdev-vfio.x86_64-latest.args | 5 +-
tests/qemuxml2argvdata/hostdev-vfio.xml | 19 +-
.../net-hostdev-vfio-multidomain.xml | 1 -
tests/qemuxml2argvdata/net-hostdev-vfio.xml | 1 -
tests/qemuxml2argvdata/pseries-hostdevs-1.xml | 3 -
tests/qemuxml2argvdata/pseries-hostdevs-2.xml | 2 -
tests/qemuxml2argvdata/pseries-hostdevs-3.xml | 2 -
...v-pci-address-unassigned.x86_64-latest.xml | 4 -
...ostdev-pci-multifunction.x86_64-latest.xml | 7 -
...io-zpci-autogenerate-fids.s390x-latest.xml | 2 -
...io-zpci-autogenerate-uids.s390x-latest.xml | 2 -
...ev-vfio-zpci-autogenerate.s390x-latest.xml | 1 -
...tdev-vfio-zpci-boundaries.s390x-latest.xml | 2 -
...-vfio-zpci-ccw-memballoon.s390x-latest.xml | 1 -
...fio-zpci-multidomain-many.s390x-latest.xml | 8 -
.../hostdev-vfio-zpci.s390x-latest.xml | 1 -
.../hostdev-vfio.x86_64-latest.xml | 24 +-
.../net-hostdev-vfio.x86_64-latest.xml | 1 -
.../pseries-hostdevs-1.ppc64-latest.xml | 3 -
.../pseries-hostdevs-2.ppc64-latest.xml | 2 -
.../pseries-hostdevs-3.ppc64-latest.xml | 2 -
tests/virhostdevtest.c | 2 +-
.../plug-hostdev-pci-unmanaged.xml | 2 +-
.../plug-hostdev-pci.xml | 2 +-
tests/xlconfigdata/test-fullvirt-pci.xml | 2 -
tests/xmconfigdata/test-pci-dev-syntax.xml | 2 -
tests/xmconfigdata/test-pci-devs.xml | 2 -
tools/virsh-completer-nodedev.c | 4 +-
92 files changed, 933 insertions(+), 498 deletions(-)
create mode 100644 tests/networkxml2xmlin/hostdev-pf-old.xml
create mode 100644 tests/networkxml2xmlout/hostdev-pf-old.xml
--
2.41.0
10 months, 3 weeks
[libvirt PATCH 0/5] Initial network support in ch driver.
by Praveen K Paladugu
This series introduces network support for ch guests. ETHERNET network mode is
the only mode supported. More modes will be add once this series is merged.
For security reasons, cloud-hypervisor requries FDs for guests to be sent using
SCM_RIGHTS. This patch series introduces 2 methods that support sending FDs to
ch in Patch 3. Network support in ch driver is introduced by Patch 5.
I previously sent "hypervisor: Move interface mgmt methods to hypervisor" patch
by itself. I merged this patch also into Patch 2 in this series.
Praveen K Paladugu (5):
conf: Drop unused parameter
hypervisor: Move domain interface mgmt methods
util: Add util methods required by ch networking
ch: Introduce version based cap for network support
ch: Enable ETHERNET Network mode support
po/POTFILES | 3 +
src/ch/ch_capabilities.c | 9 +
src/ch/ch_capabilities.h | 1 +
src/ch/ch_conf.h | 4 +
src/ch/ch_domain.c | 41 +++
src/ch/ch_domain.h | 3 +
src/ch/ch_interface.c | 104 +++++++
src/ch/ch_interface.h | 35 +++
src/ch/ch_monitor.c | 205 +++++---------
src/ch/ch_monitor.h | 7 +-
src/ch/ch_process.c | 160 ++++++++++-
src/ch/meson.build | 2 +
src/conf/domain_conf.c | 1 -
src/conf/domain_conf.h | 3 +-
src/hypervisor/domain_interface.c | 457 ++++++++++++++++++++++++++++++
src/hypervisor/domain_interface.h | 45 +++
src/hypervisor/meson.build | 1 +
src/libvirt_private.syms | 11 +
src/libxl/libxl_domain.c | 2 +-
src/libxl/libxl_driver.c | 4 +-
src/lxc/lxc_driver.c | 2 +-
src/lxc/lxc_process.c | 4 +-
src/qemu/qemu_command.c | 6 +-
src/qemu/qemu_hotplug.c | 15 +-
src/qemu/qemu_interface.c | 339 +---------------------
src/qemu/qemu_interface.h | 11 -
src/qemu/qemu_process.c | 73 +----
src/util/virsocket.c | 109 +++++++
src/util/virsocket.h | 3 +
29 files changed, 1093 insertions(+), 567 deletions(-)
create mode 100644 src/ch/ch_interface.c
create mode 100644 src/ch/ch_interface.h
create mode 100644 src/hypervisor/domain_interface.c
create mode 100644 src/hypervisor/domain_interface.h
--
2.41.0
10 months, 3 weeks
[PATCH 00/19] qemu XML testing improvements, part 1 - forgotten test files and network driver
by Peter Krempa
This patch saga aims to improve and simplify testing of qemu XML
configs.
Part 1 deals with input test files which are not used in
qemuxml2argvtest, introduces a mock network driver and adds a checker
that all input files are in fact used.
Peter Krempa (19):
qemuxml2argvtest: Reinstate 'console-compat-chardev' and
'pci-serial-dev-chardev'
qemuxml2argvtest: Fix and use 'disk-network-ssh-key' case
qemuxml2argvtest: Reinstate 'pseries-vio-address-clash' case
qemuxml2argvdata: Move 'smbios-multiple-type2' case to
genericxml2xmltest
qemuxml2argvtest: Remove duplicated invocations of tests
qemuxml2argvtest: Check for duplicate invocation of tests
qemuxml2argvmock: Mock qemuInterfaceBridgeConnect
qemuxml2argvtest: Add test cases covered only by qemuxml2xmltest -
part 1
qemuxml2xmltest: Move 'graphics-listen-network2' case go
genericxml2xmltest
qemuxml2*test: Add specific test case for interface link state
qemuxml*test: Improve 'vhost_queues' test case
qemuxml2xmltest: Delete 'interface-driver' case
qemu: process: Separate setup of network device objects
qemuxml2argvmock: Mock virNetDevSetMTU
qemuxml2xmltest: Introduce fake network driver
qemuxml2argvtest: Enable 'graphics-listen-network' case
virnetworkportxml2xmltest: Add simple versions of bridge/network tests
qemuxml2argvtest: Add test cases covered only by qemuxml2xmltest -
part 2
qemuxml2argvtest: Add checker that all input files are used
src/qemu/qemu_interface.h | 2 +-
src/qemu/qemu_process.c | 45 ++--
src/util/virnetdev.h | 2 +-
.../graphics-listen-network2.xml | 0
.../smbios-multiple-type2.xml | 0
.../graphics-listen-network2.xml | 35 +++
tests/genericxml2xmltest.c | 3 +
tests/qemustatusxml2xmltest.c | 2 +-
...nu-disable-with-timeout.x86_64-latest.args | 36 +++
...hannel-unix-source-path.x86_64-latest.args | 45 ++++
.../chardev-label.x86_64-latest.args | 41 +++
.../console-compat2.x86_64-latest.args | 40 +++
.../cpu-empty.x86_64-latest.args | 33 +++
...cpu-host-model-features.x86_64-latest.args | 33 +++
.../cpu-numa-disordered.x86_64-latest.args | 38 +++
.../disk-active-commit.x86_64-latest.args | 38 +++
.../disk-mirror-old.x86_64-latest.args | 45 ++++
.../disk-mirror.x86_64-latest.args | 48 ++++
.../disk-network-ssh-key.x86_64-latest.args | 38 +++
.../qemuxml2argvdata/disk-network-ssh-key.xml | 2 +-
.../disk-network-vxhs.x86_64-5.0.0.args | 35 +++
.../downscript.x86_64-latest.args | 43 +++
...graphics-listen-network.x86_64-latest.args | 37 +++
.../graphics-listen-network.xml | 2 +-
.../hostdev-mdev-display.x86_64-latest.args | 34 +++
...ev-scsi-autogen-address.x86_64-latest.args | 60 +++++
...hostdev-scsi-large-unit.x86_64-latest.args | 39 +++
.../hostdev-scsi-shareable.x86_64-latest.args | 39 +++
tests/qemuxml2argvdata/interface-driver.xml | 54 ----
.../qemuxml2argvdata/lease.x86_64-latest.args | 39 +++
.../memorybacking-set.x86_64-latest.args | 33 +++
.../memorybacking-unset.x86_64-latest.args | 33 +++
.../metadata-duplicate.x86_64-latest.args | 36 +++
.../metadata.x86_64-latest.args | 36 +++
.../net-bandwidth.x86_64-latest.args | 47 ++++
tests/qemuxml2argvdata/net-bandwidth.xml | 2 +-
.../net-bandwidth2.x86_64-latest.args | 44 +++
tests/qemuxml2argvdata/net-bandwidth2.xml | 2 +-
.../net-coalesce.x86_64-latest.args | 48 ++++
tests/qemuxml2argvdata/net-coalesce.xml | 6 +-
.../net-isolated-port.x86_64-latest.args | 43 +++
tests/qemuxml2argvdata/net-isolated-port.xml | 2 +-
.../net-linkstate.x86_64-latest.args | 36 +++
tests/qemuxml2argvdata/net-linkstate.xml | 34 +++
.../net-midonet.x86_64-latest.args | 38 +++
.../net-mtu.x86_64-latest.args | 46 ++++
tests/qemuxml2argvdata/net-mtu.xml | 4 +-
.../net-openvswitch.x86_64-latest.args | 38 +++
tests/qemuxml2argvdata/net-openvswitch.xml | 2 +-
...irtio-network-portgroup.x86_64-latest.args | 42 +++
.../net-virtio-network-portgroup.xml | 6 +-
...-virtio-teaming-network.x86_64-latest.args | 39 +++
.../net-virtio-teaming-network.xml | 4 +-
.../net-virtio-vhost.x86_64-latest.args | 42 +++
...{vhost_queues.xml => net-virtio-vhost.xml} | 25 +-
...d-auto-vcpu-no-numatune.x86_64-latest.args | 36 +++
...static-vcpu-no-numatune.x86_64-latest.args | 36 +++
...vcpus-topology-mismatch.x86_64-latest.args | 34 +++
.../panic-pseries.ppc64-latest.args | 34 +++
.../pcihole64-gib.x86_64-latest.args | 34 +++
...pseries-vio-address-clash.ppc64-latest.err | 1 +
.../s390-defaultconsole.s390x-latest.args | 33 +++
.../s390-panic.s390x-latest.args | 35 +++
...eclabel-device-multiple.x86_64-latest.args | 36 +++
...el-dynamic-none-relabel.x86_64-latest.args | 37 +++
.../seclabel-dynamic-none.x86_64-latest.args | 36 +++
...serial-target-port-auto.x86_64-latest.args | 42 +++
.../tap-vhost-incorrect.x86_64-latest.args | 40 +++
.../qemuxml2argvdata/tap-vhost-incorrect.xml | 4 +-
.../tap-vhost.x86_64-latest.args | 44 +++
tests/qemuxml2argvdata/tap-vhost.xml | 2 +-
.../vhost-user-fs-sock.x86_64-latest.args | 34 +++
...ideo-virtio-gpu-ccw-auto.s390x-latest.args | 36 +++
tests/qemuxml2argvmock.c | 25 ++
tests/qemuxml2argvtest.c | 255 +++++++++++++++++-
.../graphics-listen-network.x86_64-latest.xml | 2 +-
.../interface-driver.x86_64-latest.xml | 67 -----
.../net-bandwidth.x86_64-latest.xml | 2 +-
.../net-bandwidth2.x86_64-latest.xml | 2 +-
.../net-coalesce.x86_64-latest.xml | 6 +-
.../net-isolated-port.x86_64-latest.xml | 2 +-
...st.xml => net-linkstate.x86_64-latest.xml} | 34 ++-
.../net-openvswitch.x86_64-latest.xml | 2 +-
...virtio-network-portgroup.x86_64-latest.xml | 6 +-
...t-virtio-teaming-network.x86_64-latest.xml | 4 +-
...xml => net-virtio-vhost.x86_64-latest.xml} | 29 +-
.../tap-vhost-incorrect.x86_64-latest.xml | 4 +-
.../tap-vhost.x86_64-latest.xml | 2 +-
tests/qemuxml2xmltest.c | 6 +-
tests/testutils.c | 14 +
tests/testutils.h | 2 +
tests/testutilsqemu.h | 3 +
.../plug-bridge-basic.xml | 11 +
.../plug-network-basic.xml | 10 +
tests/virnetworkportxml2xmltest.c | 2 +
95 files changed, 2407 insertions(+), 233 deletions(-)
rename tests/{qemuxml2argvdata => genericxml2xmlindata}/graphics-listen-network2.xml (100%)
rename tests/{qemuxml2argvdata => genericxml2xmlindata}/smbios-multiple-type2.xml (100%)
create mode 100644 tests/genericxml2xmloutdata/graphics-listen-network2.xml
create mode 100644 tests/qemuxml2argvdata/boot-menu-disable-with-timeout.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/channel-unix-source-path.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/chardev-label.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/console-compat2.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/cpu-empty.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/cpu-host-model-features.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/cpu-numa-disordered.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/disk-active-commit.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/disk-mirror-old.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/disk-mirror.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/disk-network-ssh-key.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/disk-network-vxhs.x86_64-5.0.0.args
create mode 100644 tests/qemuxml2argvdata/downscript.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/graphics-listen-network.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/hostdev-scsi-autogen-address.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/hostdev-scsi-large-unit.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/hostdev-scsi-shareable.x86_64-latest.args
delete mode 100644 tests/qemuxml2argvdata/interface-driver.xml
create mode 100644 tests/qemuxml2argvdata/lease.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/memorybacking-set.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/memorybacking-unset.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/metadata-duplicate.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/metadata.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/net-bandwidth.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/net-bandwidth2.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/net-coalesce.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/net-isolated-port.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/net-linkstate.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/net-linkstate.xml
create mode 100644 tests/qemuxml2argvdata/net-midonet.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/net-mtu.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/net-openvswitch.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/net-virtio-network-portgroup.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/net-virtio-teaming-network.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/net-virtio-vhost.x86_64-latest.args
rename tests/qemuxml2argvdata/{vhost_queues.xml => net-virtio-vhost.xml} (67%)
create mode 100644 tests/qemuxml2argvdata/numad-auto-vcpu-no-numatune.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/numad-static-vcpu-no-numatune.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/numavcpus-topology-mismatch.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/panic-pseries.ppc64-latest.args
create mode 100644 tests/qemuxml2argvdata/pcihole64-gib.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/pseries-vio-address-clash.ppc64-latest.err
create mode 100644 tests/qemuxml2argvdata/s390-defaultconsole.s390x-latest.args
create mode 100644 tests/qemuxml2argvdata/s390-panic.s390x-latest.args
create mode 100644 tests/qemuxml2argvdata/seclabel-device-multiple.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/seclabel-dynamic-none-relabel.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/seclabel-dynamic-none.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/serial-target-port-auto.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/tap-vhost-incorrect.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/tap-vhost.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/vhost-user-fs-sock.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/video-virtio-gpu-ccw-auto.s390x-latest.args
delete mode 100644 tests/qemuxml2xmloutdata/interface-driver.x86_64-latest.xml
rename tests/qemuxml2xmloutdata/{graphics-listen-network2.x86_64-latest.xml => net-linkstate.x86_64-latest.xml} (63%)
rename tests/qemuxml2xmloutdata/{vhost_queues.x86_64-latest.xml => net-virtio-vhost.x86_64-latest.xml} (78%)
create mode 100644 tests/virnetworkportxml2xmldata/plug-bridge-basic.xml
create mode 100644 tests/virnetworkportxml2xmldata/plug-network-basic.xml
--
2.43.0
10 months, 3 weeks
[PATCH 0/4] Introduce dynamicMemslots attribute for virtio-mem
by Michal Privoznik
I couldn't decide whether the new attribute should be in <target/> or
<memory/> element. I went with the former, but if anybody feels I should
have went with the latter then I can change it.
Michal Prívozník (4):
conf: Introduce dynamicMemslots attribute for virtio-mem
qemu_capabilities: Add
QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_DYNAMIC_MEMSLOTS capability
qemu_validate: Check capability for virtio-mem dynamicMemslots
qemu_command: Generate cmd line for virtio-mem dynamicMemslots
docs/formatdomain.rst | 6 ++++++
src/conf/domain_conf.c | 18 +++++++++++++++++-
src/conf/domain_conf.h | 1 +
src/conf/schemas/domaincommon.rng | 5 +++++
src/qemu/qemu_capabilities.c | 2 ++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 12 ++++++++++++
src/qemu/qemu_validate.c | 7 +++++++
.../qemucapabilitiesdata/caps_8.2.0_x86_64.xml | 1 +
...emory-hotplug-virtio-mem.x86_64-latest.args | 2 +-
.../memory-hotplug-virtio-mem.xml | 2 +-
11 files changed, 54 insertions(+), 3 deletions(-)
--
2.41.0
10 months, 3 weeks
[libvirt PATCH v3] qemu: add runtime config option for nbdkit
by Jonathon Jongsma
Currently when we build with nbdkit support, libvirt will always try to
use nbdkit to access remote disk sources when it is available. But
without an up-to-date selinux policy allowing this, it will fail.
because the required selinux policies are not yet widely available, we
have disabled nbdkit support on rpm builds for all distributions before
Fedora 40.
Unfortunately, this makes it more difficult to test nbdkit support.
After someone updates to the necessary selinux policies, they would also
need to rebuild libvirt to enable nbdkit support. By introducing a
configure option (nbdkit_config_default), we can build packages with
nbdkit support but have it disabled by default.
Signed-off-by: Jonathon Jongsma <jjongsma(a)redhat.com>
Suggested-by: Andrea Bolognani <abologna(a)redhat.com>
---
Sorry for the delay in getting out a new version. Thanksgiving break in
the USA, etc.
Changes in v3:
- nbdkit_config_default changed from a meson 'boolean' to a meson
'feature' configure option
- print error message for senseless configurations where nbdkit is
disabled but nbdkit_config_default is enabled
- added a comment to example config file about possibility of the
default value changing in the future
- don't include the storage_use_nbdkit in the config file if nbdkit
support is not compiled in. I used the same strategy that is used in
the remote driver where certain config options are disabled based on
whether WITH_IP is defined or not. When WITH_NBDKIT is not defined,
the value is not included in the config file and we don't attempt to
parse it from the config file either.
libvirt.spec.in | 18 +++++++--
meson.build | 10 +++++
meson_options.txt | 3 +-
...libvirtd_qemu.aug => libvirtd_qemu.aug.in} | 7 ++++
src/qemu/meson.build | 37 ++++++++++++++++++-
src/qemu/qemu.conf.in | 13 +++++++
src/qemu/qemu_conf.c | 19 ++++++++++
src/qemu/qemu_conf.h | 2 +
src/qemu/qemu_domain.c | 3 ++
tests/qemuxml2argvtest.c | 15 +++++---
10 files changed, 114 insertions(+), 13 deletions(-)
rename src/qemu/{libvirtd_qemu.aug => libvirtd_qemu.aug.in} (98%)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index f3fdedfde4..7aa497a565 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -96,6 +96,7 @@
%define with_sanlock 0
%define with_numad 0
%define with_nbdkit 0
+%define with_nbdkit_config_default 0
%define with_firewalld_zone 0
%define with_netcf 0
%define with_libssh2 0
@@ -174,15 +175,17 @@
%endif
%endif
-# We should only enable nbdkit support if the OS ships a SELinux policy that
-# allows libvirt to launch it. Right now that's not the case anywhere, but
-# things should be fine by the time Fedora 40 is released.
+# We want to build with nbdkit support, but should only enable nbdkit by
+# default if the OS ships a SELinux policy that allows libvirt to launch it.
+# Right now that's not the case anywhere, but things should be fine by the time
+# Fedora 40 is released.
#
# TODO: add RHEL 9 once a minor release that contains the necessary SELinux
# bits exists (we only support the most recent minor release)
%if %{with_qemu}
+ %define with_nbdkit 0%{!?_without_nbdkit:1}
%if 0%{?fedora} >= 40
- %define with_nbdkit 0%{!?_without_nbdkit:1}
+ %define with_nbdkit_config_default 0%{!?_without_nbdkit_config_default:1}
%endif
%endif
@@ -1214,6 +1217,12 @@ exit 1
%define arg_nbdkit -Dnbdkit=disabled
%endif
+%if %{with_nbdkit_config_default}
+ %define arg_nbdkit_config_default -Dnbdkit_config_default=enabled
+%else
+ %define arg_nbdkit_config_default -Dnbdkit_config_default=disabled
+%endif
+
%if %{with_fuse}
%define arg_fuse -Dfuse=enabled
%else
@@ -1329,6 +1338,7 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec)
%{?arg_sanlock} \
-Dlibpcap=enabled \
%{?arg_nbdkit} \
+ %{?arg_nbdkit_config_default} \
-Dlibnl=enabled \
-Daudit=enabled \
-Ddtrace=enabled \
diff --git a/meson.build b/meson.build
index 62481a008d..e63b807f21 100644
--- a/meson.build
+++ b/meson.build
@@ -1012,6 +1012,16 @@ if not conf.has('WITH_NBDKIT')
libnbd_dep = dependency('', required: false)
endif
+# default value for storage_use_nbdkit config option.
+# For now 'auto' just maps to disabled, but in the future it may depend on
+# which security drivers are enabled
+use_nbdkit_default = get_option('nbdkit_config_default').enabled()
+
+if use_nbdkit_default and not conf.has('WITH_NBDKIT')
+ error('nbdkit_config_default requires nbdkit to be enabled')
+endif
+conf.set10('USE_NBDKIT_DEFAULT', use_nbdkit_default)
+
libnl_version = '3.0'
if not get_option('libnl').disabled() and host_machine.system() == 'linux'
libnl_dep = dependency('libnl-3.0', version: '>=' + libnl_version, required: get_option('libnl'))
diff --git a/meson_options.txt b/meson_options.txt
index a0928102bf..05fd63dd41 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -104,7 +104,8 @@ option('loader_nvram', type: 'string', value: '', description: 'Pass list of pai
option('login_shell', type: 'feature', value: 'auto', description: 'build virt-login-shell')
option('nss', type: 'feature', value: 'auto', description: 'enable Name Service Switch plugin for resolving guest IP addresses')
option('numad', type: 'feature', value: 'auto', description: 'use numad to manage CPU placement dynamically')
-option('nbdkit', type: 'feature', value: 'auto', description: 'use nbdkit to access network disks')
+option('nbdkit', type: 'feature', value: 'auto', description: 'Build nbdkit storage backend')
+option('nbdkit_config_default', type: 'feature', value: 'disabled', description: 'Whether to use nbdkit storage backend for network disks by default (configurable)')
option('pm_utils', type: 'feature', value: 'auto', description: 'use pm-utils for power management')
option('sysctl_config', type: 'feature', value: 'auto', description: 'Whether to install sysctl configs')
option('tls_priority', type: 'string', value: 'NORMAL', description: 'set the default TLS session priority string')
diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug.in
similarity index 98%
rename from src/qemu/libvirtd_qemu.aug
rename to src/qemu/libvirtd_qemu.aug.in
index ed097ea3d9..bcc0aa8938 100644
--- a/src/qemu/libvirtd_qemu.aug
+++ b/src/qemu/libvirtd_qemu.aug.in
@@ -147,6 +147,10 @@ module Libvirtd_qemu =
let capability_filters_entry = str_array_entry "capability_filters"
+@CUT_WITH_NBDKIT@
+ let storage_entry = bool_entry "storage_use_nbdkit"
+
+@END@
(* Each entry in the config is one of the following ... *)
let entry = default_tls_entry
| vnc_entry
@@ -170,6 +174,9 @@ module Libvirtd_qemu =
| nbd_entry
| swtpm_entry
| capability_filters_entry
+@CUT_WITH_NBDKIT@
+ | storage_entry
+@END@
| obsolete_entry
let comment = [ label "#comment" . del /#[ \t]*/ "# " . store /([^ \t\n][^\n]*)?/ . del /\n/ "\n" ]
diff --git a/src/qemu/meson.build b/src/qemu/meson.build
index 2279fef2ca..43519e2834 100644
--- a/src/qemu/meson.build
+++ b/src/qemu/meson.build
@@ -137,9 +137,41 @@ if conf.has('WITH_QEMU')
qemu_user_group_conf = configuration_data({
'QEMU_USER': qemu_user,
'QEMU_GROUP': qemu_group,
+ 'USE_NBDKIT_DEFAULT': use_nbdkit_default.to_int(),
})
+
+ # preprocess config files to remove items related to features that are not
+ # compiled in
+ preprocess_config_files = [
+ {
+ 'inpath': 'qemu.conf.in',
+ 'outpath': 'qemu.conf.tmp',
+ 'outvar': 'qemu_conf_tmp',
+ },
+ {
+ 'inpath': 'libvirtd_qemu.aug.in',
+ 'outpath': 'libvirtd_qemu.aug',
+ 'outvar': 'libvirtd_qemu_aug',
+ }
+ ]
+ foreach item : preprocess_config_files
+ if conf.has('WITH_NBDKIT')
+ preprocess_cmd = [ 'sed', '-e', '/[@]CUT_WITH_NBDKIT[@]/d', '-e', '/[@]END[@]/d', '@INPUT@' ]
+ else
+ preprocess_cmd = [ 'sed', '-e', '/[@]CUT_WITH_NBDKIT[@]/,/[@]END[@]/d', '@INPUT@' ]
+ endif
+
+ tmp = configure_file(
+ input: item['inpath'],
+ output: item['outpath'],
+ command: preprocess_cmd,
+ capture: true,
+ )
+ set_variable(item['outvar'], tmp)
+ endforeach
+
qemu_conf = configure_file(
- input: 'qemu.conf.in',
+ input: qemu_conf_tmp,
output: 'qemu.conf',
configuration: qemu_user_group_conf,
)
@@ -147,6 +179,7 @@ if conf.has('WITH_QEMU')
qemu_user_group_hack_conf = configuration_data({
'QEMU_USER': qemu_user,
'QEMU_GROUP': qemu_group,
+ 'USE_NBDKIT_DEFAULT': use_nbdkit_default.to_int(),
# This hack is necessary because the output file is going to be
# used as input for another configure_file() call later, which
# will take care of substituting @CONFIG@ with useful data
@@ -159,7 +192,7 @@ if conf.has('WITH_QEMU')
)
virt_conf_files += qemu_conf
- virt_aug_files += files('libvirtd_qemu.aug')
+ virt_aug_files += libvirtd_qemu_aug
virt_test_aug_files += {
'name': 'test_libvirtd_qemu.aug',
'aug': test_libvirtd_qemu_aug_tmp,
diff --git a/src/qemu/qemu.conf.in b/src/qemu/qemu.conf.in
index 6897e0f760..76633c6a2f 100644
--- a/src/qemu/qemu.conf.in
+++ b/src/qemu/qemu.conf.in
@@ -974,3 +974,16 @@
# "full" - both QEMU and its helper processes are placed into separate
# scheduling group
#sched_core = "none"
+
+@CUT_WITH_NBDKIT@
+# Using nbdkit to access remote disk sources
+#
+# If this is set then libvirt will use nbdkit to access remote disk sources
+# when available. nbdkit will export an NBD share to QEMU rather than having
+# QEMU attempt to access the remote server directly.
+#
+# Possible values are 0 or 1. Default value is @USE_NBDKIT_DEFAULT@. Please
+# note that the default might change in future releases.
+#
+# storage_use_nbdkit = @USE_NBDKIT_DEFAULT@
+@END@
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 513b5ebb1e..e1a1bc3655 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -285,6 +285,7 @@ virQEMUDriverConfig *virQEMUDriverConfigNew(bool privileged,
return NULL;
cfg->deprecationBehavior = g_strdup("none");
+ cfg->storageUseNbdkit = USE_NBDKIT_DEFAULT;
return g_steal_pointer(&cfg);
}
@@ -1065,6 +1066,19 @@ virQEMUDriverConfigLoadCapsFiltersEntry(virQEMUDriverConfig *cfg,
}
+#if WITH_NBDKIT
+static int
+virQEMUDriverConfigLoadStorageEntry(virQEMUDriverConfig *cfg,
+ virConf *conf)
+{
+ if (virConfGetValueBool(conf, "storage_use_nbdkit", &cfg->storageUseNbdkit) < 0)
+ return -1;
+
+ return 0;
+}
+#endif /* WITH_NBDKIT */
+
+
int virQEMUDriverConfigLoadFile(virQEMUDriverConfig *cfg,
const char *filename,
bool privileged)
@@ -1136,6 +1150,11 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfig *cfg,
if (virQEMUDriverConfigLoadCapsFiltersEntry(cfg, conf) < 0)
return -1;
+#if WITH_NBDKIT
+ if (virQEMUDriverConfigLoadStorageEntry(cfg, conf) < 0)
+ return -1;
+#endif /* WITH_NBDKIT */
+
return 0;
}
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 1a3ba3a0fb..36049b4bfa 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -230,6 +230,8 @@ struct _virQEMUDriverConfig {
char *deprecationBehavior;
+ bool storageUseNbdkit;
+
virQEMUSchedCore schedCore;
};
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 953808fcfe..0891ddabe9 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -10296,6 +10296,9 @@ qemuDomainPrepareStorageSourceNbdkit(virStorageSource *src,
{
g_autoptr(qemuNbdkitCaps) nbdkit = NULL;
+ if (!cfg->storageUseNbdkit)
+ return false;
+
if (virStorageSourceGetActualType(src) != VIR_STORAGE_TYPE_NETWORK)
return false;
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index b2ea2191dc..74d20b9132 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1125,7 +1125,6 @@ mymain(void)
DO_TEST_CAPS_LATEST("disk-cdrom-empty-network-invalid");
DO_TEST_CAPS_LATEST("disk-cdrom-bus-other");
DO_TEST_CAPS_LATEST("disk-cdrom-network");
- DO_TEST_CAPS_LATEST_NBDKIT("disk-cdrom-network-nbdkit", QEMU_NBDKIT_CAPS_PLUGIN_CURL);
DO_TEST_CAPS_LATEST("disk-cdrom-tray");
DO_TEST_CAPS_LATEST("disk-floppy");
DO_TEST_CAPS_LATEST("disk-floppy-q35");
@@ -1171,8 +1170,6 @@ mymain(void)
DO_TEST_CAPS_VER("disk-network-sheepdog", "6.0.0");
DO_TEST_CAPS_LATEST("disk-network-source-auth");
DO_TEST_CAPS_LATEST("disk-network-source-curl");
- DO_TEST_CAPS_LATEST_NBDKIT("disk-network-source-curl-nbdkit", QEMU_NBDKIT_CAPS_PLUGIN_CURL);
- DO_TEST_CAPS_LATEST_NBDKIT("disk-network-source-curl-nbdkit-backing", QEMU_NBDKIT_CAPS_PLUGIN_CURL);
DO_TEST_CAPS_LATEST("disk-network-nfs");
driver.config->vxhsTLS = 1;
driver.config->nbdTLSx509secretUUID = g_strdup("6fd3f62d-9fe7-4a4e-a869-7acd6376d8ea");
@@ -1183,13 +1180,10 @@ mymain(void)
DO_TEST_CAPS_LATEST("disk-network-tlsx509-nbd-hostname");
DO_TEST_CAPS_VER("disk-network-tlsx509-vxhs", "5.0.0");
DO_TEST_CAPS_LATEST("disk-network-http");
- DO_TEST_CAPS_LATEST_NBDKIT("disk-network-http-nbdkit", QEMU_NBDKIT_CAPS_PLUGIN_CURL);
VIR_FREE(driver.config->nbdTLSx509secretUUID);
VIR_FREE(driver.config->vxhsTLSx509secretUUID);
driver.config->vxhsTLS = 0;
DO_TEST_CAPS_LATEST("disk-network-ssh");
- DO_TEST_CAPS_LATEST_NBDKIT("disk-network-ssh-nbdkit", QEMU_NBDKIT_CAPS_PLUGIN_SSH);
- DO_TEST_CAPS_LATEST_NBDKIT("disk-network-ssh-password", QEMU_NBDKIT_CAPS_PLUGIN_SSH);
DO_TEST_CAPS_LATEST("disk-no-boot");
DO_TEST_CAPS_LATEST("disk-nvme");
DO_TEST_CAPS_VER("disk-vhostuser-numa", "4.2.0");
@@ -1259,6 +1253,15 @@ mymain(void)
DO_TEST_CAPS_LATEST("disk-geometry");
DO_TEST_CAPS_LATEST("disk-blockio");
+ driver.config->storageUseNbdkit = 1;
+ DO_TEST_CAPS_LATEST_NBDKIT("disk-cdrom-network-nbdkit", QEMU_NBDKIT_CAPS_PLUGIN_CURL);
+ DO_TEST_CAPS_LATEST_NBDKIT("disk-network-source-curl-nbdkit", QEMU_NBDKIT_CAPS_PLUGIN_CURL);
+ DO_TEST_CAPS_LATEST_NBDKIT("disk-network-source-curl-nbdkit-backing", QEMU_NBDKIT_CAPS_PLUGIN_CURL);
+ DO_TEST_CAPS_LATEST_NBDKIT("disk-network-http-nbdkit", QEMU_NBDKIT_CAPS_PLUGIN_CURL);
+ DO_TEST_CAPS_LATEST_NBDKIT("disk-network-ssh-nbdkit", QEMU_NBDKIT_CAPS_PLUGIN_SSH);
+ DO_TEST_CAPS_LATEST_NBDKIT("disk-network-ssh-password", QEMU_NBDKIT_CAPS_PLUGIN_SSH);
+ driver.config->storageUseNbdkit = 0;
+
DO_TEST_CAPS_VER("disk-virtio-scsi-reservations", "5.2.0");
DO_TEST_CAPS_LATEST("disk-virtio-scsi-reservations");
--
2.41.0
10 months, 3 weeks
[libvirt PATCH 0/5] add loongarch support for libvirt
by xianglai li
From: lixianglai <lixianglai(a)loongson.cn>
Hello, Everyone:
This patch series adds libvirt support for loongarch.Although the bios
path and name has not been officially integrated into qemu and we think
there are still many shortcomings, we try to push a version of patch to
the community according to the opinions of the community, hoping to
listen to everyone's opinions. Anyway we have a version of libvirt that
supports loongarch.
You can also get libvirt's patch from the link below:
https://gitlab.com/lixianglai/libvirt
branch: loongarch
Since the patch associated with loongarch has not yet been submitted to
the virt-manager community, we are providing a temporary patch with
loongarch for the time being patch's virt-manager, the open source work
of virt-manager adding loongarch will be followed up later or
synchronized with the open source libvirt.
You can get the virt-manager code with loongarch patch from the link below:
https://github.com/loongson/virt-manager
branch: loongarch
loongarch's virtual machine bios is not yet available in qemu, so you can get it from the following link
https://github.com/loongson/Firmware/tree/main/LoongArchVirtMachine
(Note: You should clone the repository using git instead of downloading the file via wget or you'll get xml)
We named the bios edk2-loongarch64-code.fd, edk2-loongarch64-vars.fd is used to store pflash images of non-volatile
variables.After installing qemu-system-loongarch64, you need to manually copy these two files to the /user/share/qemu
directory.
Since there is no fedora operating system that supports the loongarch
architecture, you can find an iso that supports loongarch at the link
below for testing purposes:
https://github.com/fedora-remix-loongarch/releases-info
Well, if you have completed the above steps I think you can now install loongarch virtual machine,
you can install it through the virt-manager graphical interface, or install it through vrit-install,
here is an example of installing it using virt-install:
virt-install \
--virt-type=qemu \
--name loongarch-test \
--memory 4096 \
--vcpus=4 \
--arch=loongarch64 \
--boot cdrom \
--disk device=cdrom,bus=scsi,path=/root/livecd-fedora-mate-4.loongarch64.iso \
--disk path=/var/lib/libvirt/images/debian12-loongarch64.qcow2,size=10,format=qcow2,bus=scsi \
--network network=default \
--osinfo archlinux \
--feature acpi=true \
--video=virtio \
--graphics=vnc,listen=0.0.0.0
lixianglai (5):
Add loongarch cpu support
Add loongarch cpu model and vendor info
Config some capabilities for loongarch virt machine
Implement the method of getting host info for loongarch
Add bios path for loongarch
po/POTFILES | 1 +
src/conf/schemas/basictypes.rng | 1 +
src/cpu/cpu.c | 2 +
src/cpu/cpu.h | 2 +
src/cpu/cpu_loongarch.c | 742 +++++++++++++++++++++++++++++
src/cpu/cpu_loongarch.h | 25 +
src/cpu/cpu_loongarch_data.h | 37 ++
src/cpu/meson.build | 1 +
src/cpu_map/index.xml | 5 +
src/cpu_map/loongarch_la464.xml | 6 +
src/cpu_map/loongarch_vendors.xml | 3 +
src/cpu_map/meson.build | 2 +
src/qemu/qemu.conf.in | 3 +-
src/qemu/qemu_capabilities.c | 6 +
src/qemu/qemu_conf.c | 3 +-
src/qemu/qemu_domain.c | 32 ++
src/qemu/qemu_domain.h | 1 +
src/qemu/qemu_domain_address.c | 55 +++
src/qemu/qemu_validate.c | 2 +-
src/qemu/test_libvirtd_qemu.aug.in | 1 +
src/util/virarch.c | 4 +
src/util/virarch.h | 4 +
src/util/virhostcpu.c | 4 +-
src/util/virsysinfo.c | 5 +-
24 files changed, 940 insertions(+), 7 deletions(-)
create mode 100644 src/cpu/cpu_loongarch.c
create mode 100644 src/cpu/cpu_loongarch.h
create mode 100644 src/cpu/cpu_loongarch_data.h
create mode 100644 src/cpu_map/loongarch_la464.xml
create mode 100644 src/cpu_map/loongarch_vendors.xml
--
2.27.0
10 months, 3 weeks
[PATCH] Fix regression on default bus for keyboard/mouse from c4bc4d3b #577
by Jonathan Wright
Signed-off-by: Jonathan Wright <jonathan(a)almalinux.org>
---
src/conf/domain_postparse.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/conf/domain_postparse.c b/src/conf/domain_postparse.c
index e79913b73f..ee27023f3e 100644
--- a/src/conf/domain_postparse.c
+++ b/src/conf/domain_postparse.c
@@ -657,6 +657,7 @@ virDomainInputDefPostParse(virDomainInputDef *input,
if ((input->type == VIR_DOMAIN_INPUT_TYPE_MOUSE ||
input->type == VIR_DOMAIN_INPUT_TYPE_KBD) &&
(ARCH_IS_X86(def->os.arch) || def->os.arch == VIR_ARCH_NONE)) {
+ input->bus = VIR_DOMAIN_INPUT_BUS_PS2;
} else if (ARCH_IS_S390(def->os.arch) ||
input->type == VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH) {
input->bus = VIR_DOMAIN_INPUT_BUS_VIRTIO;
--
2.43.0
10 months, 3 weeks
[PATCH 00/10] qemu: Improve disk resizing on block devices and support resizing of disk with slice
by Peter Krempa
This series implements two features:
- automatic size discovery when resizing a raw disk on a block device
- resizing of raw disks when a 'storage slice' is in use
Peter Krempa (10):
qemu: block: Introduce helpers for properly testing for 'raw' and
'luks' images
qemu: Use qemuBlockStorageSourceIsQEMULuks/qemuBlockStorageSourceIsRaw
qemuDomainBlockResize: Agregate all checks at the beginning
vsh: Introduce simple version of VSH_ALTERNATIVE_OPTIONS_EXPR
virDomainBlockResize: Introduce VIR_DOMAIN_BLOCK_RESIZE_CAPACITY
qemuDomainBlockResize: Implement VIR_DOMAIN_BLOCK_RESIZE_CAPACITY
qemu: block: Make 'slice' layer effective for 'raw' storage source
qemu: block: Format storage slice properties optionally
virStorageSourceSliceFree: Export function
qemuDomainBlockResize: Properly resize disks with storage slice
docs/manpages/virsh.rst | 6 +-
include/libvirt/libvirt-domain.h | 1 +
src/conf/storage_source_conf.c | 2 +-
src/conf/storage_source_conf.h | 2 +
src/libvirt-domain.c | 5 +
src/libvirt_private.syms | 1 +
src/qemu/qemu_block.c | 193 +++++++++++++-----
src/qemu/qemu_block.h | 9 +
src/qemu/qemu_command.c | 2 +-
src/qemu/qemu_driver.c | 99 ++++++++-
.../disk-slices.x86_64-latest.args | 14 +-
tools/virsh-domain.c | 10 +-
tools/vsh.h | 4 +
13 files changed, 276 insertions(+), 72 deletions(-)
--
2.43.0
10 months, 3 weeks
[PATCH v2] qemu_driver: Don't handle the EOF event if vm get restarted
by tugy@chinatelecom.cn
From: Guoyi Tu <tugy(a)chinatelecom.cn>
Currently, libvirt creates a thread pool with only on thread to handle all
qemu monitor events for virtual machines, In the cases that if the thread
gets stuck while handling a monitor EOF event, such as unable to kill the
virtual machine process or release resources, the events of other virtual
machine will be also blocked, which will lead to the abnormal behavior of
other virtual machines.
For instance, when another virtual machine completes a shutdown operation
and the monitor EOF event has been queued but remains unprocessed, we
immediately destroy and start the virtual machine again, at a later time
when EOF event get processed, the processMonitorEOFEvent() will kill the
virtual machine that just started.
To address this issue, in the processMonitorEOFEvent(), we check whether
the current virtual machine's id is equal to the the one at the time
the event was generated. If they do not match, we immediately return.
Signed-off-by: Guoyi Tu <tugy(a)chinatelecom.cn>
Signed-off-by: dengpengcheng <dengpc12(a)chinatelecom.cn>
---
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_driver.c | 11 +++++++++--
src/qemu/qemu_process.c | 2 +-
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 953808fcfe..435ee621df 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11470,7 +11470,6 @@ qemuProcessEventFree(struct qemuProcessEvent *event)
case QEMU_PROCESS_EVENT_NETDEV_STREAM_DISCONNECTED:
case QEMU_PROCESS_EVENT_NIC_RX_FILTER_CHANGED:
case QEMU_PROCESS_EVENT_SERIAL_CHANGED:
- case QEMU_PROCESS_EVENT_MONITOR_EOF:
case QEMU_PROCESS_EVENT_GUEST_CRASHLOADED:
g_free(event->data);
break;
@@ -11484,6 +11483,7 @@ qemuProcessEventFree(struct qemuProcessEvent *event)
case QEMU_PROCESS_EVENT_UNATTENDED_MIGRATION:
case QEMU_PROCESS_EVENT_RESET:
case QEMU_PROCESS_EVENT_NBDKIT_EXITED:
+ case QEMU_PROCESS_EVENT_MONITOR_EOF:
case QEMU_PROCESS_EVENT_LAST:
break;
}
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 64afae6450..cfc5b79657 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3854,7 +3854,8 @@ processJobStatusChangeEvent(virDomainObj *vm,
static void
processMonitorEOFEvent(virQEMUDriver *driver,
- virDomainObj *vm)
+ virDomainObj *vm,
+ int domid)
{
qemuDomainObjPrivate *priv = vm->privateData;
int eventReason = VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN;
@@ -3863,6 +3864,12 @@ processMonitorEOFEvent(virQEMUDriver *driver,
unsigned int stopFlags = 0;
virObjectEvent *event = NULL;
+ if (vm->def->id != domid) {
+ VIR_ERROR("Domain %s was restarted, ignoring EOF",
+ vm->def->name);
+ return;
+ }
+
if (qemuProcessBeginStopJob(vm, VIR_JOB_DESTROY, true) < 0)
return;
@@ -4082,7 +4089,7 @@ static void qemuProcessEventHandler(void *data, void *opaque)
processJobStatusChangeEvent(vm, processEvent->data);
break;
case QEMU_PROCESS_EVENT_MONITOR_EOF:
- processMonitorEOFEvent(driver, vm);
+ processMonitorEOFEvent(driver, vm, GPOINTER_TO_INT(processEvent->data));
break;
case QEMU_PROCESS_EVENT_PR_DISCONNECT:
processPRDisconnectEvent(vm);
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index fc05b4b24f..696d526a5d 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -316,7 +316,7 @@ qemuProcessHandleMonitorEOF(qemuMonitor *mon,
}
qemuProcessEventSubmit(vm, QEMU_PROCESS_EVENT_MONITOR_EOF,
- 0, 0, NULL);
+ 0, 0, GINT_TO_POINTER(vm->def->id));
/* We don't want this EOF handler to be called over and over while the
* thread is waiting for a job.
--
2.17.1
10 months, 3 weeks
[PATCH] Fix regression on default bus for keyboard/mouse from c4bc4d3b #577
by Jonathan Wright
Signed-off-by: Jonathan Wright <jonathan(a)almalinux.org>
---
src/conf/domain_postparse.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/conf/domain_postparse.c b/src/conf/domain_postparse.c
index e79913b73f..ee27023f3e 100644
--- a/src/conf/domain_postparse.c
+++ b/src/conf/domain_postparse.c
@@ -657,6 +657,7 @@ virDomainInputDefPostParse(virDomainInputDef *input,
if ((input->type == VIR_DOMAIN_INPUT_TYPE_MOUSE ||
input->type == VIR_DOMAIN_INPUT_TYPE_KBD) &&
(ARCH_IS_X86(def->os.arch) || def->os.arch == VIR_ARCH_NONE)) {
+ input->bus = VIR_DOMAIN_INPUT_BUS_PS2;
} else if (ARCH_IS_S390(def->os.arch) ||
input->type == VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH) {
input->bus = VIR_DOMAIN_INPUT_BUS_VIRTIO;
--
2.43.0
10 months, 3 weeks