ia64/xen-unstable

changeset 12336:d173b32f54ab

[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 <ryanh@us.ibm.com>
author kfraser@localhost.localdomain
date Thu Nov 09 13:43:21 2006 +0000 (2006-11-09)
parents 233ce78de4e4
children 8fc5abda5200
files tools/examples/blktap
line diff
     1.1 --- a/tools/examples/blktap	Thu Nov 09 13:30:16 2006 +0000
     1.2 +++ b/tools/examples/blktap	Thu Nov 09 13:43:21 2006 +0000
     1.3 @@ -4,12 +4,26 @@
     1.4  
     1.5  dir=$(dirname "$0")
     1.6  . "$dir/xen-hotplug-common.sh"
     1.7 +. "$dir/block-common.sh"
     1.8  
     1.9  findCommand "$@"
    1.10  
    1.11 +t=$(xenstore_read_default "$XENBUS_PATH/type" 'MISSING')
    1.12 +if [ -n "$t" ]
    1.13 +then
    1.14 +    p=$(xenstore_read "$XENBUS_PATH/params")
    1.15 +    # if we have a ':', chew from head including :
    1.16 +    if echo $p | grep -q \:
    1.17 +    then
    1.18 +        p=${p#*:}
    1.19 +    fi
    1.20 +fi
    1.21 +file=$(readlink -f "$p") || ebusy "$p does not exist."
    1.22 +
    1.23  if [ "$command" = 'add' ]
    1.24  then
    1.25 -  success
    1.26 +    [ -e "$file" ] || { ebusy $file does not exist; }
    1.27 +    success
    1.28  fi
    1.29  
    1.30  exit 0