WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] hotplug: update xencommons script to run only when n

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] hotplug: update xencommons script to run only when needed
From: Olaf Hering <olaf@xxxxxxxxx>
Date: Fri, 12 Aug 2011 09:11:59 +0200
Delivery-date: Fri, 12 Aug 2011 00:13:30 -0700
Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1313133163; l=1800; s=domk; d=aepfle.de; h=To:From:Date:Subject:Content-Transfer-Encoding:MIME-Version: Content-Type:X-RZG-CLASS-ID:X-RZG-AUTH; bh=yZLsTyzkow0MW2qW8yQUnUYsfjo=; b=MgZb3NXgBo+c2y0KuSefdK1iQae/lpGoP9CeW2dOc9tLYiwuybDzSdNFMJ7YXz4AyKL GyLwxKtKKiAi3lTGBX2ySj+Z2o710TR2u44CZvMMfo2fzEpgGMeJL8o1iM+qUdwdGSZkB UCuQrYw5F6vvQMSgX1VyDC/PnHJNUaejfgQ=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.7.5
# HG changeset patch
# User Olaf Hering <olaf@xxxxxxxxx>
# Date 1313133097 -7200
# Node ID 0e95f2c754bf526a89bb8a097959e6c970e9b5b7
# Parent  1f08b380d4386cdd6714786a9163e5f51aecab5d
hotplug: update xencommons script to run only when needed

Currently xencommons prints an error if /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
- 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@xxxxxxxxx>

diff -r 1f08b380d438 -r 0e95f2c754bf tools/hotplug/Linux/init.d/xencommons
--- a/tools/hotplug/Linux/init.d/xencommons
+++ b/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
 

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