test/vhost: update filesystem integrity test
Updates for running with vhost-blk. Removed checking & cloning Qemu sources - should be already installed in working directory. Some other minor fixes for typos. Change-Id: Ifd790a301c8ca1e19434f03ba32f5eb916dbe0a6 Signed-off-by: Karol Latecki <karol.latecki@intel.com> Reviewed-on: https://review.gerrithub.io/373897 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
de191b8fb1
commit
bab64051de
@ -63,6 +63,6 @@
|
||||
<qemu:arg value='-chardev'/>
|
||||
<qemu:arg value='socket,id=char0,path=/tmp/naa.0'/>
|
||||
<qemu:arg value='-device'/>
|
||||
<qemu:arg value='vhost-user-scsi-pci,id=scsi0,chardev=char0'/>
|
||||
<qemu:arg value='vhost_dev_args,chardev=char0'/>
|
||||
</qemu:commandline>
|
||||
</domain>
|
||||
|
@ -1,30 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -xe
|
||||
|
||||
basedir=$(readlink -f $(dirname $0))
|
||||
rootdir=$(readlink -f $basedir/../../..)
|
||||
testdir=$(readlink -f $rootdir/..)
|
||||
qemu_src_dir="$testdir/qemu"
|
||||
qemu_build_dir="$testdir/qemu/build"
|
||||
qemu_install_dir="$testdir/root"
|
||||
MAKE="make -j$(( $(nproc) * 2 ))"
|
||||
|
||||
source $rootdir/scripts/autotest_common.sh
|
||||
|
||||
if [ -z "$VM_IMG" ]; then
|
||||
echo "ERROR: VM_IMG: path to qcow2 image not provided - not running"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$VM_QEMU" ]; then
|
||||
echo "INFO: VM_QEMU: path to qemu binary not provided"
|
||||
echo "INFO: Will use qemu from repository"
|
||||
fi
|
||||
|
||||
if [ -z "$VM_FS" ]; then
|
||||
VM_FS="ext4"
|
||||
echo "INFO: Using default value for filesystem: $VM_FS"
|
||||
fi
|
||||
|
||||
rpc_py="python $rootdir/scripts/rpc.py "
|
||||
rpc_py+="-s 127.0.0.1 "
|
||||
RPC_PORT=5260
|
||||
HOST_IP=192.200.200.1
|
||||
VM_IP=192.200.200.254
|
||||
VM_UNAME="root"
|
||||
@ -37,48 +23,64 @@ TIMEO=60
|
||||
SSHCMD="sshpass -p $VM_PASS ssh"
|
||||
SCPCMD="sshpass -p $VM_PASS scp"
|
||||
|
||||
echo "FS: $VM_FS"
|
||||
while getopts 'i:m:f:' optchar; do
|
||||
case $optchar in
|
||||
i) VM_IMG="${OPTARG#*=}" ;;
|
||||
m) VHOST_MODE="${OPTARG#*=}" ;;
|
||||
f) VM_FS="${OPTARG#*=}" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
source $rootdir/scripts/autotest_common.sh
|
||||
|
||||
if [ -z "$VM_IMG" ]; then
|
||||
echo "ERROR: VM_IMG: path to qcow2 image not provided - not running"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$VHOST_MODE" ]; then
|
||||
echo "ERROR: VHOST_MODE: please specify Vhost mode - scsi or blk"
|
||||
fi
|
||||
|
||||
if [ -z "$VM_FS" ]; then
|
||||
VM_FS="ext4"
|
||||
echo "INFO: Using default value for filesystem: $VM_FS"
|
||||
fi
|
||||
|
||||
# Check if Qemu binary is present
|
||||
if [[ -z $VM_QEMU ]]; then
|
||||
VM_QEMU="$qemu_install_dir/bin/qemu-system-x86_64"
|
||||
fi
|
||||
|
||||
if [[ ! -x $VM_QEMU ]]; then
|
||||
echo "ERROR: QEMU binary not present in $VM_QEMU"
|
||||
fi
|
||||
|
||||
echo "Running test with filesystem: $VM_FS"
|
||||
|
||||
function cleanup_virsh() {
|
||||
virsh shutdown $VM_NAME || true
|
||||
sleep 5
|
||||
virsh net-destroy $VM_NET_NAME || true
|
||||
if virsh domstate $VM_NAME; then
|
||||
virsh shutdown $VM_NAME
|
||||
for timeo in `seq 0 10`; do
|
||||
if ! virsh domstate $VM_NAME; then
|
||||
break
|
||||
fi
|
||||
if [[ $timeo -eq 10 ]]; then
|
||||
echo "ERROR: VM did not shutdown, killing!"
|
||||
virsh destroy $VM_NAME
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
fi
|
||||
|
||||
if virsh net-info $VM_NET_NAME; then
|
||||
virsh net-destroy $VM_NET_NAME
|
||||
fi
|
||||
rm $VM_BAK_IMG || true
|
||||
}
|
||||
|
||||
timing_enter integrity_test
|
||||
|
||||
# If no VM_QEMU argument is given - check if needed qemu is installed
|
||||
echo "INFO: Checking qemu..."
|
||||
if [[ ! -d $qemu_src_dir && -z "$VM_QEMU" ]]; then
|
||||
echo "INFO: Cloning $qemu_src_dir"
|
||||
rm -rf $qemu_src_dir
|
||||
mkdir -p $qemu_src_dir
|
||||
cd $(dirname $qemu_src_dir)
|
||||
git clone -b dev/vhost_scsi ssh://az-sg-sw01.ch.intel.com:29418/qemu
|
||||
echo "INFO: Cloning Qemu Done"
|
||||
else
|
||||
echo "INFO: Qemu source exist $qemu_src_dir - not cloning"
|
||||
fi
|
||||
|
||||
# Check if Qemu binary is present; build it if not
|
||||
if [[ ! -x $qemu_install_dir/bin/qemu-system-x86_64 && -z "$VM_QEMU" ]]; then
|
||||
echo "INFO: Can't find $qemu_install_dir/bin/qemu-system-x86_64 - building and installing"
|
||||
mkdir -p $qemu_build_dir
|
||||
cd $qemu_build_dir
|
||||
|
||||
$qemu_src_dir/configure --prefix=$qemu_install_dir \
|
||||
--target-list="x86_64-softmmu" \
|
||||
--enable-kvm --enable-linux-aio --enable-numa
|
||||
|
||||
echo "INFO: Compiling and installing QEMU in $qemu_install_dir"
|
||||
$MAKE install
|
||||
VM_QEMU="$qemu_install_dir/bin/qemu-system-x86_64"
|
||||
echo "INFO: DONE"
|
||||
elif [[ -z "$VM_QEMU" ]]; then
|
||||
VM_QEMU="$qemu_install_dir/bin/qemu-system-x86_64"
|
||||
fi
|
||||
|
||||
# Backing image for VM
|
||||
qemu-img create -f qcow2 -o backing_file=$VM_IMG $VM_BAK_IMG
|
||||
|
||||
@ -95,6 +97,11 @@ sed -i "s@<emulator></emulator>@<emulator>$VM_QEMU</emulator>@g" $basedir/vm_con
|
||||
sed -i "s@mac address=''@mac address='$VM_MAC'@g" $basedir/vm_conf.xml
|
||||
sed -i "s@source network=''@source network='$VM_NET_NAME'@g" $basedir/vm_conf.xml
|
||||
sed -i "s@<name></name>@<name>$VM_NET_NAME</name>@g" $basedir/vnet_conf.xml
|
||||
if [[ "$VHOST_MODE" == "scsi" ]]; then
|
||||
sed -i "s@vhost_dev_args@vhost-user-scsi-pci,id=scsi0@g" $basedir/vm_conf.xml
|
||||
else
|
||||
sed -i "s@vhost_dev_args@vhost-user-blk-pci,size=30G,logical_block_size=4096@g" $basedir/vm_conf.xml
|
||||
fi
|
||||
|
||||
trap "cleanup_virsh; killprocess $pid; exit 1" SIGINT SIGTERM EXIT
|
||||
|
||||
@ -106,34 +113,31 @@ cd /tmp
|
||||
$rootdir/app/vhost/vhost -c $basedir/vhost.conf &
|
||||
pid=$!
|
||||
echo "Process pid: $pid"
|
||||
sleep 10
|
||||
waitforlisten "$pid" "$RPC_PORT"
|
||||
if [[ "$VHOST_MODE" == "scsi" ]]; then
|
||||
$rpc_py construct_vhost_scsi_controller naa.0
|
||||
$rpc_py add_vhost_scsi_lun naa.0 0 Nvme0n1
|
||||
else
|
||||
$rpc_py construct_vhost_blk_controller naa.0 Nvme0n1
|
||||
fi
|
||||
chmod 777 /tmp/naa.0
|
||||
|
||||
virsh create $basedir/vm_conf.xml
|
||||
virsh net-update $VM_NET_NAME add ip-dhcp-host "<host mac='$VM_MAC' name='$VM_NAME' ip='$VM_IP'/>"
|
||||
|
||||
# Wait for VM to boot, disable trap temporarily
|
||||
# so that we don't exit on first fail
|
||||
# Wait for VM to boot
|
||||
echo "INFO: Trying to connect to virtual machine..."
|
||||
trap - SIGINT SIGTERM EXIT
|
||||
set +xe
|
||||
rc=-1
|
||||
while [[ $TIMEO -gt 0 && rc -ne 0 ]]; do
|
||||
$SSHCMD root@$VM_IP -q -oStrictHostKeyChecking=no 'echo Hello'
|
||||
rc=$?
|
||||
((TIMEO-=1))
|
||||
while ! $SSHCMD root@$VM_IP -q -oStrictHostKeyChecking=no 'echo Hello'; do
|
||||
sleep 1
|
||||
if ! (( TIMEO-=1 ));then
|
||||
echo "ERROR: VM did not boot properly, exiting"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
set -xe
|
||||
trap "cleanup_virsh; killprocess $pid; exit 1" SIGINT SIGTERM EXIT
|
||||
|
||||
if [[ $TIMEO -eq 0 || rc -ne 0 ]]; then
|
||||
echo "ERROR: VM did not boot properly, exiting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run test on Virtual Machine
|
||||
$SCPCMD -r $basedir/integrity_vm.sh root@$VM_IP:~
|
||||
$SSHCMD root@$VM_IP "fs=$VM_FS ~/integrity_vm.sh"
|
||||
$SSHCMD root@$VM_IP "fs=$VM_FS ~/integrity_vm.sh $VHOST_MODE"
|
||||
|
||||
# Kill VM, cleanup config files
|
||||
cleanup_virsh
|
||||
|
@ -4,16 +4,16 @@ set -xe
|
||||
basedir=$(readlink -f $(dirname $0))
|
||||
MAKE="make -j$(( $(nproc) * 2 ))"
|
||||
|
||||
script='shopt -s nullglob; \
|
||||
for entry in /sys/block/sd*; do \
|
||||
disk_type="$(cat $entry/device/vendor)"; \
|
||||
if [[ $disk_type == INTEL* ]] || [[ $disk_type == RAWSCSI* ]] || [[ $disk_type == LIO-ORG* ]]; then \
|
||||
fname=$(basename $entry); \
|
||||
echo -n "$fname "; \
|
||||
fi; \
|
||||
done'
|
||||
|
||||
devs="$(echo "$script" | bash -s)"
|
||||
if [[ $1 == "scsi" ]]; then
|
||||
devs=""
|
||||
for entry in /sys/block/sd*; do
|
||||
if grep -Eq '(INTEL|RAWSCSI|LIO-ORG)' $entry/device/vendor; then
|
||||
devs+="$(basename $entry)"
|
||||
fi
|
||||
done
|
||||
else script=$blk_script;
|
||||
devs=$(cd /sys/block; echo vd*)
|
||||
fi
|
||||
|
||||
trap "exit 1" SIGINT SIGTERM EXIT
|
||||
for dev in $devs; do
|
||||
@ -31,12 +31,12 @@ for dev in $devs; do
|
||||
|
||||
echo "INFO: Creating partition table on disk using: $parted_cmd mklabel gpt"
|
||||
$parted_cmd mklabel gpt
|
||||
$parted_cmd mkpart primary $fs 0% 100%
|
||||
$parted_cmd mkpart primary 2048s 100%
|
||||
sleep 2
|
||||
|
||||
mkfs_cmd+=" /dev/${dev}1"
|
||||
mkfs_cmd+=" /dev/${dev}1"
|
||||
echo "INFO: Creating filesystem using: $mkfs_cmd"
|
||||
$mkfscmd
|
||||
$mkfs_cmd
|
||||
|
||||
mkdir -p /mnt/${dev}dir
|
||||
mount -o sync /dev/${dev}1 /mnt/${dev}dir
|
||||
@ -47,8 +47,7 @@ for dev in $devs; do
|
||||
# Now build SPDK
|
||||
$MAKE -C /mnt/${dev}dir/linux-src defconfig
|
||||
$MAKE -C /mnt/${dev}dir/linux-src
|
||||
# Print out space consumed on target device to help decide
|
||||
# if/when we need to increase the size of the malloc LUN
|
||||
# Print out space consumed on target device
|
||||
df -h /dev/$dev
|
||||
rm -rf /mnt/${dev}dir/linux-src
|
||||
done
|
||||
|
@ -5,7 +5,3 @@
|
||||
|
||||
[Ioat]
|
||||
Disable Yes
|
||||
|
||||
[VhostScsi0]
|
||||
Name naa.0
|
||||
Dev 1 Nvme0n1
|
||||
|
@ -49,17 +49,22 @@ case $param in
|
||||
--fio-jobs=$WORKDIR/fiotest/fio_jobs/default_integrity.job \
|
||||
--qemu-src=/home/sys_sgsw/vhost/qemu -x
|
||||
;;
|
||||
-f|--fs-integrity)
|
||||
-fs|--fs-integrity-scsi)
|
||||
echo Running filesystem integrity suite...
|
||||
VM_IMG=/home/sys_sgsw/vhost_scsi_vm_image.qcow2 ./integrity/integrity_start.sh
|
||||
./integrity/integrity_start.sh -i /home/sys_sgsw/vhost_vm_image.qcow2 -m scsi -f ntfs
|
||||
;;
|
||||
-fb|--fs-integrity-blk)
|
||||
echo Running filesystem integrity suite...
|
||||
./integrity/integrity_start.sh -i /home/sys_sgsw/vhost_vm_image.qcow2 -m blk -f ntfs
|
||||
;;
|
||||
-h|--help)
|
||||
echo "-i|--integrity for running an integrity test with vhost scsi"
|
||||
echo "-f|--fs-integrity for running an integrity test with filesystem"
|
||||
echo "-p|--performance for running a performance test with vhost scsi"
|
||||
echo "-ib|--integrity-blk for running an integrity test with vhost blk"
|
||||
echo "-pb|--performance-blk for running a performance test with vhost blk"
|
||||
echo "-h|--help prints this message"
|
||||
echo "-i |--integrity for running an integrity test with vhost scsi"
|
||||
echo "-fs|--fs-integrity-scsi for running an integrity test with filesystem"
|
||||
echo "-fb|--fs-integrity-blk for running an integrity test with filesystem"
|
||||
echo "-p |--performance for running a performance test with vhost scsi"
|
||||
echo "-ib|--integrity-blk for running an integrity test with vhost blk"
|
||||
echo "-pb|--performance-blk for running a performance test with vhost blk"
|
||||
echo "-h |--help prints this message"
|
||||
;;
|
||||
*)
|
||||
echo "unknown test type"
|
||||
|
Loading…
Reference in New Issue
Block a user