xcp-1.6-updates/xen-4.1.hg

changeset 23200:7a4fad2d4b05

tools: init.d/Linux/xencommons: run script only when needed

Currently xencommons prints an error that /proc/xen/capabilities does
not exist when started on a non-xen kernel.

Update the xencommons script to run only when needed:
- do not run if /proc/xen does not exist
- check if /proc/xen/capabilities exists before doing the grep for dom0

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-unstable changeset: 24333:4002e63b188a
Backport-requested-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Olaf Hering <olaf@aepfle.de>
date Thu Dec 08 16:50:16 2011 +0000 (2011-12-08)
parents d9f8316a8291
children 1c89f7d29fbb
files tools/hotplug/Linux/init.d/xencommons
line diff
     1.1 --- a/tools/hotplug/Linux/init.d/xencommons	Tue Dec 06 10:53:12 2011 +0000
     1.2 +++ b/tools/hotplug/Linux/init.d/xencommons	Thu Dec 08 16:50:16 2011 +0000
     1.3 @@ -29,15 +29,24 @@ test -f $xencommons_config/xencommons &&
     1.4  XENCONSOLED_PIDFILE=/var/run/xenconsoled.pid
     1.5  shopt -s extglob
     1.6  
     1.7 +# not running in Xen dom0 or domU
     1.8 +if ! test -d /proc/xen ; then
     1.9 +	exit 0
    1.10 +fi
    1.11 +
    1.12 +# mount xenfs in dom0 or domU with a pv_ops kernel
    1.13  if test "x$1" = xstart && \
    1.14 -     test -d /proc/xen && \
    1.15     ! test -f /proc/xen/capabilities && \
    1.16     ! grep '^xenfs ' /proc/mounts >/dev/null;
    1.17  then
    1.18  	mount -t xenfs xenfs /proc/xen
    1.19  fi
    1.20  
    1.21 -if ! grep -q "control_d" /proc/xen/capabilities ; then
    1.22 +# run this script only in dom0:
    1.23 +# no capabilities file in xenlinux domU kernel
    1.24 +# empty capabilities file in pv_ops domU kernel
    1.25 +if test -f /proc/xen/capabilities && \
    1.26 +   ! grep -q "control_d" /proc/xen/capabilities ; then
    1.27  	exit 0
    1.28  fi
    1.29