From d857ed522cd3e7f3a978c85b01d5ba7feaec999c Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Thu, 9 Nov 2006 13:43:21 +0000 Subject: [PATCH] [BLKTAP] Fix hotplug script to check if specified file exists. 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 Signed-off-by: Ryan Harper --- tools/examples/blktap | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tools/examples/blktap b/tools/examples/blktap index 4af9286055..bc25b48be2 100644 --- a/tools/examples/blktap +++ b/tools/examples/blktap @@ -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 -- 2.30.2