stop-testing 778 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. DIR=$(dirname `readlink -f $0`)
  3. . $DIR/testing.conf
  4. . $DIR/scripts/function.sh
  5. echo "Stopping test environment"
  6. NETWORKS="vnet1 vnet2 vnet3"
  7. KNLTARGET=/var/run/kvm-swan-kernel
  8. HOSTFSTARGET=/var/run/kvm-swan-hostfs
  9. TESTRESULTSTARGET=/var/run/kvm-swan-testresults
  10. [ `id -u` -eq 0 ] || die "You must be root to run $0"
  11. check_commands virsh
  12. for net in $NETWORKS
  13. do
  14. log_action "Network $net"
  15. execute "virsh net-destroy $net"
  16. done
  17. for host in $STRONGSWANHOSTS
  18. do
  19. log_action "Guest $host"
  20. execute "virsh shutdown $host"
  21. rm -f $VIRTIMGSTORE/$host.$IMGEXT
  22. done
  23. log_action "Removing kernel $KERNEL"
  24. execute "rm $KNLTARGET"
  25. log_action "Removing link to hostfs"
  26. execute "rm $HOSTFSTARGET"
  27. log_action "Removing link to testresults"
  28. execute "rm $TESTRESULTSTARGET"