From 0488fd84b8adbfca9998644641182054786a62e4 Mon Sep 17 00:00:00 2001 From: Karol Latecki Date: Wed, 14 Dec 2016 15:34:03 -0500 Subject: [PATCH] vhost_test: update vhost ext4test for spdk vhost - Renamed to integrity filesystem test - Add detecting if qemu is installed - Default vhost.conf using NVMe; ramdisk may be too small for copying & building both dpdk and spdk - Use kernel source (present on VM) for running test compilation - rename to integrity test Change-Id: Id369a5aac3008700cffbc51a5197b72f10645a1b Signed-off-by: Karol Latecki --- test/vhost/ext4test/ext4start.sh | 101 ----------- test/vhost/ext4test/spdk_vnet_base.xml | 11 -- test/vhost/integrity/base_vm.xml | 68 ++++++++ test/vhost/integrity/base_vnet.xml | 8 + test/vhost/integrity/integrity_start.sh | 158 ++++++++++++++++++ .../integrity_vm.sh} | 51 ++++-- .../{ext4test => integrity}/vhost.conf.in | 11 +- test/vhost/spdk_vhost.sh | 5 + 8 files changed, 276 insertions(+), 137 deletions(-) delete mode 100755 test/vhost/ext4test/ext4start.sh delete mode 100644 test/vhost/ext4test/spdk_vnet_base.xml create mode 100644 test/vhost/integrity/base_vm.xml create mode 100644 test/vhost/integrity/base_vnet.xml create mode 100755 test/vhost/integrity/integrity_start.sh rename test/vhost/{ext4test/ext4connect.sh => integrity/integrity_vm.sh} (53%) rename test/vhost/{ext4test => integrity}/vhost.conf.in (91%) 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 + + + + + + + +
+ + +
+ + + + + + +
+ + + + + + + + + + +