Shared filesystem management project for OpenStack.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

107 lines
3.2 KiB

  1. # Environment variables
  2. # ----------------------------------------------
  3. # Functions
  4. # Import devstack functions
  5. source $BASE/new/devstack/functions
  6. function manila_check_service_vm_availability {
  7. # First argument is expected to be IP address of a service VM
  8. wait_step=10
  9. wait_timeout=300
  10. available='false'
  11. while (( wait_timeout > 0 )) ; do
  12. if ping -w 1 $1; then
  13. available='true'
  14. break
  15. fi
  16. ((wait_timeout-=$wait_step))
  17. sleep $wait_step
  18. done
  19. if [[ $available == 'true' ]]; then
  20. echo "SUCCESS! Service VM $1 is available."
  21. else
  22. echo "FAILURE! Service VM $1 is not available."
  23. exit 1
  24. fi
  25. }
  26. function manila_wait_for_generic_driver_init {
  27. # First argument is expected to be file path to Manila config
  28. MANILA_CONF=$1
  29. DRIVER_GROUPS=$(iniget $MANILA_CONF DEFAULT enabled_share_backends)
  30. for driver_group in ${DRIVER_GROUPS//,/ }; do
  31. SHARE_DRIVER=$(iniget $MANILA_CONF $driver_group share_driver)
  32. GENERIC_DRIVER='manila.share.drivers.generic.GenericShareDriver'
  33. DHSS=$(iniget $MANILA_CONF $driver_group driver_handles_share_servers)
  34. if [[ $SHARE_DRIVER == $GENERIC_DRIVER && $(trueorfalse False DHSS) == False ]]; then
  35. # Wait for service VM availability
  36. source /opt/stack/new/devstack/openrc admin demo
  37. vm_ip=$(iniget $MANILA_CONF $driver_group service_net_name_or_ip)
  38. # Check availability
  39. manila_check_service_vm_availability $vm_ip
  40. fi
  41. done
  42. }
  43. function manila_wait_for_drivers_init {
  44. # First argument is expected to be file path to Manila config
  45. manila_wait_for_generic_driver_init $1
  46. # Sleep to make manila-share service notify manila-scheduler about
  47. # its capabilities on time.
  48. sleep 10
  49. }
  50. function save_tempest_results {
  51. # First argument is expected to be number or tempest run
  52. local src_dirname
  53. local dst_dirname
  54. src_dirname="$BASE/new/tempest"
  55. dst_dirname="$BASE/logs/tempest_$1"
  56. # 1. Create destination directory
  57. sudo mkdir $dst_dirname
  58. sudo chown $USER:stack $dst_dirname
  59. sudo chmod 755 $dst_dirname
  60. # 2. Save tempest configuration file
  61. sudo cp $src_dirname/etc/tempest.conf $dst_dirname/tempest_conf.txt
  62. # 3. Save tempest log file
  63. cp $src_dirname/tempest.log $src_dirname/tempest.txt
  64. echo '' > $src_dirname/tempest.log
  65. sudo mv $src_dirname/tempest.txt $dst_dirname/tempest.txt
  66. # 4. Save tempest stestr results
  67. if [ -f $src_dirname/.stestr/0 ]; then
  68. pushd $src_dirname
  69. sudo stestr last --subunit > $src_dirname/tempest.subunit
  70. popd
  71. else
  72. echo "Tests have not run!"
  73. fi
  74. if [ -f $src_dirname/tempest.subunit ]; then
  75. s2h=`type -p subunit2html`
  76. sudo $s2h $src_dirname/tempest.subunit $src_dirname/testr_results.html
  77. sudo mv $src_dirname/tempest.subunit $dst_dirname/tempest.subunit
  78. sudo mv $src_dirname/testr_results.html $dst_dirname/testr_results.html
  79. # 5. Cleanup
  80. sudo rm -rf $src_dirname/.stestr
  81. else
  82. echo "No 'stestr' results available for saving. File '$src_dirname/tempest.subunit' is absent."
  83. fi
  84. }