numam-spdk/test/vhost/hotplug/scsi_hotattach.sh
Pawel Kaminski 598ba73f5f test/vhost: Add tests for hot-attach and hot-detach features.
Test plan for hot-attach and hot-detach included.
File with CPU core masks for vhost and qemu updated because more
than one virtual machine is needed to run the tests.

Change-Id: I6ba02f65398d09e2ef3335c2d5b0d6c04d3e393c
Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-on: https://review.gerrithub.io/372268
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-10-17 13:37:09 -04:00

96 lines
2.6 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
BASE_DIR=$(readlink -f $(dirname $0))
[[ -z "$TEST_DIR" ]] && TEST_DIR="$(cd $BASE_DIR/../../../../ && pwd)"
. $BASE_DIR/common.sh
function prepare_fio_cmd_tc1() {
print_test_fio_header
run_fio="$fio_bin --eta=never "
for vm_num in $1; do
cp $fio_job $tmp_attach_job
vm_dir=$VM_BASE_DIR/$vm_num
vm_check_scsi_location $vm_num
for disk in $SCSI_DISK; do
echo "[nvme-host$disk]" >> $tmp_attach_job
echo "filename=/dev/$disk" >> $tmp_attach_job
done
vm_scp $vm_num $tmp_attach_job 127.0.0.1:/root/default_integrity_discs.job
run_fio+="--client=127.0.0.1,$(vm_fio_socket ${vm_num}) --remote-config /root/default_integrity_discs.job "
rm $tmp_attach_job
done
}
# Check if fio test passes on device attached to first controller.
function hotattach_tc1() {
echo "Hotattach test case 1"
$rpc_py add_vhost_scsi_lun naa.Nvme0n1p0.0 0 Nvme0n1p0
sleep 3
prepare_fio_cmd_tc1 "0"
$run_fio
check_fio_retcode "Hotattach test case 1: Iteration 1." 0 $?
}
# Run fio test for previously attached device.
# During test attach another device to first controller and check fio status.
function hotattach_tc2() {
echo "Hotattach test case 2"
prepare_fio_cmd_tc1 "0"
$run_fio &
last_pid=$!
sleep 3
$rpc_py add_vhost_scsi_lun naa.Nvme0n1p0.0 1 Nvme0n1p1
wait $last_pid
check_fio_retcode "Hotattach test case 2: Iteration 1." 0 $?
}
# Run fio test for previously attached devices.
# During test attach another device to second controller and check fio status.
function hotattach_tc3() {
echo "Hotattach test case 3"
prepare_fio_cmd_tc1 "0"
$run_fio &
last_pid=$!
sleep 3
$rpc_py add_vhost_scsi_lun naa.Nvme0n1p1.0 0 Nvme0n1p2
wait $last_pid
check_fio_retcode "Hotattach test case 3: Iteration 1." 0 $?
}
# Run fio test for previously attached devices.
# During test attach another device to third controller(VM2) and check fio status.
# At the end after rebooting VMs run fio test for all devices and check fio status.
function hotattach_tc4() {
echo "Hotattach test case 4"
prepare_fio_cmd_tc1 "0"
$run_fio &
last_pid=$!
sleep 3
$rpc_py add_vhost_scsi_lun naa.Nvme0n1p2.1 0 Nvme0n1p3
wait $last_pid
check_fio_retcode "Hotattach test case 4: Iteration 1." 0 $?
prepare_fio_cmd_tc1 "0 1"
$run_fio
check_fio_retcode "Hotattach test case 4: Iteration 2." 0 $?
reboot_all_and_prepare "0 1"
prepare_fio_cmd_tc1 "0 1"
$run_fio
check_fio_retcode "Hotattach test case 4: Iteration 3." 0 $?
}
hotattach_tc1
hotattach_tc2
hotattach_tc3
hotattach_tc4