From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Egger Subject: Re: [PATCH] Fix xencommons for NetBSD Date: Fri, 15 Jul 2011 10:59:29 +0200 Message-ID: <4E200171.5080700@amd.com> References: <1310716893.634.552.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <1310716893.634.552.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Campbell Cc: =?UTF-8?B?Um9nZXIgUGF1IE1vbm7DqQ==?= , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On 07/15/11 10:01, Ian Campbell wrote: > On Fri, 2011-07-15 at 08:38 +0100, Roger Pau Monn=C3=A9 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 >> >> diff -r 8c7e3cfc33b6 -r d3b9e6f9536c tools/hotplug/NetBSD/rc.d/xencomm= ons >> --- a/tools/hotplug/NetBSD/rc.d/xencommons Fri Jul 15 11:29:21 2011 +0= 200 >> +++ b/tools/hotplug/NetBSD/rc.d/xencommons Fri Jul 15 11:37:36 2011 +0= 200 >> @@ -23,6 +23,9 @@ >> XENSTORED_PIDFILE=3D"/var/run/xenstored.pid" >> XENCONSOLED_PIDFILE=3D"/var/run/xenconsoled.pid" >> XENBACKENDD_PIDFILE=3D"/var/run/xenbackendd.pid" >> +#XENBACKENDD_DEBUG=3D1 >> +#XENCONSOLED_TRACE=3D1 >> +#XENSTORED_TRACE=3D"/var/log/xen/xenconsole-trace.log" >> >> xen_precmd() >> { >> @@ -33,15 +36,24 @@ >> >> xen_startcmd() >> { >> - printf "Starting xenservices: xenstored, xenconsoled, xenbackendd.\n= " >> - XENSTORED_ARGS=3D" --pid-file ${XENSTORED_PIDFILE}" >> - if [ -n "${XENSTORED_TRACE}" ]; then >> - XENSTORED_ARGS=3D"${XENSTORED_ARGS} -T /var/log/xen/xenstored-trace= .log" >> + xenstored_pid=3D$(check_pidfile ${XENSTORED_PIDFILE} ${SBINDIR}/xens= tored) >> + if test -z $xenstored_pid; then >> + printf "Cleaning xenstore database.\n" >> + if [ -n "${XENSTORED_ROOTDIR}" ]; then >> + XENSTORED_ROOTDIR=3D"/var/lib/xenstored" >> + fi >> + rm -f ${XENSTORED_ROOTDIR}/tdb*&>/dev/null >> + printf "Starting xenservices: xenstored, xenconsoled, xenbackendd.\= n" >> + XENSTORED_ARGS=3D" --pid-file ${XENSTORED_PIDFILE}" >> + if [ -n "${XENSTORED_TRACE}" ]; then >> + XENSTORED_ARGS=3D"${XENSTORED_ARGS} -T /var/log/xen/xenstored-trac= e.log" >> + fi >> + ${SBINDIR}/xenstored ${XENSTORED_ARGS} >> + sleep 5 > > sleep 5 seems a bit drastic. Perhaps steal the checking loop from the L= inux xencommons? I think, the sleep 5 can be reduced to sleep 2 since xenstored launches=20 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. Christoph >> >> + else >> + printf "Starting xenservices: xenconsoled, xenbackendd.\n" >> fi >> >> - ${SBINDIR}/xenstored ${XENSTORED_ARGS} >> - sleep 5 >> - >> XENCONSOLED_ARGS=3D"" >> if [ -n "${XENCONSOLED_TRACE}" ]; then >> XENCONSOLED_ARGS=3D"${XENCONSOLED_ARGS} --log=3D${XENCONSOLED_TRAC= E}" >> @@ -55,24 +67,24 @@ >> fi >> >> ${SBINDIR}/xenbackendd ${XENBACKENDD_ARGS} >> + >> + printf "Setting domain 0 name.\n" >> + ${BINDIR}/xenstore-write "/local/domain/0/name" "Domain-0" >> } >> >> xen_stop() >> { >> pids=3D"" >> - printf "Stopping xencommons" >> + printf "Stopping xencommons.\n" >> + printf "WARNING: Not stopping xenstored, as it cannot be restarted.\= n" >> >> rc_pid=3D$(check_pidfile ${XENBACKENDD_PIDFILE} ${SBINDIR}/xenbacke= ndd) >> pids=3D"$pids $rc_pid" >> rc_pid=3D$(check_pidfile ${XENCONSOLED_PIDFILE} ${SBINDIR}/xenconso= led) >> pids=3D"$pids $rc_pid" >> - rc_pid=3D$(check_pidfile ${XENSTORED_PIDFILE} ${SBINDIR}/xenstored) >> - pids=3D"$pids $rc_pid" >> >> kill -${sig_stop:-TERM} $pids >> wait_for_pids $pids >> - >> - printf ".\n" >> } >> >> xen_status() --=20 ---to satisfy European Law for business letters: Advanced Micro Devices GmbH Einsteinring 24, 85689 Dornach b. Muenchen Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632