[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [PATCH] qga: Fix shutdown command of guest agent to w
From: |
Michael Tokarev |
Subject: |
Re: [Qemu-trivial] [PATCH] qga: Fix shutdown command of guest agent to work with SysV |
Date: |
Wed, 13 Nov 2013 16:02:20 +0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130922 Icedove/17.0.9 |
06.11.2013 05:54, whitearchey wrote:
> For now guest agent uses following command to shutdown system:
> shutdown -P +0 "blabla"
> but this syntax works only with shutdown command from systemd or upstart,
> because SysV shutdown requires -h switch.
>
> Following patch changes the command so it works with systemd, upstart and SysV
>
> Signed-off-by: Michael Avdienko <address@hidden>
> ---
> qga/commands-posix.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> index f453132..10682f5 100644
> --- a/qga/commands-posix.c
> +++ b/qga/commands-posix.c
> @@ -99,7 +99,7 @@ void qmp_guest_shutdown(bool has_mode, const char *mode,
> Error **err)
> reopen_fd_to_null(1);
> reopen_fd_to_null(2);
>
> - execle("/sbin/shutdown", "shutdown", shutdown_flag, "+0",
> + execle("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0",
> "hypervisor initiated shutdown", (char*)NULL, environ);
> _exit(EXIT_FAILURE);
> } else if (pid < 0) {
Applied to the trivial-patches queue, with additional comments from your
next email explaining which commands/flags are used by which shutdown command.
I guess we'll need some #ifdef SOLARIS..#ifdef *BSD here later, but for
now it should be fine as-is, since apparently both variants (before and after
your change) are linux-only anyway.
Thanks,
/mjt