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] scripts/blktap: add check for file error

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] scripts/blktap: add check for file error
From: Ryan Harper <ryanh@xxxxxxxxxx>
Date: Tue, 7 Nov 2006 17:47:59 -0600
Delivery-date: Tue, 07 Nov 2006 15:48:16 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.6+20040907i
/etc/xen/scripts/bkltap doesn't bother to check if the file specified in
your config exists.  The domain will launch and the root device is not
found.  Rather than confuse the user, do some checking up-front and
error out when the specified file is not found.

Now users will see the following error:

[root@bebop ~]# xm create -c 128
Using config file "/etc/xen/128".
Error: Device 51713 (tap) could not be connected.
/tmp/128.img does not exist

-- 
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
(512) 838-9253   T/L: 678-9253
ryanh@xxxxxxxxxx


diffstat output:
 blktap |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletion(-)

Signed-off-by: Ryan Harper <ryanh@xxxxxxxxxx>
---
diff -r 5a41ea282c86 tools/examples/blktap
--- a/tools/examples/blktap     Tue Nov 07 11:54:52 2006 +0000
+++ b/tools/examples/blktap     Tue Nov 07 17:43:36 2006 -0600
@@ -4,12 +4,26 @@
 
 dir=$(dirname "$0")
 . "$dir/xen-hotplug-common.sh"
+. "$dir/block-common.sh"
 
 findCommand "$@"
 
+t=$(xenstore_read_default "$XENBUS_PATH/type" 'MISSING')
+if [ -n "$t" ]
+then
+      p=$(xenstore_read "$XENBUS_PATH/params")
+      # if we have a ':', chew from head including :
+      if echo $p | grep -q \:
+      then
+          p=${p#*:}
+      fi
+fi
+file=$(readlink -f "$p") || ebusy "$p does not exist."
+
 if [ "$command" == 'add' ]
 then
-  success
+    [ -e "$file" ] || { ebusy $file does not exist; }
+    success
 fi
 
 exit 0

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] scripts/blktap: add check for file error, Ryan Harper <=