Neutron support for fast path stack
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.

fast-path 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. #!/bin/bash
  2. #
  3. # Copyright 2015 6WIND S.A.
  4. function install_va_deb_pkg {
  5. sudo apt-get install -y --force-yes virtual-accelerator
  6. }
  7. function setup_va_local_repo {
  8. cd $VA_PKG_DIR/..
  9. DEB_DIR=`basename $VA_PKG_DIR`
  10. sudo mkdir -p /etc/apt/sources.list.d
  11. echo "deb file:$PWD/$DEB_DIR/ ./" | sudo tee /etc/apt/sources.list.d/6wind.list
  12. # allow unauthenticated packages
  13. # TODO: create an authenticated local repo
  14. echo 'APT::Get::AllowUnauthenticated 1;' | sudo tee /etc/apt/apt.conf.d/02unauthenticated
  15. sudo apt-get update
  16. }
  17. function setup_va_remote_repo {
  18. cd $VA_REPO_DIR
  19. sudo dpkg -i $VA_CREDENTIALS_PACKAGE
  20. sudo curl --cacert /usr/local/etc/certs/6wind_ca.crt --key /usr/local/etc/certs/6wind_client.key --cert /usr/local/etc/certs/6wind_client.crt -o 6wind-virtual-accelerator-repository.deb https://repo.6wind.com/virtual-accelerator/ubuntu-16.04/$(dpkg --print-architecture)/$VA_VERSION/6wind-virtual-accelerator-ubuntu-16.04-repository_$VA_VERSION-1_$(dpkg --print-architecture).deb
  21. sudo dpkg -i 6wind-virtual-accelerator-repository.deb
  22. sudo apt-get update
  23. }
  24. function uninstall_va_deb_pkg {
  25. uninstall_package virtual-accelerator
  26. }
  27. function remove_va_local_repo {
  28. sudo rm /etc/apt/sources.list.d/6wind.list
  29. sudo apt-get update
  30. }
  31. function remove_va_remote_repo {
  32. cd $VA_REPO_DIR
  33. sudo rm /etc/apt/sources.list.d/6wind-virtual-accelerator.list
  34. sudo apt-get update
  35. }
  36. function install_va {
  37. if is_ubuntu; then
  38. install_va_deb_pkg
  39. else
  40. exit_distro_not_supported "devstack networking_6wind not supported on this distrib"
  41. fi
  42. }
  43. function setup_va_repo {
  44. if is_ubuntu; then
  45. if [[ $VA_PKG_DIR ]]; then
  46. setup_va_local_repo
  47. return
  48. fi
  49. if [[ $VA_REPO_DIR ]]; then
  50. setup_va_remote_repo
  51. return
  52. fi
  53. else
  54. exit_distro_not_supported "devstack networking_6wind not supported on this distrib"
  55. fi
  56. }
  57. function uninstall_va {
  58. if is_ubuntu; then
  59. uninstall_va_deb_pkg
  60. else
  61. exit_distro_not_supported "devstack networking_6wind not supported on this distrib"
  62. fi
  63. }
  64. function remove_va_repo {
  65. if is_ubuntu; then
  66. if [[ $VA_PKG_DIR ]]; then
  67. remove_va_local_repo
  68. return
  69. fi
  70. if [[ $VA_REPO_DIR ]]; then
  71. remove_va_remote_repo
  72. return
  73. fi
  74. else
  75. exit_distro_not_supported "devstack networking_6wind not supported on this distrib"
  76. fi
  77. }
  78. function set_va_opt {
  79. if grep -q '^#\?: \${'"$1"':=.*}' "$3"; then
  80. sudo sed -i -- 's@^#\?: \${'"$1"':=.*@: ${'"$1"':='"$2"'}@' "$3";
  81. else
  82. sudo echo >> $3;
  83. sudo echo '# Config added by networking_6wind plugin' >> $3;
  84. sudo echo ': ${'"$1"':='"$2"'}' >> $3;
  85. fi
  86. }
  87. function write_va_conf {
  88. FP_CONF="/usr/local/etc/fast-path.env"
  89. if [[ ! -f $FP_CONF ]]; then
  90. sudo cp /usr/local/etc/fast-path.env.tmpl $FP_CONF
  91. if [[ -n $VM_MEMORY ]]; then
  92. set_va_opt "VM_MEMORY" "$VM_MEMORY" $FP_CONF
  93. fi
  94. if [[ -n $FP_MEMORY ]]; then
  95. set_va_opt "FP_MEMORY" "$FP_MEMORY" $FP_CONF
  96. fi
  97. if [[ "$FP_GREEN_MODE" == "True" ]]; then
  98. set_va_opt "MAINLOOP_DELAY_US" "500" $FP_CONF
  99. fi
  100. fi
  101. }
  102. function start_va {
  103. if is_ubuntu; then
  104. sudo service virtual-accelerator start
  105. sudo service openvswitch-switch restart
  106. sudo service libvirt-bin restart
  107. else
  108. exit_distro_not_supported "devstack networking_6wind not supported on this distrib"
  109. fi
  110. }
  111. function stop_va {
  112. sudo service virtual-accelerator stop
  113. }
  114. function start_rpc_fp_server {
  115. /usr/local/bin/rpc-fp-server &
  116. }
  117. function stop_rpc_fp_server {
  118. killall rpc-fp-server
  119. }