Spdk/test/ocf/management/multicore.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

86 lines
1.8 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
spdk_pid='?'
function start_spdk() {
$SPDK_BIN_DIR/iscsi_tgt &
spdk_pid=$!
trap 'killprocess $spdk_pid; exit 1' SIGINT SIGTERM EXIT
waitforlisten $spdk_pid
}
function stop_spdk() {
killprocess $spdk_pid
trap - SIGINT SIGTERM EXIT
}
start_spdk
# Hotplug case
$rpc_py bdev_malloc_create 1 512 -b Core0
$rpc_py bdev_malloc_create 1 512 -b Core1
$rpc_py bdev_ocf_create C1 wt Cache Core0
$rpc_py bdev_ocf_create C2 wt Cache Core1
$rpc_py bdev_ocf_get_bdevs | jq -e \
'any(select(.started)) == false'
$rpc_py bdev_malloc_create 101 512 -b Cache
$rpc_py bdev_ocf_get_bdevs | jq -e \
'all(select(.started)) == true'
#Be sure that we will not fail delete because examine is still in progress
waitforbdev C2
# Detaching cores
$rpc_py bdev_ocf_delete C2
$rpc_py bdev_ocf_get_bdevs C1 | jq -e \
'.[0] | .started'
$rpc_py bdev_ocf_create C2 wt Cache Core1
$rpc_py bdev_ocf_get_bdevs C2 | jq -e \
'.[0] | .started'
# Normal shutdown
stop_spdk
# Hotremove case
start_spdk
$rpc_py bdev_malloc_create 101 512 -b Cache
$rpc_py bdev_malloc_create 101 512 -b Malloc
$rpc_py bdev_malloc_create 1 512 -b Core
$rpc_py bdev_ocf_create C1 wt Cache Malloc
$rpc_py bdev_ocf_create C2 wt Cache Core
$rpc_py bdev_ocf_get_bdevs Cache | jq \
'length == 2'
$rpc_py bdev_malloc_delete Cache
$rpc_py bdev_ocf_get_bdevs | jq -e \
'. == []'
# Not fully initialized shutdown
$rpc_py bdev_ocf_create C1 wt Malloc NonExisting
$rpc_py bdev_ocf_create C2 wt Malloc NonExisting
$rpc_py bdev_ocf_create C3 wt Malloc Core
stop_spdk