xen/xencommons-proc-xen.patch

56 lines
1.7 KiB
Diff

# 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 <olaf@aepfle.de>
---
tools/hotplug/Linux/init.d/xencommons | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
Index: xen-4.1.1-testing/tools/hotplug/Linux/init.d/xencommons
===================================================================
--- xen-4.1.1-testing.orig/tools/hotplug/Linux/init.d/xencommons
+++ xen-4.1.1-testing/tools/hotplug/Linux/init.d/xencommons
@@ -27,17 +27,29 @@ 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
+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 -d /proc/xen && \
- ! 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
-if ! grep -q "control_d" /proc/xen/capabilities ; then
+# run this script only in dom0:
+# no capabilities file in xenlinux kernel
+if ! test -f $XEN_CAPABILITIES ; then
+ exit 0
+fi
+# empty capabilities file in pv_ops kernel
+if ! grep -q "control_d" $XEN_CAPABILITIES ; then
exit 0
fi