Accepting request 866169 from home:bfrogers:branches:Virtualization

- Fix issue of qemu crashing (abort called) when virtio-gpu device
  is asked for and the qemu-hw-display-virtio-gpu package isn't
  installed. (bsc#1181103)
  module-for-virtio-gpu-pre-load-module-to.patch
- Add additional inter-module package dependencies, to reflect the
  current module dependencies (see qemu source file: util/module.c)
- As of v3.1.0 virt-manager, new VM's are created by default with
  audio/sound enabled, so it's time to reflect the need, at least
  in the spice case, by having spice-audio available when spice in
  general is used (boo#1180210 boo#1181132)
- Further refine package Recommends/Suggests based on architecture
- Remove no longer needed dependency on pwdutils (boo#1181235)

OBS-URL: https://build.opensuse.org/request/show/866169
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=605
This commit is contained in:
Bruce Rogers 2021-01-22 23:57:51 +00:00 committed by Git OBS Bridge
parent 6129c78354
commit 0c8904995e
5 changed files with 156 additions and 46 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4a065a2b2ae6bd2f73711fe8a133686a78a6088851c3645dbac1a24fd8d08554
size 41616
oid sha256:40dac7b5525c97b434e58750c25d2a63773da19514cedf090e79121f91af8d00
size 42436

View File

@ -0,0 +1,70 @@
From: Bruce Rogers <brogers@suse.com>
Date: Thu, 21 Jan 2021 16:34:32 -0700
Subject: module: for virtio-gpu, pre-load module to avoid abort on missing
module
If the hw-display-virtio-gpu module is not loadable when the virtio-gpu
device is on the commandline or being added in monitor, qemu will call
abort. We can fail gracefully by doing the module load in a context
which is set up to handle errors properly. (bsc#1181103)
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
include/qemu/module.h | 1 +
qom/object.c | 12 ++++++++++++
softmmu/qdev-monitor.c | 8 ++++++++
3 files changed, 21 insertions(+)
diff --git a/include/qemu/module.h b/include/qemu/module.h
index 944d403cbd1535cc121af76a94f2..4b42dd285eeac1ba12e5c9e18ac0 100644
--- a/include/qemu/module.h
+++ b/include/qemu/module.h
@@ -72,5 +72,6 @@ void module_call_init(module_init_type type);
bool module_load_one(const char *prefix, const char *lib_name, bool mayfail);
void module_load_qom_one(const char *type);
void module_load_qom_all(void);
+int module_load_check(const char *name);
#endif
diff --git a/qom/object.c b/qom/object.c
index 10653552334549241cd5672d7a02..6f301fec34d103b0b07bc41d107c 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -516,6 +516,18 @@ static void object_initialize_with_type(Object *obj, size_t size, TypeImpl *type
object_post_init_with_type(obj, type);
}
+#ifdef CONFIG_MODULES
+int module_load_check(const char *name)
+{
+ TypeImpl *type = type_get_by_name(name);
+ if (!type) {
+ module_load_qom_one(name);
+ type = type_get_by_name(name);
+ }
+ return type == NULL;
+}
+#endif
+
void object_initialize(void *data, size_t size, const char *typename)
{
TypeImpl *type = type_get_by_name(typename);
diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c
index bf79d0bbcd986320eb609f37253e..7f6ad469638ba55a5bb8bfd02fe3 100644
--- a/softmmu/qdev-monitor.c
+++ b/softmmu/qdev-monitor.c
@@ -650,6 +650,14 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp)
return NULL;
}
+#ifdef CONFIG_MODULES
+ if (!strcmp(driver, "virtio-gpu-pci") || !strcmp(driver, "virtio-gpu-ccw")) {
+ if (module_load_check("virtio-gpu-device")) {
+ error_setg(errp, "loadable module for %s not available!", driver);
+ return NULL;
+ }
+ }
+#endif
/* create device */
dev = qdev_new(driver);

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Fri Jan 22 17:24:07 UTC 2021 - Bruce Rogers <brogers@suse.com>
- Fix issue of qemu crashing (abort called) when virtio-gpu device
is asked for and the qemu-hw-display-virtio-gpu package isn't
installed. (bsc#1181103)
module-for-virtio-gpu-pre-load-module-to.patch
- Add additional inter-module package dependencies, to reflect the
current module dependencies (see qemu source file: util/module.c)
- As of v3.1.0 virt-manager, new VM's are created by default with
audio/sound enabled, so it's time to reflect the need, at least
in the spice case, by having spice-audio available when spice in
general is used (boo#1180210 boo#1181132)
- Further refine package Recommends/Suggests based on architecture
- Remove no longer needed dependency on pwdutils (boo#1181235)
-------------------------------------------------------------------
Mon Jan 18 22:54:11 UTC 2021 - Bruce Rogers <brogers@suse.com>

View File

@ -181,6 +181,7 @@ Patch00046: Makefile-Don-t-check-pc-bios-as-pre-requ.patch
Patch00047: roms-Makefile-add-cross-file-to-qboot-me.patch
Patch00048: usb-Help-compiler-out-to-avoid-a-warning.patch
Patch00049: iotests-Fix-_send_qemu_cmd-with-bash-5.1.patch
Patch00050: module-for-virtio-gpu-pre-load-module-to.patch
# Patches applied in roms/seabios/:
Patch01000: seabios-use-python2-explicitly-as-needed.patch
Patch01001: seabios-switch-to-python3-as-needed.patch
@ -313,7 +314,6 @@ BuildRequires: pkgconfig(xkbcommon)
BuildRequires: nasm
%endif
BuildRequires: pkgconfig
BuildRequires: pwdutils
BuildRequires: python3-Sphinx
BuildRequires: rdma-core-devel
BuildRequires: snappy-devel
@ -350,21 +350,24 @@ Requires(post): procps
Recommends: kvm_stat
%endif
Recommends: qemu-block-curl
Recommends: qemu-chardev-spice
Recommends: qemu-hw-display-qxl
Recommends: qemu-hw-display-virtio-gpu
Recommends: qemu-hw-display-virtio-gpu-pci
Recommends: qemu-hw-display-virtio-vga
Recommends: qemu-hw-usb-redirect
Recommends: qemu-hw-usb-smartcard
Recommends: qemu-ksm = %{qemuver}
Recommends: qemu-tools
Recommends: qemu-ui-opengl
Recommends: qemu-ui-curses
%ifnarch s390x
Recommends: qemu-hw-display-qxl
Recommends: qemu-hw-display-virtio-vga
Recommends: qemu-hw-usb-redirect
Recommends: qemu-ui-gtk
Recommends: qemu-ui-spice-core
Recommends: qemu-ui-spice-app
%endif
%ifarch %{ix86} x86_64
Recommends: qemu-hw-display-virtio-gpu
Recommends: qemu-hw-display-virtio-gpu-pci
Recommends: qemu-x86
%else
Suggests: qemu-x86
%endif
%ifarch ppc ppc64 ppc64le
Recommends: qemu-ppc
%else
@ -562,6 +565,7 @@ Group: System/Emulators/PC
Version: %{qemuver}
Release: 0
Provides: %name:%_datadir/%name/forsplits/05
Requires: qemu-ui-spice-core
%{qemu_module_conflicts}
%description audio-spice
@ -661,6 +665,7 @@ Group: System/Emulators/PC
Version: %{qemuver}
Release: 0
Provides: %name:%_datadir/%name/forsplits/08
Requires: qemu-ui-spice-core
%{qemu_module_conflicts}
%description chardev-spice
@ -672,6 +677,7 @@ Group: System/Emulators/PC
Version: %{qemuver}
Release: 0
Provides: %name:%_datadir/%name/forsplits/01
Requires: qemu-ui-spice-core
%{qemu_module_conflicts}
%description hw-display-qxl
@ -747,6 +753,7 @@ Summary: GTK based UI support for QEMU
Group: System/Emulators/PC
Version: %{qemuver}
Release: 0
Requires: qemu-ui-opengl
%{qemu_module_conflicts}
%description ui-gtk
@ -763,27 +770,32 @@ Provides: %name:%_datadir/%name/forsplits/10
%description ui-opengl
This package contains a module for doing OpenGL based UI for QEMU.
%package ui-spice-app
Summary: Spice UI support for QEMU
Group: System/Emulators/PC
Version: %{qemuver}
Release: 0
Requires: qemu-chardev-spice
Requires: qemu-ui-spice-core
%{qemu_module_conflicts}
%description ui-spice-app
This package contains a module for doing Spice based UI for QEMU.
%package ui-spice-core
Summary: Core Spice support for QEMU
Group: System/Emulators/PC
Version: %{qemuver}
Release: 0
Provides: %name:%_datadir/%name/forsplits/09
Requires: qemu-ui-opengl
# This next Requires is only since virt-manager expects audio support
Requires: qemu-audio-spice
%{qemu_module_conflicts}
%description ui-spice-core
This package contains a module with core Spice support for QEMU.
%package ui-spice-app
Summary: Spice UI support for QEMU
Group: System/Emulators/PC
Version: %{qemuver}
Release: 0
%{qemu_module_conflicts}
%description ui-spice-app
This package contains a module for doing Spice based UI for QEMU.
%package vhost-user-gpu
Summary: Vhost user mode virtio-gpu 2D/3D rendering backend for QEMU
Group: System/Emulators/PC
@ -1039,6 +1051,7 @@ This package records qemu testsuite results and represents successful testing.
%patch00048 -p1
%endif
%patch00049 -p1
%patch00050 -p1
%patch01000 -p1
%patch01001 -p1
%patch01002 -p1

View File

@ -245,7 +245,6 @@ BuildRequires: pkgconfig(xkbcommon)
BuildRequires: nasm
%endif
BuildRequires: pkgconfig
BuildRequires: pwdutils
BuildRequires: python3-Sphinx
BuildRequires: rdma-core-devel
BuildRequires: snappy-devel
@ -282,21 +281,24 @@ Requires(post): procps
Recommends: kvm_stat
%endif
Recommends: qemu-block-curl
Recommends: qemu-chardev-spice
Recommends: qemu-hw-display-qxl
Recommends: qemu-hw-display-virtio-gpu
Recommends: qemu-hw-display-virtio-gpu-pci
Recommends: qemu-hw-display-virtio-vga
Recommends: qemu-hw-usb-redirect
Recommends: qemu-hw-usb-smartcard
Recommends: qemu-ksm = %{qemuver}
Recommends: qemu-tools
Recommends: qemu-ui-opengl
Recommends: qemu-ui-curses
%ifnarch s390x
Recommends: qemu-hw-display-qxl
Recommends: qemu-hw-display-virtio-vga
Recommends: qemu-hw-usb-redirect
Recommends: qemu-ui-gtk
Recommends: qemu-ui-spice-core
Recommends: qemu-ui-spice-app
%endif
%ifarch %{ix86} x86_64
Recommends: qemu-hw-display-virtio-gpu
Recommends: qemu-hw-display-virtio-gpu-pci
Recommends: qemu-x86
%else
Suggests: qemu-x86
%endif
%ifarch ppc ppc64 ppc64le
Recommends: qemu-ppc
%else
@ -494,6 +496,7 @@ Group: System/Emulators/PC
Version: %{qemuver}
Release: 0
Provides: %name:%_datadir/%name/forsplits/05
Requires: qemu-ui-spice-core
%{qemu_module_conflicts}
%description audio-spice
@ -593,6 +596,7 @@ Group: System/Emulators/PC
Version: %{qemuver}
Release: 0
Provides: %name:%_datadir/%name/forsplits/08
Requires: qemu-ui-spice-core
%{qemu_module_conflicts}
%description chardev-spice
@ -604,6 +608,7 @@ Group: System/Emulators/PC
Version: %{qemuver}
Release: 0
Provides: %name:%_datadir/%name/forsplits/01
Requires: qemu-ui-spice-core
%{qemu_module_conflicts}
%description hw-display-qxl
@ -679,6 +684,7 @@ Summary: GTK based UI support for QEMU
Group: System/Emulators/PC
Version: %{qemuver}
Release: 0
Requires: qemu-ui-opengl
%{qemu_module_conflicts}
%description ui-gtk
@ -695,27 +701,32 @@ Provides: %name:%_datadir/%name/forsplits/10
%description ui-opengl
This package contains a module for doing OpenGL based UI for QEMU.
%package ui-spice-app
Summary: Spice UI support for QEMU
Group: System/Emulators/PC
Version: %{qemuver}
Release: 0
Requires: qemu-chardev-spice
Requires: qemu-ui-spice-core
%{qemu_module_conflicts}
%description ui-spice-app
This package contains a module for doing Spice based UI for QEMU.
%package ui-spice-core
Summary: Core Spice support for QEMU
Group: System/Emulators/PC
Version: %{qemuver}
Release: 0
Provides: %name:%_datadir/%name/forsplits/09
Requires: qemu-ui-opengl
# This next Requires is only since virt-manager expects audio support
Requires: qemu-audio-spice
%{qemu_module_conflicts}
%description ui-spice-core
This package contains a module with core Spice support for QEMU.
%package ui-spice-app
Summary: Spice UI support for QEMU
Group: System/Emulators/PC
Version: %{qemuver}
Release: 0
%{qemu_module_conflicts}
%description ui-spice-app
This package contains a module for doing Spice based UI for QEMU.
%package vhost-user-gpu
Summary: Vhost user mode virtio-gpu 2D/3D rendering backend for QEMU
Group: System/Emulators/PC