From: whitearchey <whitearchey@gmail.com>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: "qemu-trivial@nongnu.org" <qemu-trivial@nongnu.org>,
qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] qga: Fix shutdown command of guest agent to work with SysV
Date: Thu, 07 Nov 2013 11:45:25 +0900 [thread overview]
Message-ID: <op.w55q9zz9cb68cn@whitewind-arch> (raw)
In-Reply-To: <527A09E4.7090605@msgid.tls.msk.ru>
On Wed, 06 Nov 2013 18:20:36 +0900, Michael Tokarev <mjt@tls.msk.ru> wrote:
> 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
>
> While the patch is one-liner indeed, it is a bit more than trivial.
> Because it changes things in a non-obvious way, especially when
> multiple systems are concerned. Cc'ing qemu-devel@ due to this.
>
>> --- a/qga/commands-posix.c
>> +++ b/qga/commands-posix.c
>> - execle("/sbin/shutdown", "shutdown", shutdown_flag, "+0",
>> + execle("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0",
>
> Note that shutdown command is not in POSIX, despite the fact
> that this is put into commands-posix.c
>
> Note also that even shutdown from sysvinit on linux has another
> option, -P, which mean poweroff, while -h means "halt OR poweroff"
> (the latter is a bit unclear).
With upstart/systemd qga use one of thee commands, depending on 'mode' parameter:
shutdown -P +0 "..."
shutdown -H +0 "..."
shutdown -r +0 "..."
SysV equivalents for these are:
shutdown -h -P +0 "..."
shutdown -h -H +0 "..."
shutdown -h -r +0 "..."
and these retain their meaning with upstart/systemd.
>
> Does the same work on other *nixes? *BSD? Solaris?
>
No, it doesn't. But existing code also does not work.
According to FreeBSD manpages, shutdown does not accept -P and -H options. Commands should be:
shutdown -p +0 "..."
shutdown -h +0 "..."
shutdown -r +0 "..."
shutdown in Solaris does not accept any of -hHpPr and does not accept time in "+0" format
> Thanks,
>
> /mjt
next prev parent reply other threads:[~2013-11-07 2:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <op.w53t8fe2cb68cn@whitewind-arch>
2013-11-06 9:20 ` [Qemu-devel] [PATCH] qga: Fix shutdown command of guest agent to work with SysV Michael Tokarev
2013-11-07 2:45 ` whitearchey [this message]
2013-11-12 9:01 ` whitearchey
2013-11-13 12:02 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=op.w55q9zz9cb68cn@whitewind-arch \
--to=whitearchey@gmail.com \
--cc=mjt@tls.msk.ru \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).