Olaf Hering
2011-Aug-12 07:11 UTC
[Xen-devel] [PATCH] hotplug: update xencommons script to run only when needed
# HG changeset patch # User Olaf Hering <olaf@aepfle.de> # 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@aepfle.de> 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@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2011-Aug-25 15:15 UTC
Re: [Xen-devel] [PATCH] hotplug: update xencommons script to run only when needed
Olaf Hering writes ("[Xen-devel] [PATCH] hotplug: update xencommons script to run only when needed"):> Update the xencommons script to run only when needed:Thanks. I like most of this. But:> - use variable for /proc/xen/capabilitiesWhy ? Is this going to move ? I think if it moves we have other problems, since it''s part of the published /proc interface from Xen-enabled kernels. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Olaf Hering
2011-Aug-25 15:24 UTC
Re: [Xen-devel] [PATCH] hotplug: update xencommons script to run only when needed
On Thu, Aug 25, Ian Jackson wrote:> Olaf Hering writes ("[Xen-devel] [PATCH] hotplug: update xencommons script to run only when needed"): > > Update the xencommons script to run only when needed: > > Thanks. I like most of this. But: > > > - use variable for /proc/xen/capabilities > > Why ? Is this going to move ? I think if it moves we have other > problems, since it''s part of the published /proc interface from > Xen-enabled kernels.There is no special reason for the variable. Do you want me to send a patch without the new variable? Olaf _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2011-Aug-25 15:34 UTC
Re: [Xen-devel] [PATCH] hotplug: update xencommons script to run only when needed
Olaf Hering writes ("Re: [Xen-devel] [PATCH] hotplug: update xencommons script to run only when needed"):> There is no special reason for the variable.Right.> Do you want me to send a patch without the new variable?If you like, or I can just take it out myself. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Olaf Hering
2011-Aug-26 09:10 UTC
[Xen-devel] [PATCH v2] hotplug: update xencommons script to run only when needed
# 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@aepfle.de> 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@lists.xensource.com http://lists.xensource.com/xen-devel
Olaf Hering
2011-Sep-08 11:56 UTC
[Xen-devel] [PATCH] hotplug: update xencommons script to run only when needed
# HG changeset patch # User Olaf Hering <olaf@aepfle.de> # Date 1315479698 -7200 # Node ID 7829ad83ee66fbec0653ccb53ce5b8502657a71f # Parent 7b55f33f29cd7aaa0057485b8cae53722bac8741 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 Signed-off-by: Olaf Hering <olaf@aepfle.de> diff -r 7b55f33f29cd -r 7829ad83ee66 tools/hotplug/Linux/init.d/xencommons --- a/tools/hotplug/Linux/init.d/xencommons +++ b/tools/hotplug/Linux/init.d/xencommons @@ -29,15 +29,24 @@ 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; 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 domU kernel +# empty capabilities file in pv_ops domU kernel +if test -f /proc/xen/capabilities && \ + ! grep -q "control_d" /proc/xen/capabilities ; then exit 0 fi _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel