# HG changeset patch # Parent ea18090ab6e3cb3c69d232ec0865589688db3f81 hotplug: update xencommons script to run only when needed 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 - use variable for /proc/xen/capabilities - use grep -q instead of stdout redirection when looking for xenfs, its already used later Signed-off-by: Olaf Hering --- tools/hotplug/Linux/init.d/xencommons | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) Index: xen-4.2.0-testing/tools/hotplug/Linux/init.d/xencommons =================================================================== --- xen-4.2.0-testing.orig/tools/hotplug/Linux/init.d/xencommons +++ xen-4.2.0-testing/tools/hotplug/Linux/init.d/xencommons @@ -27,6 +27,7 @@ fi test -f $xencommons_config/xencommons && . $xencommons_config/xencommons XENCONSOLED_PIDFILE=/var/run/xenconsoled.pid +XEN_CAPABILITIES=/proc/xen/capabilities shopt -s extglob # not running in Xen dom0 or domU @@ -34,10 +35,15 @@ if ! test -d /proc/xen ; then exit 0 fi +# not running in Xen dom0 or domU +if ! test -d /proc/xen ; then + exit 0 +fi + # mount xenfs in dom0 or domU with a pv_ops kernel if test "x$1" = xstart && \ - ! test -f /proc/xen/capabilities && \ - ! grep '^xenfs ' /proc/mounts >/dev/null; + ! test -f $XEN_CAPABILITIES && \ + ! grep -q '^xenfs ' /proc/mounts ; then mount -t xenfs xenfs /proc/xen fi @@ -45,8 +51,8 @@ fi # run this script only in dom0: # no capabilities file in xenlinux domU kernel # empty capabilities file in pv_ops domU kernel -if test -f /proc/xen/capabilities && \ - ! grep -q "control_d" /proc/xen/capabilities ; then +if test -f $XEN_CAPABILITIES && \ + ! grep -q "control_d" $XEN_CAPABILITIES ; then exit 0 fi