aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2018-12-20 16:19:10 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2018-12-20 16:21:11 +0000
commit76b81b486480fd9c3294cd420bcf2df01c27790d (patch)
tree7ee0aa8ff5ea11b74d0875bf2fcd05afe6f2c0ea
parent104300319061cc31b2c516f5c3154c885fc1a6a6 (diff)
downloadaports-76b81b486480fd9c3294cd420bcf2df01c27790d.tar.bz2
aports-76b81b486480fd9c3294cd420bcf2df01c27790d.tar.xz
main/qemu: fix shutdown from guest agent
we dont have /sbin/shutdown so provide a fallback to the busybox /sbin/poweroff, /sbin/halt and /sbin/reboot. fixes #9774
-rw-r--r--main/qemu/APKBUILD4
-rw-r--r--main/qemu/guest-agent-shutdown.patch34
2 files changed, 37 insertions, 1 deletions
diff --git a/main/qemu/APKBUILD b/main/qemu/APKBUILD
index e2ea8152ba..a77d1cb0ca 100644
--- a/main/qemu/APKBUILD
+++ b/main/qemu/APKBUILD
@@ -4,7 +4,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=qemu
pkgver=3.1.0
-pkgrel=0
+pkgrel=1
pkgdesc="QEMU is a generic machine emulator and virtualizer"
url="http://qemu.org/"
arch="all"
@@ -156,6 +156,7 @@ source="http://wiki.qemu-project.org/download/$pkgname-$pkgver.tar.xz
0001-linux-user-fix-build-with-musl-on-ppc64le.patch
fix-sockios-header.patch
test-crypto-ivgen-skip-essiv.patch
+ guest-agent-shutdown.patch
$pkgname-guest-agent.confd
$pkgname-guest-agent.initd
@@ -393,6 +394,7 @@ fd178f2913639a0c33199b3880cb17536961f2b3ff171c12b27f4be6bca032d6b88fd16302d09c69
d8933df9484158c2b4888254e62117d78f8ed7c18527b249419f39c2b2ab1afa148010884b40661f8965f1ef3105580fceffdfddbb2c9221dc1c62066722ba65 0001-linux-user-fix-build-with-musl-on-ppc64le.patch
39590476a4ebd7c1e79a4f0451b24c75b1817a2a83abaa1f71bb60b225d772152f0af8f3e51ff65645e378c536ffa6ff551dade52884d03a14b7c6a19c5c97d4 fix-sockios-header.patch
8b8db136f78bd26b5da171effa9e11016ec2bc3e2fc8107228b5543b47aa370978ed883794aa4f917f334e284a5b49e82070e1da2d31d49301195b6713a48eff test-crypto-ivgen-skip-essiv.patch
+b8e58bcc409f25cc6ff59967ed68f4de0a8656ec4db71ab663cc77761f8210b3f85c475fceb32dec934dc02a5c4f679a8313edbcf84e149692a81764c8904f67 guest-agent-shutdown.patch
d90c034cae3f9097466854ed1a9f32ab4b02089fcdf7320e8f4da13b2b1ff65067233f48809911485e4431d7ec1a22448b934121bc9522a2dc489009e87e2b1f qemu-guest-agent.confd
1cd24c2444c5935a763c501af2b0da31635aad9cf62e55416d6477fcec153cddbe7de205d99616def11b085e0dd366ba22463d2270f831d884edbc307c7864a6 qemu-guest-agent.initd
9b7a89b20fcf737832cb7b4d5dc7d8301dd88169cbe5339eda69fbb51c2e537d8cb9ec7cf37600899e734209e63410d50d0821bce97e401421db39c294d97be2 80-kvm.rules
diff --git a/main/qemu/guest-agent-shutdown.patch b/main/qemu/guest-agent-shutdown.patch
new file mode 100644
index 0000000000..742f281447
--- /dev/null
+++ b/main/qemu/guest-agent-shutdown.patch
@@ -0,0 +1,34 @@
+diff --git a/qga/commands-posix.c b/qga/commands-posix.c
+index 1877976..7915aab 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");