If the test setups a loop device itself (not created by
_nvmet_target_setup), _nvmet_target_cleanup should not cleanup the block
device automatically.
Because _nvmet_target_cleanup has no way to figure this out by itself if
it is managed or not, the caller needs to pass in the block device type.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
local port
local blkdev
local subsysnqn="${def_subsysnqn}"
+ local blkdev_type=""
while [[ $# -gt 0 ]]; do
case $1 in
+ --blkdev)
+ blkdev_type="$2"
+ shift 2
+ ;;
--subsysnqn)
subsysnqn="$2"
shift 2
_remove_nvmet_subsystem "${subsysnqn}"
_remove_nvmet_host "${def_hostnqn}"
- _cleanup_blkdev
+ if [[ "${blkdev_type}" == "device" ]]; then
+ _cleanup_blkdev
+ fi
}
_nvmet_passthru_target_setup() {