diff --git a/test/vhost/ext4test/ext4start.sh b/test/vhost/ext4test/ext4start.sh
deleted file mode 100755
index 299c401b6..000000000
--- a/test/vhost/ext4test/ext4start.sh
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/usr/bin/env bash
-
-testdir=$(readlink -f $(dirname $0))
-rootdir=$testdir/../../..
-source $rootdir/scripts/autotest_common.sh
-
-if [ -z "$VM_IMG" ]; then
- echo "VM_IMG: path to qcow2 image not provided - not running"
- exit 1
-fi
-
-if [ -z "$VM_QEMU" ]; then
- echo "VM_QEMU: path to qemu binary not provided - not running"
- exit 1
-fi
-
-HOST_IP=192.168.122.1
-VM_IP=192.168.122.254
-VM_UNAME="root"
-VM_PASS="root"
-VM_NAME="ext4test_vm"
-VM_NET_NAME="test_net"
-VM_MAC="02:de:ad:de:ad:01"
-VM_BAK_IMG="/tmp/ext4test_backing.img"
-TIMEO=60
-SSHCMD="sshpass -p $VM_PASS ssh"
-SCPCMD="sshpass -p $VM_PASS scp"
-
-function cleanup_virsh() {
- virsh destroy $VM_NAME
- virsh net-destroy $VM_NET_NAME
- rm $VM_BAK_IMG
-}
-
-timing_enter ext4test
-
-qemu-img create -f qcow2 -o backing_file=$VM_IMG $VM_BAK_IMG
-
-cp $testdir/spdk_vm_base.xml $testdir/spdk_vm.xml
-cp $testdir/spdk_vnet_base.xml $testdir/spdk_vnet.xml
-
-cp $testdir/vhost.conf.in $testdir/vhost.conf
-$rootdir/scripts/gen_nvme.sh >> $testdir/vhost.conf
-
-sed -i "s@@$VM_NAME@g" $testdir/spdk_vm.xml
-sed -i "s@source file=''@source file='$VM_BAK_IMG'@g" $testdir/spdk_vm.xml
-sed -i "s@@$VM_QEMU@g" $testdir/spdk_vm.xml
-sed -i "s@@$VM_NET_NAME@g" $testdir/spdk_vnet.xml
-
-trap "cleanup_virsh; killprocess $pid; exit 1" SIGINT SIGTERM EXIT
-
-virsh net-create $testdir/spdk_vnet.xml
-
-# Change directory and ownership because virsh has issues with
-# paths that are in /root tree
-cd /tmp
-$rootdir/app/vhost/vhost -c $testdir/vhost.conf &
-pid=$!
-echo "Process pid: $pid"
-sleep 10
-chmod 777 /tmp/naa.123
-
-tar --exclude '.git' --exclude 'spdk.tgz' --exclude '*.d' --exclude '*.o' -zcf /tmp/spdk_host.tgz $rootdir
-
-virsh create $testdir/spdk_vm.xml
-virsh net-update $VM_NET_NAME add ip-dhcp-host ""
-
-# Wait for VM to boot, disable trap temporarily
-# so that we don't exit on first fail
-echo "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))
-done
-set -xe
-trap "cleanup_virsh; killprocess $pid; exit 1" SIGINT SIGTERM EXIT
-
-if [[ $TIMEO -eq 0 || rc -ne 0 ]]; then
- echo "VM did not boot properly, exiting"
- exit 1
-fi
-
-$SSHCMD root@$VM_IP 'mkdir -p /tmp/spdk'
-$SCPCMD -r /tmp/spdk_host.tgz root@$VM_IP:/tmp/spdk
-$SSHCMD root@$VM_IP 'cd /tmp/spdk; tar xf spdk_host.tgz'
-$SSHCMD root@$VM_IP '/tmp/spdk/test/vhost/ext4test/ext4connect.sh'
-
-#read -p "Hit enter to exit..."
-
-trap - SIGINT SIGTERM EXIT
-
-cleanup_virsh
-rm $testdir/spdk_vm.xml
-rm $testdir/spdk_vnet.xml
-rm $testdir/vhost.conf
-killprocess $pid
-timing_exit ext4test
diff --git a/test/vhost/ext4test/spdk_vnet_base.xml b/test/vhost/ext4test/spdk_vnet_base.xml
deleted file mode 100644
index 53863f1cb..000000000
--- a/test/vhost/ext4test/spdk_vnet_base.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/test/vhost/integrity/base_vm.xml b/test/vhost/integrity/base_vm.xml
new file mode 100644
index 000000000..494b7c96a
--- /dev/null
+++ b/test/vhost/integrity/base_vm.xml
@@ -0,0 +1,68 @@
+
+
+ 4
+ 4
+ 8
+
+ hvm
+
+
+
+
+
+
+
+
+
+
+
+ destroy
+ restart
+ destroy
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/vhost/integrity/base_vnet.xml b/test/vhost/integrity/base_vnet.xml
new file mode 100644
index 000000000..08324dcb2
--- /dev/null
+++ b/test/vhost/integrity/base_vnet.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/test/vhost/integrity/integrity_start.sh b/test/vhost/integrity/integrity_start.sh
new file mode 100755
index 000000000..0bcde0909
--- /dev/null
+++ b/test/vhost/integrity/integrity_start.sh
@@ -0,0 +1,158 @@
+#!/usr/bin/env bash
+
+basedir=$(readlink -f $(dirname $0))
+rootdir=$basedir/../../..
+testdir=$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
+
+HOST_IP=192.200.200.1
+VM_IP=192.200.200.254
+VM_UNAME="root"
+VM_PASS="root"
+VM_NAME="int_test_vm"
+VM_NET_NAME="int_test_net"
+VM_MAC="02:de:ad:de:ad:01"
+VM_BAK_IMG="/tmp/int_test_backing.img"
+TIMEO=60
+SSHCMD="sshpass -p $VM_PASS ssh"
+SCPCMD="sshpass -p $VM_PASS scp"
+
+echo "FS: $VM_FS"
+
+function cleanup_virsh() {
+ virsh shutdown $VM_NAME || true
+ sleep 5
+ virsh net-destroy $VM_NET_NAME || true
+ 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
+
+# Prepare vhost config
+cp $basedir/vhost.conf.in $basedir/vhost.conf
+$rootdir/scripts/gen_nvme.sh >> $basedir/vhost.conf
+
+# Prepare .xml files for Virsh
+cp $basedir/base_vm.xml $basedir/vm_conf.xml
+cp $basedir/base_vnet.xml $basedir/vnet_conf.xml
+sed -i "s@@$VM_NAME@g" $basedir/vm_conf.xml
+sed -i "s@source file=''@source file='$VM_BAK_IMG'@g" $basedir/vm_conf.xml
+sed -i "s@@$VM_QEMU@g" $basedir/vm_conf.xml
+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@@$VM_NET_NAME@g" $basedir/vnet_conf.xml
+
+trap "cleanup_virsh; killprocess $pid; exit 1" SIGINT SIGTERM EXIT
+
+virsh net-create $basedir/vnet_conf.xml
+
+# Change directory and ownership because virsh has issues with
+# paths that are in /root tree
+cd /tmp
+$rootdir/app/vhost/vhost -c $basedir/vhost.conf &
+pid=$!
+echo "Process pid: $pid"
+sleep 10
+chmod 777 /tmp/naa.0
+
+virsh create $basedir/vm_conf.xml
+virsh net-update $VM_NET_NAME add ip-dhcp-host ""
+
+# Wait for VM to boot, disable trap temporarily
+# so that we don't exit on first fail
+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))
+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"
+
+# Kill VM, cleanup config files
+cleanup_virsh
+rm $basedir/vm_conf.xml || true
+rm $basedir/vnet_conf.xml || true
+rm $basedir/vhost.conf || true
+
+# Try to gracefully stop spdk vhost
+if /bin/kill -INT $pid; then
+ while /bin/kill -0 $pid; do
+ sleep 1
+ done
+elif /bin/kill -0 $pid; then
+ killprocess $pid
+ echo "ERROR: Vhost was not closed gracefully..."
+ exit 1
+else
+ exit 1
+fi
+
+trap - SIGINT SIGTERM EXIT
+timing_exit integrity_test
diff --git a/test/vhost/ext4test/ext4connect.sh b/test/vhost/integrity/integrity_vm.sh
similarity index 53%
rename from test/vhost/ext4test/ext4connect.sh
rename to test/vhost/integrity/integrity_vm.sh
index 6c0980d47..27eea6fff 100755
--- a/test/vhost/ext4test/ext4connect.sh
+++ b/test/vhost/integrity/integrity_vm.sh
@@ -1,13 +1,13 @@
#!/usr/bin/env bash
+set -xe
-testdir=$(readlink -f $(dirname $0))
-rootdir=$testdir/../../..
-source $rootdir/scripts/autotest_common.sh
+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 \
+ if [[ $disk_type == INTEL* ]] || [[ $disk_type == RAWSCSI* ]] || [[ $disk_type == LIO-ORG* ]]; then \
fname=$(basename $entry); \
echo -n "$fname "; \
fi; \
@@ -15,23 +15,42 @@ script='shopt -s nullglob; \
devs="$(echo "$script" | bash -s)"
-timing_enter ext4test
-
trap "exit 1" SIGINT SIGTERM EXIT
-
for dev in $devs; do
- mkfs.ext4 -F /dev/$dev
- mkdir -p /mnt/${dev}dir
- mount -o sync /dev/$dev /mnt/${dev}dir
- rsync -qav --exclude=".git" $rootdir/ /mnt/${dev}dir/spdk
- sleep 2
- make -C /mnt/${dev}dir/spdk -j8 clean
- make -C /mnt/${dev}dir/spdk -j8
+ mkfs_cmd="mkfs.$fs"
+ parted_cmd="parted -s /dev/${dev}"
+ if [ "ntfs" == $fs ]; then
+ mkfs_cmd+=" -f -F"
+ elif [ "btrfs" == $fs ]; then
+ mkfs_cmd+=" -f"
+ elif [ "fat" == $fs ]; then
+ mkfs_cmd+=" -I"
+ else
+ mkfs_cmd+=" -F"
+ fi
+ echo "INFO: Creating partition table on disk using: $parted_cmd mklabel gpt"
+ $parted_cmd mklabel gpt
+ $parted_cmd mkpart primary $fs 0% 100%
+ sleep 2
+
+ mkfs_cmd+=" /dev/${dev}1"
+ echo "INFO: Creating filesystem using: $mkfs_cmd"
+ $mkfscmd
+
+ mkdir -p /mnt/${dev}dir
+ mount -o sync /dev/${dev}1 /mnt/${dev}dir
+ mkdir -p /mnt/${dev}dir/linux-src
+ tar xf $basedir/linux-src.tar.gz -C /mnt/${dev}dir/linux-src --strip-components=1
+ sleep 2
+
+ # 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
df -h /dev/$dev
- rm -rf /mnt/${dev}dir/spdk
+ rm -rf /mnt/${dev}dir/linux-src
done
for dev in $devs; do
@@ -51,5 +70,3 @@ for dev in $devs; do
done
trap - SIGINT SIGTERM EXIT
-
-timing_exit ext4test
diff --git a/test/vhost/ext4test/vhost.conf.in b/test/vhost/integrity/vhost.conf.in
similarity index 91%
rename from test/vhost/ext4test/vhost.conf.in
rename to test/vhost/integrity/vhost.conf.in
index 0adaf61d8..039bfe102 100644
--- a/test/vhost/ext4test/vhost.conf.in
+++ b/test/vhost/integrity/vhost.conf.in
@@ -34,11 +34,6 @@
[Ioat]
Disable Yes
-[Malloc]
- NumberOfLuns 1
- LunSizeInMb 512
-
- [VhostScsi0]
- Name naa.123
- Dev 0 Nvme0n1
- Dev 1 Malloc0
+[VhostScsi0]
+ Name naa.0
+ Dev 1 Nvme0n1
diff --git a/test/vhost/spdk_vhost.sh b/test/vhost/spdk_vhost.sh
index 634600920..c685e9fbc 100755
--- a/test/vhost/spdk_vhost.sh
+++ b/test/vhost/spdk_vhost.sh
@@ -34,8 +34,13 @@ case $param in
--fio-jobs=$WORKDIR/fiotest/fio_jobs/default_integrity.job \
--qemu-src=/home/sys_sgsw/vhost/qemu
;;
+ -f|--fs-integrity)
+ echo Running filesystem integrity suite...
+ VM_IMG=/home/sys_sgsw/vhost_scsi_vm_image.qcow2 ./integrity/integrity_start.sh
+ ;;
-h|--help)
echo "-i|--integrity for running an integrity test"
+ echo "-f|--fs-integrity for running an integrity test with filesystem"
echo "-p|--performance for running a performance test"
echo "-h|--help prints this message"
;;