Spdk/test/ocf/management/remove.sh
paul luse eb53c23236 add (c) and SPDX header to bash files as needed
per Intel policy to include file commit date using git cmd
below.  The policy does not apply to non-Intel (C) notices.

git log --follow -C90% --format=%ad --date default <file> | tail -1

and then pull just the year from the result.

Intel copyrights were not added to files where Intel either had
no contribution ot the contribution lacked substance (ie license
header updates, formatting changes, etc)

For intel copyrights added, --follow and -C95% were used.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I2ef86976095b88a9bf5b1003e59f3943cd6bbe4c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15209
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2022-11-29 08:27:51 +00:00

88 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (C) 2019 Intel Corporation
# All rights reserved.
#
curdir=$(dirname $(readlink -f "${BASH_SOURCE[0]}"))
rootdir=$(readlink -f $curdir/../../..)
source $rootdir/test/common/autotest_common.sh
rpc_py=$rootdir/scripts/rpc.py
rm -f aio*
truncate -s 128M aio0
truncate -s 128M aio1
jq . <<- JSON > "$curdir/config"
{
"subsystems": [
{
"subsystem": "bdev",
"config": [
{
"method": "bdev_aio_create",
"params": {
"name": "ai0",
"block_size": 512,
"filename": "./aio0"
}
},
{
"method": "bdev_aio_create",
"params": {
"name": "aio1",
"block_size": 512,
"filename": "./aio1"
}
},
{
"method": "bdev_wait_for_examine"
}
]
}
]
}
JSON
"$SPDK_BIN_DIR/iscsi_tgt" --json "$curdir/config" &
spdk_pid=$!
waitforlisten $spdk_pid
# Create ocf on persistent storage
$rpc_py bdev_ocf_create ocfWT wt aio0 aio1
# Check that ocfWT was created properly
$rpc_py bdev_ocf_get_bdevs | jq -r '.[] .name' | grep -qw ocfWT
# Remove ocfWT, after delete via rpc ocf bdev should not load on next app start
$rpc_py bdev_ocf_delete ocfWT
# Check that ocfWT was deleted properly
[[ -z $("$rpc_py" bdev_ocf_get_bdevs | jq -r '.[] | select(.name == "ocfWT") | .name') ]]
trap - SIGINT SIGTERM EXIT
killprocess $spdk_pid
# Check for ocfWT was deleted permanently
"$SPDK_BIN_DIR/iscsi_tgt" --json "$curdir/config" &
spdk_pid=$!
trap 'killprocess $spdk_pid; rm -f aio* $curdir/config ocf_bdevs ocf_bdevs_verify; exit 1' SIGINT SIGTERM EXIT
waitforlisten $spdk_pid
# Check that ocfWT was not loaded on app start
[[ -z $("$rpc_py" bdev_ocf_get_bdevs | jq -r '.[] | select(name == "ocfWT") | .name') ]]
trap - SIGINT SIGTERM EXIT
killprocess $spdk_pid
rm -f aio* $curdir/config ocf_bdevs ocf_bdevs_verify