All of lore.kernel.org
 help / color / mirror / Atom feed
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-trivial] [PATCH] qga: Fix shutdown command of guest agent to work with SysV
Date: Tue, 12 Nov 2013 18:01:02 +0900	[thread overview]
Message-ID: <op.w6fhz019cb68cn@whitewind-arch> (raw)
In-Reply-To: <op.w55q9zz9cb68cn@whitewind-arch>

What about patch? Will it be applied? Or should it be rewritten?

On Thu, 07 Nov 2013 11:45:25 +0900, whitearchey <whitearchey@gmail.com> wrote:

> 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


-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/


WARNING: multiple messages have this Message-ID (diff)
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: Tue, 12 Nov 2013 18:01:02 +0900	[thread overview]
Message-ID: <op.w6fhz019cb68cn@whitewind-arch> (raw)
In-Reply-To: <op.w55q9zz9cb68cn@whitewind-arch>

What about patch? Will it be applied? Or should it be rewritten?

On Thu, 07 Nov 2013 11:45:25 +0900, whitearchey <whitearchey@gmail.com> wrote:

> 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


-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/

  reply	other threads:[~2013-11-12  9:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-06  1:54 [Qemu-trivial] [PATCH] qga: Fix shutdown command of guest agent to work with SysV whitearchey
2013-11-06  9:20 ` Michael Tokarev
2013-11-06  9:20   ` [Qemu-devel] " Michael Tokarev
2013-11-07  2:45   ` [Qemu-trivial] " whitearchey
2013-11-07  2:45     ` [Qemu-devel] " whitearchey
2013-11-12  9:01     ` whitearchey [this message]
2013-11-12  9:01       ` whitearchey
2013-11-13 12:02 ` [Qemu-trivial] " Michael Tokarev
2013-11-13 12:02   ` [Qemu-devel] " 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.w6fhz019cb68cn@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.