start-testing 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/bash
  2. DIR=$(dirname `readlink -f $0`)
  3. . $DIR/testing.conf
  4. . $DIR/scripts/function.sh
  5. NETWORKS="vnet1 vnet2 vnet3"
  6. CONFDIR=$DIR/config/kvm
  7. KNLSRC=$BUILDDIR/$KERNEL/arch/x86/boot/bzImage
  8. KNLTARGET=/var/run/kvm-swan-kernel
  9. HOSTFSTARGET=/var/run/kvm-swan-hostfs
  10. TESTRESTULSTARGET=/var/run/kvm-swan-testresults
  11. MCASTBRS="test-br0 test-br1"
  12. echo "Starting test environment"
  13. [ `id -u` -eq 0 ] || die "You must be root to run $0"
  14. running_any $STRONGSWANHOSTS && die "Please stop test environment before running $0"
  15. check_commands kvm virsh
  16. [ -f $KNLSRC ] || die "Kernel $KNLSRC not found"
  17. log_action "Deploying kernel $KERNEL"
  18. execute "ln -fs $KNLSRC $KNLTARGET"
  19. log_action "Deploying $SHAREDDIR as hostfs"
  20. execute "chown -R $KVMUSER:$KVMGROUP $SHAREDDIR" 0
  21. execute "ln -Tfs $SHAREDDIR $HOSTFSTARGET"
  22. [ -d $TESTRESULTSDIR ] || mkdir $TESTRESULTSDIR
  23. log_action "Deploying $TESTRESULTSDIR as hostfs"
  24. execute "ln -Tfs $TESTRESULTSDIR $TESTRESTULSTARGET"
  25. for net in $NETWORKS
  26. do
  27. log_action "Network $net"
  28. execute "virsh net-create $CONFDIR/$net.xml"
  29. done
  30. for host in $STRONGSWANHOSTS
  31. do
  32. ln -fs $IMGDIR/$host.$IMGEXT $VIRTIMGSTORE/$host.$IMGEXT
  33. log_action "Guest $host"
  34. execute "virsh create $CONFDIR/$host.xml"
  35. done
  36. # Enforce reception of multicast traffic on bridges
  37. for br in $MCASTBRS
  38. do
  39. cd /sys/devices/virtual/net/$br/brif
  40. for vnet in `find . -name "*eth?"`
  41. do
  42. echo 2 > $vnet/multicast_router
  43. done
  44. done
  45. echo 0x08 > /sys/devices/virtual/net/test-br0/bridge/group_fwd_mask