libguestfs/0004-lib-direct-Remove-use-...

83 lines
3.0 KiB
Diff

From 8a4761c0fb720078757ecaafd26be18293253f2c Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 8 Sep 2021 16:06:22 +0100
Subject: [PATCH] lib: direct: Remove use of sga
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
sga (or "sgabios" or "Serial Graphics Adapter") is an option ROM for
seabios which directs output to the serial adapter. This is very
useful for debugging BIOS problems during boot.
RHEL wants to deprecate this feature (in fact, they just deprecated it
without telling us). However there is an equivalent feature in
seabios (seabios >= 1.11 / qemu >= 2.11.0) which can be enabled using
either -nographic or -machine graphics=off
This commit removes sga and enables -machine graphics=off in the
direct backend.
References (for RHEL 9 qemu change):
https://bugzilla.redhat.com/show_bug.cgi?id=2002325
https://bugzilla.redhat.com/show_bug.cgi?id=2000845
https://lists.nongnu.org/archive/html/qemu-devel/2021-09/msg02417.html
https://listman.redhat.com/archives/libvir-list/2021-September/msg00205.html
For the libvirt backend we will continue to use <bios useserial=yes>.
This currently breaks when sga is not available, but I talked to Dan
and the plan there is to adapt libvirt so the same XML will enable
-machine graphics=off. IOW libguestfs does not need to make any
change.
References (for libvirt change):
https://bugzilla.redhat.com/show_bug.cgi?id=2003092
https://listman.redhat.com/archives/libvir-list/2021-September/msg00193.html
Thanks: Gerd Hoffman, Daniel Berrangé
(cherry picked from commit e14ff937422115e23094ca4cce80ec9fb01c10b3)
---
lib/launch-direct.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/lib/launch-direct.c b/lib/launch-direct.c
index 972e77e13..e5b9a5611 100644
--- a/lib/launch-direct.c
+++ b/lib/launch-direct.c
@@ -544,6 +544,13 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
append_list ("gic-version=host");
#endif
append_list_format ("accel=%s", accel_val);
+#if defined(__i386__) || defined(__x86_64__)
+ /* Tell seabios to send debug messages to the serial port.
+ * This used to be done by sgabios.
+ */
+ if (g->verbose)
+ append_list ("graphics=off");
+#endif
} end_list ();
cpu_model = guestfs_int_get_cpu_model (has_kvm && !force_tcg);
@@ -665,18 +672,6 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
} end_list ();
#endif
- if (g->verbose &&
- guestfs_int_qemu_supports_device (g, data->qemu_data,
- "Serial Graphics Adapter")) {
- /* Use sgabios instead of vgabios. This means we'll see BIOS
- * messages on the serial port, and also works around this bug
- * in qemu 1.1.0:
- * https://bugs.launchpad.net/qemu/+bug/1021649
- * QEmu has included sgabios upstream since just before 1.0.
- */
- arg ("-device", "sga");
- }
-
/* Set up virtio-serial for the communications channel. */
start_list ("-chardev") {
append_list ("socket");
--
2.31.1