What about patch? Will it be applied? Or should it be rewritten?
On Thu, 07 Nov 2013 11:45:25 +0900, whitearchey <whitearc...@gmail.com> wrote:
On Wed, 06 Nov 2013 18:20:36 +0900, Michael Tokarev <m...@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
--
Using Opera's revolutionary email client: http://www.opera.com/mail/