All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: ross.lagerwall@citrix.com, dave@recoil.org,
	ian.jackson@eu.citrix.com, andrew.cooper3@citrix.com,
	xen-devel@lists.xen.org
Subject: Re: [PATCH v3 4/4] tools: make xenstore domain easy configurable
Date: Mon, 25 Jul 2016 16:16:51 +0200	[thread overview]
Message-ID: <e700535c-5add-cfb7-9a21-a60a12e27976@suse.com> (raw)
In-Reply-To: <20160725141125.GU27082@citrix.com>

On 25/07/16 16:11, Wei Liu wrote:
> On Mon, Jul 25, 2016 at 04:06:11PM +0200, Juergen Gross wrote:
>> On 25/07/16 16:01, Wei Liu wrote:
>>> On Mon, Jul 25, 2016 at 03:56:17PM +0200, Juergen Gross wrote:
>>>> On 25/07/16 15:43, Wei Liu wrote:
>>>>> On Fri, Jul 22, 2016 at 05:09:31PM +0200, Juergen Gross wrote:
>>>>> [...]
>>>>>> diff --git a/tools/hotplug/Linux/launch-xenstore.in b/tools/hotplug/Linux/launch-xenstore.in
>>>>>> index 2bd9f64..fdfa33a 100644
>>>>>> --- a/tools/hotplug/Linux/launch-xenstore.in
>>>>>> +++ b/tools/hotplug/Linux/launch-xenstore.in
>>>>>> @@ -48,18 +48,40 @@ test_xenstore && exit 0
>>>>>>  
>>>>>>  test -f @CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons && . @CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons
>>>>>>  
>>>>>> -test -z "$XENSTORED_ROOTDIR" && XENSTORED_ROOTDIR="@XEN_LIB_STORED@"
>>>>>> -rm -f "$XENSTORED_ROOTDIR"/tdb* 2>/dev/null
>>>>>> -test -z "$XENSTORED_TRACE" || XENSTORED_ARGS=" -T @XEN_LOG_DIR@/xenstored-trace.log"
>>>>>> +[ "$XENSTORETYPE" = "" ] && XENSTORETYPE=daemon
>>>>>> +
>>>>>> +/bin/mkdir -p @XEN_RUN_DIR@
>>>>>> +
>>>>>> +[ "$XENSTORETYPE" = "daemon" ] && {
>>>>>> +	[ -z "$XENSTORED_ROOTDIR" ] && XENSTORED_ROOTDIR="@XEN_LIB_STORED@"
>>>>>> +	/bin/rm -f $XENSTORED_ROOTDIR/tdb* 2>/dev/null
>>>>>> +	[ -z "$XENSTORED_TRACE" ] || XENSTORED_ARGS="$XENSTORED_ARGS -T @XEN_LOG_DIR@/xenstored-trace.log"
>>>>>> +	[ -z "$XENSTORED" ] && XENSTORED=@XENSTORED@
>>>>>> +	[ -x "$XENSTORED" ] || {
>>>>>> +		echo "No xenstored found"
>>>>>> +		exit 1
>>>>>> +	}
>>>>>>  
>>>>>> -if [ -n "$XENSTORED" ] ; then
>>>>>>  	echo -n Starting $XENSTORED...
>>>>>>  	$XENSTORED --pid-file @XEN_RUN_DIR@/xenstored.pid $XENSTORED_ARGS
>>>>>> -else
>>>>>> -	echo "No xenstored found"
>>>>>> -	exit 1
>>>>>> -fi
>>>>>>  
>>>>>> -timeout_xenstore $XENSTORED || exit 1
>>>>>> +	systemd-notify --booted 2>/dev/null || timeout_xenstore $XENSTORED || exit 1
>>>>>>  
>>>>>> -exit 0
>>>>>> +	exit 0
>>>>>> +}
>>>>>> +
>>>>>> +[ "$XENSTORETYPE" = "domain" ] && {
>>>>>> +	[ -z "$XENSTORE_DOMAIN_KERNEL" ] && XENSTORE_DOMAIN_KERNEL=@LIBEXEC@/boot/xenstore-stubdom.gz
>>>>>> +	XENSTORE_DOMAIN_ARGS="$XENSTORE_DOMAIN_ARGS --kernel $XENSTORE_DOMAIN_KERNEL"
>>>>>> +	[ -z "$XENSTORE_DOMAIN_SIZE" ] && XENSTORE_DOMAIN_SIZE=8
>>>>>> +	XENSTORE_DOMAIN_ARGS="$XENSTORE_DOMAIN_ARGS --memory $XENSTORE_DOMAIN_SIZE"
>>>>>> +
>>>>>> +	echo -n Starting $XENSTORE_DOMAIN_KERNEL...
>>>>>> +	${LIBEXEC_BIN}/init-xenstore-domain $XENSTORE_DOMAIN_ARGS || exit 1
>>>>>> +	systemd-notify --ready 2>/dev/null
>>>>>
>>>>> Please test if there is systemd-notify before trying to invoke it and
>>>>> then you can properly log the failure of the invocation.
>>>>
>>>> I thought about that. What would be the purpose doing so? Following
>>>> cases are possible:
>>>>
>>>
>>> This
>>>
>>>> - system is booted under control of systemd, systemd-notify is found:
>>>>   everything is nice, systemd receives the notification it is waiting
>>>>   for
>>>>
>>>
>>> Here you assume systemd-notify always succeed. It can fail due to some
>>> reasons. That's what its manpage suggests.
>>>
>>> We need to handle this.
>>
>> May I repeat the sd_notify() man page here?
>>
>> "In order to support both, init systems that implement this scheme and
>> those which do not, it is generally recommended to ignore the return
>> value of this call."
> 
> That's a different thing from the systemd-notify utility, isn't it?
> 
> I read man systemd-notify in this case:
> 
>   EXIT STATUS
>          On success, 0 is returned, a non-zero failure code otherwise.
> 
> I'm not too sure about the relationship between systemd-notify and
> sd_notify, but I bet it is more than just a call to sd_notify.

The systemd-notify man-page tells us:

"This is mostly just a wrapper around sd_notify() and makes this
functionality available to shell scripts. For details see sd_notify(3)."


Juergen


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2016-07-25 14:16 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-22 15:09 [PATCH v3 0/4] tools: make xenstore domain/daemon configurable Juergen Gross
2016-07-22 15:09 ` [PATCH v3 1/4] tools: remove systemd xenstore socket definitions Juergen Gross
2016-07-22 16:31   ` Wei Liu
2016-07-22 18:49     ` Juergen Gross
2016-07-22 18:51       ` Wei Liu
2016-07-25  4:33         ` Juergen Gross
2016-07-25 11:05           ` Wei Liu
2016-07-25 12:21             ` Juergen Gross
2016-07-22 15:09 ` [PATCH v3 2/4] tools: split out xenstored starting form xencommons Juergen Gross
2016-07-25 13:43   ` Wei Liu
2016-07-22 15:09 ` [PATCH v3 3/4] tools: use pidfile for test if xenstored is running Juergen Gross
2016-08-02 10:23   ` Wei Liu
2016-08-02 10:26     ` Juergen Gross
2016-07-22 15:09 ` [PATCH v3 4/4] tools: make xenstore domain easy configurable Juergen Gross
2016-07-25 13:43   ` Wei Liu
2016-07-25 13:56     ` Juergen Gross
2016-07-25 14:01       ` Wei Liu
2016-07-25 14:06         ` Juergen Gross
2016-07-25 14:11           ` Wei Liu
2016-07-25 14:16             ` Juergen Gross [this message]
2016-07-25 14:27               ` Wei Liu
2016-07-25 13:43 ` [PATCH v3 0/4] tools: make xenstore domain/daemon configurable Wei Liu
2016-08-01  8:02 ` Juergen Gross

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=e700535c-5add-cfb7-9a21-a60a12e27976@suse.com \
    --to=jgross@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dave@recoil.org \
    --cc=ian.jackson@eu.citrix.com \
    --cc=ross.lagerwall@citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.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.