##### Fedora #####
alias virsh="virsh --connect qemu:///system"
##### To create the test environment #####
# Update these as needed
CLIENT_QCOW=$PWD/client.qcow2
SERVER_QCOW=$PWD/server.qcow2
cat << EOF > /tmp/manila-test-net.xml
manila-test-net
EOF
virsh net-define /tmp/manila-test-net.xml
cat << EOF > /tmp/manila-test-client.xml
manila-test-client
64
64
1
hvm
destroy
restart
restart
EOF
virsh define /tmp/manila-test-client.xml
cat << EOF > /tmp/manila-test-server.xml
manila-test-server
128
128
1
hvm
destroy
restart
restart
EOF
virsh define /tmp/manila-test-server.xml
##### To start the test environment #####
virsh net-start manila-test-net
virsh start manila-test-server
virsh start manila-test-client
##### To run basic tests #####
export SSHPASS=root
SSH="sshpass -e ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
$SSH root@192.168.32.3 << EOF
umask 2
mkdir -p /mnt/nfs3 /mnt/nfs4 /mnt/cifs
mount -t nfs -o vers=3 192.168.32.2:/share /mnt/nfs3
mount.nfs4 192.168.32.2:/share /mnt/nfs4
mount -t cifs -o username=guest //192.168.32.2/share /mnt/cifs
echo Hello NFS3 > /mnt/nfs3/test3
echo Hello NFS4 > /mnt/nfs4/test4
echo Hello CIFS > /mnt/cifs/test
cat /mnt/nfs3/test3
cat /mnt/nfs4/test4
cat /mnt/cifs/test
umount /mnt/nfs3
umount /mnt/nfs4
umount /mnt/cifs
EOF
$SSH root@192.168.32.2 cat /share/*
##### To stop the test environment #####
virsh destroy manila-test-server
virsh destroy manila-test-client
virsh net-destroy manila-test-net
##### To clean up test environment #####
virsh undefine manila-test-server
virsh undefine manila-test-client
virsh net-undefine manila-test-net