ia64/xen-unstable

changeset 17498:5e3baace443f

hotplug scripts: Fix sharing check for blktap

Run check_blktap_sharing() only when a disk is added to guest with blktap.
A check_blktap_sharing() doesn't have to be run when a disk is removed.

Signed-off-by: Hirofumi Tsujimura <tsujimura.hirof@jp.fujitsu.com>
Signed-off-by: Takanori Kasai <kasai.takanori@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Apr 22 10:29:32 2008 +0100 (2008-04-22)
parents d9a74b8e9b1a
children 78d0a147216f
files tools/examples/blktap
line diff
     1.1 --- a/tools/examples/blktap	Tue Apr 22 10:27:04 2008 +0100
     1.2 +++ b/tools/examples/blktap	Tue Apr 22 10:29:32 2008 +0100
     1.3 @@ -54,10 +54,6 @@ check_blktap_sharing()
     1.4      echo 'ok'
     1.5  }
     1.6  
     1.7 -FRONTEND_ID=$(xenstore_read "$XENBUS_PATH/frontend-id")
     1.8 -FRONTEND_UUID=$(xenstore_read "/local/domain/$FRONTEND_ID/vm")
     1.9 -mode=$(xenstore_read "$XENBUS_PATH/mode")
    1.10 -mode=$(canonicalise_mode "$mode")
    1.11  
    1.12  t=$(xenstore_read_default "$XENBUS_PATH/type" 'MISSING')
    1.13  if [ -n "$t" ]
    1.14 @@ -77,15 +73,21 @@ else
    1.15      file="$p"
    1.16  fi
    1.17  
    1.18 -if [ "$mode" != '!' ] 
    1.19 -then
    1.20 -    result=$(check_blktap_sharing "$file" "$mode")
    1.21 -    [ "$result" = 'ok' ] || ebusy "$file already in use by other domain"
    1.22 -fi
    1.23 -
    1.24  if [ "$command" = 'add' ]
    1.25  then
    1.26      [ -e "$file" ] || { fatal $file does not exist; }
    1.27 +
    1.28 +    FRONTEND_ID=$(xenstore_read "$XENBUS_PATH/frontend-id")
    1.29 +    FRONTEND_UUID=$(xenstore_read "/local/domain/$FRONTEND_ID/vm")
    1.30 +    mode=$(xenstore_read "$XENBUS_PATH/mode")
    1.31 +    mode=$(canonicalise_mode "$mode")
    1.32 +
    1.33 +    if [ "$mode" != '!' ] 
    1.34 +    then
    1.35 +        result=$(check_blktap_sharing "$file" "$mode")
    1.36 +        [ "$result" = 'ok' ] || ebusy "$file already in use by other domain"
    1.37 +    fi
    1.38 +
    1.39      success
    1.40  fi
    1.41