summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/qemu-fix-agent-paths.patch
diff options
context:
space:
mode:
authorMaxim Cournoyer <[email protected]>2025-02-23 22:26:48 +0900
committerMaxim Cournoyer <[email protected]>2025-03-05 14:23:42 +0900
commit4a1ea5d0dae3f1c26e0eb67811b5f1f331541fbc (patch)
tree4cc6b3afcf7f8bc81227e345ed46fd9792d68d74 /gnu/packages/patches/qemu-fix-agent-paths.patch
parent84a351b3de4bd36e54b58da773bfb46d5b70c522 (diff)
gnu: qemu: Update to 9.1.3.
* gnu/packages/virtualization.scm (qemu): Update to 9.1.3. [source] <patches>: Add qemu-disable-migration-test.patch. [arguments] <phases>: Adjust install-user-static phase. [native-inputs]: Add python-tomli. (qemu-patch): Delete procedure. * gnu/packages/patches/qemu-disable-bios-tables-test.patch: Rebase. * gnu/packages/patches/qemu-fix-agent-paths.patch: Likewise. * gnu/packages/patches/qemu-disable-aarch64-migration-test.patch: Delete file. * gnu/packages/patches/qemu-disable-migration-test.patch: New file. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. Change-Id: I573070a297ffc9ca096c52e2fa18f839ad89a24e
Diffstat (limited to 'gnu/packages/patches/qemu-fix-agent-paths.patch')
-rw-r--r--gnu/packages/patches/qemu-fix-agent-paths.patch72
1 files changed, 35 insertions, 37 deletions
diff --git a/gnu/packages/patches/qemu-fix-agent-paths.patch b/gnu/packages/patches/qemu-fix-agent-paths.patch
index 0c29890206..91572fb664 100644
--- a/gnu/packages/patches/qemu-fix-agent-paths.patch
+++ b/gnu/packages/patches/qemu-fix-agent-paths.patch
@@ -4,19 +4,20 @@ after the patch from the Nix package:
https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/virtualization/qemu/fix-qemu-ga.patch
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
+index 6e3c15f539..eaef900b6e 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
-@@ -84,6 +84,7 @@ static void ga_wait_child(pid_t pid, int *status, Error **errp)
- void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp)
+@@ -216,6 +216,7 @@ out:
+ void qmp_guest_shutdown(const char *mode, Error **errp)
{
const char *shutdown_flag;
+ const char *command;
Error *local_err = NULL;
- pid_t pid;
- int status;
-@@ -101,10 +102,13 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp)
+
+ #ifdef CONFIG_SOLARIS
+@@ -235,16 +236,24 @@ void qmp_guest_shutdown(const char *mode, Error **errp)
slog("guest-shutdown called, mode: %s", mode);
- if (!has_mode || strcmp(mode, "powerdown") == 0) {
+ if (!mode || strcmp(mode, "powerdown") == 0) {
shutdown_flag = powerdown_flag;
+ command = "shutdown";
} else if (strcmp(mode, "halt") == 0) {
@@ -28,38 +29,35 @@ diff --git a/qga/commands-posix.c b/qga/commands-posix.c
} else {
error_setg(errp,
"mode is invalid (valid values are: halt|powerdown|reboot");
-@@ -123,6 +127,11 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp)
- execl("/sbin/shutdown", "shutdown", shutdown_flag, "-g0", "-y",
- "hypervisor initiated shutdown", (char *)NULL);
- #else
-+ /* try Guix’s shutdown/halt/reboot first */
-+ char *path = g_strdup_printf("/run/current-system/profile/sbin/%s", command);
-+ execl(path, command, (char *)NULL);
-+ g_free(path);
+ return;
+ }
+
++ /* Try Guix’s shutdown/halt/reboot first. */
++ char *path = g_strdup_printf("/run/current-system/profile/sbin/%s", command);
++ execl(path, command, (char *) NULL);
++ g_free(path);
+
- execl("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0",
- "hypervisor initiated shutdown", (char *)NULL);
- #endif
-@@ -159,10 +168,12 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp)
+ const char *argv[] = {"/sbin/shutdown",
+ #ifdef CONFIG_SOLARIS
+ shutdown_flag, "-g0", "-y",
+@@ -269,7 +278,7 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp)
+ int ret;
Error *local_err = NULL;
struct timeval tv;
- static const char hwclock_path[] = "/sbin/hwclock";
-+ static const char hwclock_path_guix[] = "/run/current-system/profile/sbin/hwclock";
- static int hwclock_available = -1;
-
- if (hwclock_available < 0) {
-- hwclock_available = (access(hwclock_path, X_OK) == 0);
-+ hwclock_available = (access(hwclock_path_guix, X_OK) == 0) ||
-+ (access(hwclock_path, X_OK) == 0);
- }
-
- if (!hwclock_available) {
-@@ -208,6 +219,8 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp)
+- const char *argv[] = {"/sbin/hwclock", has_time ? "-w" : "-s", NULL};
++ const char *argv[] = {"/run/current-system/profile/sbin/hwclock", has_time ? "-w" : "-s", NULL};
- /* Use '/sbin/hwclock -w' to set RTC from the system time,
- * or '/sbin/hwclock -s' to set the system time from RTC. */
-+ execl(hwclock_path_guix, "hwclock", has_time ? "-w" : "-s",
-+ NULL);
- execl(hwclock_path, "hwclock", has_time ? "-w" : "-s", NULL);
- _exit(EXIT_FAILURE);
- } else if (pid < 0) {
+ /* If user has passed a time, validate and set it. */
+ if (has_time) {
+@@ -302,6 +311,11 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp)
+ * hardware clock (RTC). */
+ ga_run_command(argv, NULL, "set hardware clock to system time",
+ &local_err);
++ if (local_err) {
++ argv[0] = "/sbin/hwclock";
++ ga_run_command(argv, NULL, "set hardware clock to system time",
++ &local_err);
++ }
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return;