mirror of
https://github.com/openwrt/packages.git
synced 2025-12-22 14:44:36 +04:00
qemu: add patch for qga guest-shutdown command
Corresponds to commit 33bbecea in master branch
Ref: https://github.com/openwrt/packages/issues/14244
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
From cbb0971d0d1bc32413095810e24f17eb7169810a Mon Sep 17 00:00:00 2001
|
From 8b0920febc7f831895e592a1328471696ed271c5 Mon Sep 17 00:00:00 2001
|
||||||
From: Yousong Zhou <yszhou4tech@gmail.com>
|
From: Yousong Zhou <yszhou4tech@gmail.com>
|
||||||
Date: Sat, 24 Feb 2018 13:43:19 +0800
|
Date: Sat, 24 Feb 2018 13:43:19 +0800
|
||||||
Subject: [PATCH 1/4] configure: allow disable fortify_source
|
Subject: [PATCH] configure: allow disable fortify_source
|
||||||
|
|
||||||
Tell build system of qemu to not add _FORTIFY_SOURCE options and let the
|
Tell build system of qemu to not add _FORTIFY_SOURCE options and let the
|
||||||
OpenWrt base build system decide flavor of fortify_source to use
|
OpenWrt base build system decide flavor of fortify_source to use
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
From 39b07d1742475f2c60ae2c80f3f2853bb556e0b1 Mon Sep 17 00:00:00 2001
|
From acd47f780447c0c3f528e1530ad76267abba5661 Mon Sep 17 00:00:00 2001
|
||||||
From: Yousong Zhou <yszhou4tech@gmail.com>
|
From: Yousong Zhou <yszhou4tech@gmail.com>
|
||||||
Date: Tue, 2 Apr 2019 06:31:31 +0000
|
Date: Tue, 2 Apr 2019 06:31:31 +0000
|
||||||
Subject: [PATCH 2/4] configure: allow enabling/disabling libudev from command
|
Subject: [PATCH] configure: allow enabling/disabling libudev from command line
|
||||||
line
|
|
||||||
|
|
||||||
---
|
---
|
||||||
configure | 4 ++++
|
configure | 4 ++++
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
From fb90eacb808c3b1719d6a5f2deefe88c82589bfb Mon Sep 17 00:00:00 2001
|
From be686d9ea58f8fba22428f4cd79e72590fad8b05 Mon Sep 17 00:00:00 2001
|
||||||
From: Yousong Zhou <yszhou4tech@gmail.com>
|
From: Yousong Zhou <yszhou4tech@gmail.com>
|
||||||
Date: Sat, 24 Feb 2018 13:45:25 +0800
|
Date: Sat, 24 Feb 2018 13:45:25 +0800
|
||||||
Subject: [PATCH 3/4] disas: fix compilation failure when isnan is a macro
|
Subject: [PATCH] disas: fix compilation failure when isnan is a macro
|
||||||
|
|
||||||
---
|
---
|
||||||
disas/libvixl/vixl/utils.h | 16 +++++++++++-----
|
disas/libvixl/vixl/utils.h | 16 +++++++++++-----
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
From 8cff6a5f07f66103809e6bf4a26c512d70ab2841 Mon Sep 17 00:00:00 2001
|
From bbf909a0b47efcfc999306e8304feaa26796f55c Mon Sep 17 00:00:00 2001
|
||||||
From: Yousong Zhou <yszhou4tech@gmail.com>
|
From: Yousong Zhou <yszhou4tech@gmail.com>
|
||||||
Date: Sat, 24 Feb 2018 13:46:31 +0800
|
Date: Sat, 24 Feb 2018 13:46:31 +0800
|
||||||
Subject: [PATCH 4/4] pc-bios: fix compilation when $(AS) is actually gcc
|
Subject: [PATCH] pc-bios: fix compilation when $(AS) is actually gcc driver
|
||||||
driver
|
|
||||||
|
|
||||||
---
|
---
|
||||||
pc-bios/optionrom/Makefile | 4 ++--
|
pc-bios/optionrom/Makefile | 4 ++--
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
From dd2c81be56d3191cc39a5f99fab59008abc42245 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Yousong Zhou <yszhou4tech@gmail.com>
|
||||||
|
Date: Thu, 17 Dec 2020 15:55:55 +0800
|
||||||
|
Subject: [PATCH] qga: invoke separate applets for guest-shutdown modes
|
||||||
|
|
||||||
|
/sbin/shutdown is not available on OpenWrt by default
|
||||||
|
|
||||||
|
Origin: "main/qemu: fix shutdown from guest agent"
|
||||||
|
https://gitlab.alpinelinux.org/alpine/aports/commit/76b81b486480fd9c3294cd420bcf2df01c27790d
|
||||||
|
---
|
||||||
|
qga/commands-posix.c | 5 +++++
|
||||||
|
1 file changed, 5 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
|
||||||
|
index 7ee6a33cce..22a22317a6 100644
|
||||||
|
--- a/qga/commands-posix.c
|
||||||
|
+++ b/qga/commands-posix.c
|
||||||
|
@@ -82,6 +82,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)
|
||||||
|
{
|
||||||
|
const char *shutdown_flag;
|
||||||
|
+ const char *fallback_cmd = NULL;
|
||||||
|
Error *local_err = NULL;
|
||||||
|
pid_t pid;
|
||||||
|
int status;
|
||||||
|
@@ -89,10 +90,13 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp)
|
||||||
|
slog("guest-shutdown called, mode: %s", mode);
|
||||||
|
if (!has_mode || strcmp(mode, "powerdown") == 0) {
|
||||||
|
shutdown_flag = "-P";
|
||||||
|
+ fallback_cmd = "/sbin/poweroff";
|
||||||
|
} else if (strcmp(mode, "halt") == 0) {
|
||||||
|
shutdown_flag = "-H";
|
||||||
|
+ fallback_cmd = "/sbin/halt";
|
||||||
|
} else if (strcmp(mode, "reboot") == 0) {
|
||||||
|
shutdown_flag = "-r";
|
||||||
|
+ fallback_cmd = "/sbin/reboot";
|
||||||
|
} else {
|
||||||
|
error_setg(errp,
|
||||||
|
"mode is invalid (valid values are: halt|powerdown|reboot");
|
||||||
|
@@ -109,6 +113,7 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp)
|
||||||
|
|
||||||
|
execle("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0",
|
||||||
|
"hypervisor initiated shutdown", (char*)NULL, environ);
|
||||||
|
+ execle(fallback_cmd, fallback_cmd, (char*)NULL, environ);
|
||||||
|
_exit(EXIT_FAILURE);
|
||||||
|
} else if (pid < 0) {
|
||||||
|
error_setg_errno(errp, errno, "failed to create child process");
|
||||||
Reference in New Issue
Block a user