diff --git a/autotest.sh b/autotest.sh index 533dc8bca..20b35fe02 100755 --- a/autotest.sh +++ b/autotest.sh @@ -147,6 +147,14 @@ if [ $SPDK_TEST_VHOST -eq 1 ]; then timing_enter readonly run_test ./test/vhost/spdk_vhost.sh --readonly timing_exit readonly + + timing_enter fs_integrity_scsi + run_test ./test/vhost/spdk_vhost.sh --fs-integrity-scsi + timing_exit fs_integrity_scsi + + timing_enter fs_integrity_blk + run_test ./test/vhost/spdk_vhost.sh --fs-integrity-blk + timing_exit fs_integrity_blk fi timing_enter integrity_lvol_scsi diff --git a/test/vhost/integrity/integrity_start.sh b/test/vhost/integrity/integrity_start.sh index 150125e32..2c29f51ed 100755 --- a/test/vhost/integrity/integrity_start.sh +++ b/test/vhost/integrity/integrity_start.sh @@ -77,6 +77,16 @@ function cleanup_virsh() { rm $VM_BAK_IMG || true } +function cleanup_lvol() { + echo "INFO: Removing lvol bdevs" + $rpc_py delete_bdev $lb_name + echo -e "\tINFO: lvol bdev $lb_name removed" + + echo "INFO: Removing lvol stores" + $rpc_py destroy_lvol_store -u $lvol_store + echo -e "\tINFO: lvol stote $lvol_store removed" +} + timing_enter integrity_test # Backing image for VM @@ -112,12 +122,20 @@ $rootdir/app/vhost/vhost -c $basedir/vhost.conf & pid=$! echo "Process pid: $pid" waitforlisten "$pid" + +lvol_store=$($rpc_py construct_lvol_store Nvme0n1 lvs_0) +free_mb=$(get_lvs_free_mb "$lvol_store") +lb_name=$($rpc_py construct_lvol_bdev -u $lvol_store lbd_0 $free_mb) + if [[ "$VHOST_MODE" == "scsi" ]]; then $rpc_py construct_vhost_scsi_controller naa.0 - $rpc_py add_vhost_scsi_lun naa.0 0 Nvme0n1 + $rpc_py add_vhost_scsi_lun naa.0 0 $lb_name else - $rpc_py construct_vhost_blk_controller naa.0 Nvme0n1 + $rpc_py construct_vhost_blk_controller naa.0 $lb_name fi + +trap "cleanup_lvol; cleanup_virsh; killprocess $pid; exit 1" SIGINT SIGTERM EXIT ERR + chmod 777 /tmp/naa.0 virsh create $basedir/vm_conf.xml @@ -143,6 +161,9 @@ rm $basedir/vm_conf.xml || true rm $basedir/vnet_conf.xml || true rm $basedir/vhost.conf || true +# Delete lvol bdev, destroy lvol store +cleanup_lvol + # Try to gracefully stop spdk vhost if /bin/kill -INT $pid; then while /bin/kill -0 $pid; do diff --git a/test/vhost/integrity/integrity_vm.sh b/test/vhost/integrity/integrity_vm.sh index 504a2fa60..041ff5f32 100755 --- a/test/vhost/integrity/integrity_vm.sh +++ b/test/vhost/integrity/integrity_vm.sh @@ -16,56 +16,51 @@ else script=$blk_script; fi trap "exit 1" SIGINT SIGTERM EXIT -for dev in $devs; do - 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 2048s 100% - sleep 2 +for fs in $fs; do + for dev in $devs; do + mkfs_cmd="mkfs.$fs" + parted_cmd="parted -s /dev/${dev}" - mkfs_cmd+=" /dev/${dev}1" - echo "INFO: Creating filesystem using: $mkfs_cmd" - $mkfs_cmd + echo "INFO: Creating partition table on disk using: $parted_cmd mklabel gpt" + $parted_cmd mklabel gpt + $parted_cmd mkpart primary 2048s 100% + sleep 2 - 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 + mkfs_cmd+=" /dev/${dev}1" + echo "INFO: Creating filesystem using: $mkfs_cmd" + wipefs -a /dev/${dev}1 + $mkfs_cmd - # 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 - df -h /dev/$dev - rm -rf /mnt/${dev}dir/linux-src -done + 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 -for dev in $devs; do - umount /mnt/${dev}dir - rm -rf /mnt/${dev}dir + # 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 + df -h /dev/$dev + rm -rf /mnt/${dev}dir/linux-src + done - stats=( $(cat /sys/block/$dev/stat) ) - echo "" - echo "$dev stats" - printf "READ IO cnt: % 8u merges: % 8u sectors: % 8u ticks: % 8u\n" \ - ${stats[0]} ${stats[1]} ${stats[2]} ${stats[3]} - printf "WRITE IO cnt: % 8u merges: % 8u sectors: % 8u ticks: % 8u\n" \ - ${stats[4]} ${stats[5]} ${stats[6]} ${stats[7]} - printf "in flight: % 8u io ticks: % 8u time in queue: % 8u\n" \ - ${stats[8]} ${stats[9]} ${stats[10]} - echo "" + for dev in $devs; do + umount /mnt/${dev}dir + rm -rf /mnt/${dev}dir + + stats=( $(cat /sys/block/$dev/stat) ) + echo "" + echo "$dev stats" + printf "READ IO cnt: % 8u merges: % 8u sectors: % 8u ticks: % 8u\n" \ + ${stats[0]} ${stats[1]} ${stats[2]} ${stats[3]} + printf "WRITE IO cnt: % 8u merges: % 8u sectors: % 8u ticks: % 8u\n" \ + ${stats[4]} ${stats[5]} ${stats[6]} ${stats[7]} + printf "in flight: % 8u io ticks: % 8u time in queue: % 8u\n" \ + ${stats[8]} ${stats[9]} ${stats[10]} + echo "" + done done trap - SIGINT SIGTERM EXIT diff --git a/test/vhost/spdk_vhost.sh b/test/vhost/spdk_vhost.sh index 38edfc830..e2c3f2776 100755 --- a/test/vhost/spdk_vhost.sh +++ b/test/vhost/spdk_vhost.sh @@ -86,11 +86,11 @@ case $1 in ;; -fs|--fs-integrity-scsi) echo 'Running filesystem integrity suite...' - ./integrity/integrity_start.sh -i $VM_IMAGE -m scsi -f ntfs + ./integrity/integrity_start.sh -i $VM_IMAGE -m scsi -f "xfs ntfs btrfs ext4" ;; -fb|--fs-integrity-blk) echo 'Running filesystem integrity suite...' - ./integrity/integrity_start.sh -i $VM_IMAGE -m blk -f ntfs + ./integrity/integrity_start.sh -i $VM_IMAGE -m blk -f "xfs ntfs btrfs ext4" ;; -ils|--integrity-lvol-scsi) echo 'Running lvol integrity suite...'