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 v2] hotplug: update xencommons script to run only whe

To: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH v2] hotplug: update xencommons script to run only when needed
From: Olaf Hering <olaf@xxxxxxxxx>
Date: Fri, 26 Aug 2011 11:10:55 +0200
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 26 Aug 2011 02:12:06 -0700
Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1314349860; l=1436; s=domk; d=aepfle.de; h=In-Reply-To:Content-Type:MIME-Version:References:Subject:Cc:To:From: Date:X-RZG-CLASS-ID:X-RZG-AUTH; bh=12dab8e/uwgvVoe+4egoh/MlvbQ=; b=pZZzfPh1UpjJ9aw27Jmer0aYlxagZwZVxV6oC29YLNOMlVon8OGzdiKDYyGoaX/spl7 ZawmRMnAIduxEoQICpFq3qW7AOqEDFcOR5c9mRpdMfLVqVbu3W8+GIBgR12IondHNNP+i e3dYUzjI+3HhEmCm9pCJDpYmlMVS0cOkjDo=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20054.27534.720259.973323@xxxxxxxxxxxxxxxxxxxxxxxx>
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>
References: <0e95f2c754bf526a89bb.1313133119@xxxxxxxxxxxx> <20054.26388.743123.491778@xxxxxxxxxxxxxxxxxxxxxxxx> <20110825152413.GB25643@xxxxxxxxx> <20054.27534.720259.973323@xxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.21.rev5535 (2011-07-01)
# HG changeset patch
# Parent 227130622561e20136a1ef56201fe65ead5a76e8
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 grep -q instead of stdout redirection when looking for xenfs

Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>

diff -r 227130622561 tools/hotplug/Linux/init.d/xencommons
--- a/tools/hotplug/Linux/init.d/xencommons
+++ b/tools/hotplug/Linux/init.d/xencommons
@@ -29,14 +29,25 @@ test -f $xencommons_config/xencommons &&
 XENCONSOLED_PIDFILE=/var/run/xenconsoled.pid
 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;
+   ! grep -q '^xenfs ' /proc/mounts ;
 then
        mount -t xenfs xenfs /proc/xen
 fi
 
+# run this script only in dom0:
+# no capabilities file in xenlinux kernel
+if ! test -f /proc/xen/capabilities ; then
+       exit 0
+fi
+# empty capabilities file in pv_ops kernel
 if ! grep -q "control_d" /proc/xen/capabilities ; then
        exit 0
 fi

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