DevStack plugin to configure Ceph backend.
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.

plugin.sh 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. # ceph.sh - DevStack extras script to install Ceph
  2. if [[ "$1" == "source" ]]; then
  3. # Initial source
  4. source $TOP_DIR/lib/ceph
  5. elif [[ "$1" == "stack" && "$2" == "pre-install" ]]; then
  6. if [[ "$ENABLE_CEPH_RGW" = "True" ]] && (is_service_enabled swift); then
  7. die $LINENO \
  8. "You cannot activate both Swift and Ceph Rados Gateway, \
  9. please disable Swift or set ENABLE_CEPH_RGW=False"
  10. fi
  11. echo_summary "Installing Ceph"
  12. check_os_support_ceph
  13. if [ "$REMOTE_CEPH" = "False" ]; then
  14. if [ "$CEPH_CONTAINERIZED" = "True" ]; then
  15. echo_summary "Configuring and initializing Ceph"
  16. deploy_containerized_ceph
  17. else
  18. install_ceph
  19. echo_summary "Configuring Ceph"
  20. configure_ceph
  21. # NOTE (leseb): we do everything here
  22. # because we need to have Ceph started before the main
  23. # OpenStack components.
  24. # Ceph OSD must start here otherwise we can't upload any images.
  25. echo_summary "Initializing Ceph"
  26. init_ceph
  27. start_ceph
  28. fi
  29. else
  30. install_ceph_remote
  31. fi
  32. elif [[ "$1" == "stack" && "$2" == "install" ]]; then
  33. # FIXME(melwitt): This is a hack to get around a namespacing issue with
  34. # Paste and PasteDeploy. For stable/queens, we use the Pike UCA packages
  35. # and the Ceph packages in the Pike UCA are pulling in python-paste and
  36. # python-pastedeploy packages. The python-pastedeploy package satisfies the
  37. # upper-constraints but python-paste does not, so devstack pip installs a
  38. # newer version of it, while python-pastedeploy remains. The mismatch
  39. # between the install path of paste and paste.deploy causes Keystone to
  40. # fail to start, with "ImportError: cannot import name deploy."
  41. if [[ "$TARGET_BRANCH" == stable/queens ]]; then
  42. pip_install -U --force PasteDeploy
  43. fi
  44. elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
  45. if is_ceph_enabled_for_service glance; then
  46. echo_summary "Configuring Glance for Ceph"
  47. configure_ceph_glance
  48. fi
  49. if is_ceph_enabled_for_service nova; then
  50. echo_summary "Configuring Nova for Ceph"
  51. configure_ceph_nova
  52. fi
  53. if is_ceph_enabled_for_service cinder; then
  54. echo_summary "Configuring Cinder for Ceph"
  55. configure_ceph_cinder
  56. fi
  57. if is_ceph_enabled_for_service cinder || \
  58. is_ceph_enabled_for_service nova; then
  59. # NOTE (leseb): the part below is a requirement
  60. # to attach Ceph block devices
  61. echo_summary "Configuring libvirt secret"
  62. import_libvirt_secret_ceph
  63. fi
  64. if is_ceph_enabled_for_service manila; then
  65. echo_summary "Configuring Manila for Ceph"
  66. configure_ceph_manila
  67. fi
  68. if [ "$REMOTE_CEPH" = "False" ]; then
  69. if is_ceph_enabled_for_service glance; then
  70. echo_summary "Configuring Glance for Ceph"
  71. configure_ceph_embedded_glance
  72. fi
  73. if is_ceph_enabled_for_service nova; then
  74. echo_summary "Configuring Nova for Ceph"
  75. configure_ceph_embedded_nova
  76. fi
  77. if is_ceph_enabled_for_service cinder; then
  78. echo_summary "Configuring Cinder for Ceph"
  79. configure_ceph_embedded_cinder
  80. fi
  81. if is_ceph_enabled_for_service manila; then
  82. echo_summary "Configuring Manila for Ceph"
  83. configure_ceph_embedded_manila
  84. fi
  85. if [ "$ENABLE_CEPH_RGW" = "True" ]; then
  86. echo_summary "Configuring Rados Gateway with Keystone for Swift"
  87. configure_ceph_embedded_rgw
  88. if [ "$CEPH_CONTAINERIZED" = "False" ]; then
  89. start_ceph_embedded_rgw
  90. else
  91. _configure_ceph_rgw_container
  92. fi
  93. fi
  94. fi
  95. elif [[ "$1" == "stack" && "$2" == "test-config" ]]; then
  96. if is_service_enabled tempest; then
  97. iniset $TEMPEST_CONFIG compute-feature-enabled swap_volume False
  98. # This is only being set because the tempest test
  99. # test_shelve_unshelve_server fails with an
  100. # "After unshelve, shelved image is not deleted"
  101. # failure. Re-enable this feature when that test is fixed.
  102. # https://review.openstack.org/#/c/471352/
  103. iniset $TEMPEST_CONFIG compute-feature-enabled shelve False
  104. fi
  105. fi
  106. if [[ "$1" == "unstack" ]]; then
  107. if [ "$CEPH_CONTAINERIZED" = "False" ]; then
  108. if [ "$REMOTE_CEPH" = "True" ]; then
  109. cleanup_ceph_remote
  110. else
  111. stop_ceph
  112. cleanup_ceph_embedded
  113. fi
  114. else
  115. cleanup_containerized_ceph
  116. fi
  117. cleanup_ceph_general
  118. fi
  119. if [[ "$1" == "clean" ]]; then
  120. if [ "$REMOTE_CEPH" = "True" ]; then
  121. cleanup_ceph_remote
  122. else
  123. cleanup_ceph_embedded
  124. fi
  125. cleanup_ceph_general
  126. fi