lxd/boo1181549-0001-vm-qemu-configure-spice-using-spice-parameter.patch
Aleksa Sarai c34f4d7e50 Accepting request 887108 from home:cyphar:lxc
- Don't use SecureBoot OVMF blobs, they don't work with LXD.
- Add backport of <https://github.com/lxc/lxd/pull/8700> to fix LXD VMs on
  openSUSE. boo#1181549
  + boo1181549-0001-vm-qemu-configure-spice-using-spice-parameter.patch

OBS-URL: https://build.opensuse.org/request/show/887108
OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/lxd?expand=0&rev=86
2021-04-21 01:35:46 +00:00

77 lines
2.9 KiB
Diff

From f86eaf85c38cda988589e64b643670189d22923f Mon Sep 17 00:00:00 2001
From: Aleksa Sarai <cyphar@cyphar.com>
Date: Wed, 21 Apr 2021 10:11:21 +1000
Subject: [PATCH] vm/qemu: configure spice using -spice parameter
Since QEMU 5.2, if QEMU has its modules compiled as dynamic objects to
be dlopen(2)'d rather than statically compiled into the QEMU binary,
QEMU will not accept [spice] directives through -readconfig. This is a
known issue with QEMU but has been effectively marked as WONTFIX because
-readconfig has sort-of been soft-deprecated[1,2,3].
In the meantime, just switch to the -spice commandline since this
appears to only affect modules rather than core QEMU options.
[1]: https://bugs.launchpad.net/qemu/+bug/1910696
[2]: https://lists.gnu.org/archive/html/qemu-devel/2020-11/msg02934.html
[3]: https://bugzilla.suse.com/show_bug.cgi?id=1181549#c11
SUSE-Bugs: bsc#1181549
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
---
lxd/instance/drivers/driver_qemu.go | 6 +++++-
lxd/instance/drivers/driver_qemu_templates.go | 6 ------
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/lxd/instance/drivers/driver_qemu.go b/lxd/instance/drivers/driver_qemu.go
index 13211f1c651f..d14267bdbb87 100644
--- a/lxd/instance/drivers/driver_qemu.go
+++ b/lxd/instance/drivers/driver_qemu.go
@@ -1043,6 +1043,7 @@ func (d *qemu) Start(stateful bool) error {
"-no-user-config",
"-sandbox", "on,obsolete=deny,elevateprivileges=allow,spawn=deny,resourcecontrol=deny",
"-readconfig", confFile,
+ "-spice", d.spiceCmdlineConfig(),
"-pidfile", d.pidFilePath(),
"-D", d.LogFilePath(),
}
@@ -1572,6 +1573,10 @@ func (d *qemu) spicePath() string {
return filepath.Join(d.LogPath(), "qemu.spice")
}
+func (d *qemu) spiceCmdlineConfig() string {
+ return fmt.Sprintf("unix=on,disable-ticketing=on,addr=%s", d.spicePath())
+}
+
// generateConfigShare generates the config share directory that will be exported to the VM via
// a 9P share. Due to the unknown size of templates inside the images this directory is created
// inside the VM's config volume so that it can be restricted by quota.
@@ -2004,7 +2009,6 @@ func (d *qemu) generateQemuConfigFile(mountInfo *storagePools.MountInfo, busName
err := qemuBase.Execute(sb, map[string]interface{}{
"architecture": d.architectureName,
- "spicePath": d.spicePath(),
})
if err != nil {
return "", err
diff --git a/lxd/instance/drivers/driver_qemu_templates.go b/lxd/instance/drivers/driver_qemu_templates.go
index aa51f45c1426..3999c2bfbb9c 100644
--- a/lxd/instance/drivers/driver_qemu_templates.go
+++ b/lxd/instance/drivers/driver_qemu_templates.go
@@ -44,12 +44,6 @@ strict = "on"
# Console
[chardev "console"]
backend = "pty"
-
-# Graphical console
-[spice]
-unix = "on"
-addr = "{{.spicePath}}"
-disable-ticketing = "on"
`))
var qemuMemory = template.Must(template.New("qemuMemory").Parse(`
--
2.30.2