mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
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>
This commit is contained in:
1 parent
4195aba99f
commit
978e9bef8c
1 file changed
+12
-10
+12
-10
@@ -54,10 +54,6 @@ check_blktap_sharing()
|
||||
echo 'ok'
|
||||
}
|
||||
|
||||
FRONTEND_ID=$(xenstore_read "$XENBUS_PATH/frontend-id")
|
||||
FRONTEND_UUID=$(xenstore_read "/local/domain/$FRONTEND_ID/vm")
|
||||
mode=$(xenstore_read "$XENBUS_PATH/mode")
|
||||
mode=$(canonicalise_mode "$mode")
|
||||
|
||||
t=$(xenstore_read_default "$XENBUS_PATH/type" 'MISSING')
|
||||
if [ -n "$t" ]
|
||||
@@ -77,15 +73,21 @@ else
|
||||
file="$p"
|
||||
fi
|
||||
|
||||
if [ "$mode" != '!' ]
|
||||
then
|
||||
result=$(check_blktap_sharing "$file" "$mode")
|
||||
[ "$result" = 'ok' ] || ebusy "$file already in use by other domain"
|
||||
fi
|
||||
|
||||
if [ "$command" = 'add' ]
|
||||
then
|
||||
[ -e "$file" ] || { fatal $file does not exist; }
|
||||
|
||||
FRONTEND_ID=$(xenstore_read "$XENBUS_PATH/frontend-id")
|
||||
FRONTEND_UUID=$(xenstore_read "/local/domain/$FRONTEND_ID/vm")
|
||||
mode=$(xenstore_read "$XENBUS_PATH/mode")
|
||||
mode=$(canonicalise_mode "$mode")
|
||||
|
||||
if [ "$mode" != '!' ]
|
||||
then
|
||||
result=$(check_blktap_sharing "$file" "$mode")
|
||||
[ "$result" = 'ok' ] || ebusy "$file already in use by other domain"
|
||||
fi
|
||||
|
||||
success
|
||||
fi
|
||||
|
||||
|
||||