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

Re: [Xen-devel] [PATCH] Fix xencommons for NetBSD



Thanks for the comments, here is the new patch, changed the commit
message and used the method found on Linux script to wait for xenstore
to come up.

Regards, Roger.

2011/7/15 Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx>:
> On Fri, 2011-07-15 at 09:59 +0100, Christoph Egger wrote:
>> On 07/15/11 10:01, Ian Campbell wrote:
>> > On Fri, 2011-07-15 at 08:38 +0100, Roger Pau Monnà wrote:
>> >> # HG changeset patch
>> >> # User royger
>> >> # Date 1310722656 -7200
>> >> # Node ID d3b9e6f9536c84d595276f8c12735736d5593e13
>> >> # Parent Â8c7e3cfc33b6151fbd4fc6e1aeae132a9b1ccfa5
>> >> xencommons NetBSD init script:
>> >
>> > In general it is useful if the first line of the commit message
>> > standsalone as a summary, since hg will often display it that way (e.g.
>> > in hg log, on hg web etc).
>> >
>> >> Clean up of xenstore database on init.
>> >> Prevent xenstore from restarting.
>> >> Set Domain-0 name on init.
>> >>
>> >> Signed-off-by: Roger Pau Monne<roger.pau@xxxxxxxxxxxxx>
>> >>
>> >> diff -r 8c7e3cfc33b6 -r d3b9e6f9536c tools/hotplug/NetBSD/rc.d/xencommons
>> >> --- a/tools/hotplug/NetBSD/rc.d/xencommons Fri Jul 15 11:29:21 2011 +0200
>> >> +++ b/tools/hotplug/NetBSD/rc.d/xencommons Fri Jul 15 11:37:36 2011 +0200
>> >> @@ -23,6 +23,9 @@
>> >> Â XENSTORED_PIDFILE="/var/run/xenstored.pid"
>> >> Â XENCONSOLED_PIDFILE="/var/run/xenconsoled.pid"
>> >> Â XENBACKENDD_PIDFILE="/var/run/xenbackendd.pid"
>> >> +#XENBACKENDD_DEBUG=1
>> >> +#XENCONSOLED_TRACE=1
>> >> +#XENSTORED_TRACE="/var/log/xen/xenconsole-trace.log"
>> >>
>> >> Â xen_precmd()
>> >> Â {
>> >> @@ -33,15 +36,24 @@
>> >>
>> >> Â xen_startcmd()
>> >> Â {
>> >> - Âprintf "Starting xenservices: xenstored, xenconsoled, xenbackendd.\n"
>> >> - ÂXENSTORED_ARGS=" --pid-file ${XENSTORED_PIDFILE}"
>> >> - Âif [ -n "${XENSTORED_TRACE}" ]; then
>> >> - Â Â Â Â ÂXENSTORED_ARGS="${XENSTORED_ARGS} -T 
>> >> /var/log/xen/xenstored-trace.log"
>> >> + Âxenstored_pid=$(check_pidfile ${XENSTORED_PIDFILE} 
>> >> ${SBINDIR}/xenstored)
>> >> + Âif test -z $xenstored_pid; then
>> >> + Â Â Â Â Âprintf "Cleaning xenstore database.\n"
>> >> + Â Â Â Â Âif [ -n "${XENSTORED_ROOTDIR}" ]; then
>> >> + Â Â Â Â Â Â Â Â ÂXENSTORED_ROOTDIR="/var/lib/xenstored"
>> >> + Â Â Â Â Âfi
>> >> + Â Â Â Â Ârm -f ${XENSTORED_ROOTDIR}/tdb*&>/dev/null
>> >> + Â Â Â Â Âprintf "Starting xenservices: xenstored, xenconsoled, 
>> >> xenbackendd.\n"
>> >> + Â Â Â Â ÂXENSTORED_ARGS=" --pid-file ${XENSTORED_PIDFILE}"
>> >> + Â Â Â Â Âif [ -n "${XENSTORED_TRACE}" ]; then
>> >> + Â Â Â Â Â Â Â Â ÂXENSTORED_ARGS="${XENSTORED_ARGS} -T 
>> >> /var/log/xen/xenstored-trace.log"
>> >> + Â Â Â Â Âfi
>> >> + Â Â Â Â Â${SBINDIR}/xenstored ${XENSTORED_ARGS}
>> >> + Â Â Â Â Âsleep 5
>> >
>> > sleep 5 seems a bit drastic. Perhaps steal the checking loop from the 
>> > Linux xencommons?
>>
>> I think, the sleep 5 can be reduced to sleep 2 since xenstored launches
>> much faster when there is no xenstored database to check.
>> The sleep is there to delay the next start up script which starts xend.
>> And starting xend fails when xenstored isn't ready before.
>
> Why hardcode a "2" (which can easily be either too short or too long
> depending on circumstances) when you could cut-and-paste something
> better (from tools/hotplug/Linux/init.d/xencommons):
> Â Â Â Âlocal time=0
> Â Â Â Âlocal timeout=30
> Â Â Â Â...
> Â Â Â Â Â Â Â Â# Wait for xenstored to actually come up, timing out after 30 
> seconds
> Â Â Â Â Â Â Â Âwhile [ $time -lt $timeout ] && ! `xenstore-read -s /local 
> >/dev/null 2>&1` ; do
> Â Â Â Â Â Â Â Â Â Âecho -n .
> Â Â Â Â Â Â Â Â Â Âtime=$(($time+1))
> Â Â Â Â Â Â Â Â Â Âsleep 1
> Â Â Â Â Â Â Â Âdone
>
> Is $(( ... )) a bashism? `expr $time + 1` instead?
>
> Ian.
>
>

Attachment: patch-xencommons
Description: Binary data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

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