From fc243a36bdeecbff2a920b27483d8ea39e98f80b Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 29 Sep 2025 11:18:21 +0100 Subject: [PATCH] lib/launch-direct.c: Remove unnecessary tests for ancient qemu features We can safely assume that qemu supports -nodefaults and -no-user-config, since these have been supported since forever. -no-hpet was deprecated in qemu 8.0 and the option removed in early 2024, replaced with -machine hpet=off. HPET defaults to 'on' in upstream qemu, and to 'off' in downstream RHEL rebuilds. Since (for libguestfs) we can assume an up to date Linux kernel is running inside the guest, and that the kernel will do the right thing with regards to timers, we don't need to mess with qemu defaults. In practice, Linux chooses kvm-clock. Thanks: Thomas Huth, Daniel Berrange --- lib/launch-direct.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/lib/launch-direct.c b/lib/launch-direct.c index 18eadf9d9..6b495dfa1 100644 --- a/lib/launch-direct.c +++ b/lib/launch-direct.c @@ -579,19 +579,11 @@ launch_direct (guestfs_h *g, void *datav, const char *arg) */ arg ("-global", VIRTIO_DEVICE_NAME ("virtio-blk") ".scsi=off"); - if (guestfs_int_qemu_supports (g, data->qemu_data, "-no-user-config")) - flag ("-no-user-config"); - - /* Newer versions of qemu (from around 2009/12) changed the - * behaviour of monitors so that an implicit '-monitor stdio' is - * assumed if we are in -nographic mode and there is no other - * -monitor option. Only a single stdio device is allowed, so - * this broke the '-serial stdio' option. There is a new flag - * called -nodefaults which gets rid of all this default crud, so - * let's use that to avoid this and any future surprises. + /* Disable qemu defaults and per-user configuration file so we get + * an unconfigured qemu. */ - if (guestfs_int_qemu_supports (g, data->qemu_data, "-nodefaults")) - flag ("-nodefaults"); + flag ("-no-user-config"); + flag ("-nodefaults"); /* This disables the host-side display (SDL, Gtk). */ arg ("-display", "none"); @@ -646,8 +638,6 @@ launch_direct (guestfs_h *g, void *datav, const char *arg) /* These are recommended settings, see RHBZ#1053847. */ arg ("-rtc", "driftfix=slew"); - if (guestfs_int_qemu_supports (g, data->qemu_data, "-no-hpet")) - flag ("-no-hpet"); #if defined(__i386__) || defined(__x86_64__) if (guestfs_int_version_ge (&data->qemu_version, 1, 3, 0)) arg ("-global", "kvm-pit.lost_tick_policy=discard");