[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 4/4] tools: make xenstore domain easy configurable



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:

- system has no systemd installed: systemd-notify will fail, but calling
  it was not necessary -> no harm done
- system is with systemd, but not booted under control of it, and
  systemd-notify is not found: same as above -> no harm done
- system is with systemd, but not booted under control of it, and
  systemd-notify is found: calling systemd-notify isn't really needed,
  but it won't harm
- system is booted under control of systemd, systemd-notify is not
  found: I could log it, but I can't know that I'm under control of
  systemd (standard way to tell from a script is calling
  "systemd-notify --booted" which is kind of chicken and egg problem
  here) so I can't know whether not finding systemd-notify is an error
  or not
- system is booted under control of systemd, systemd-notify is found:
  everything is nice, systemd receives the notification it is waiting
  for


Juergen

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.