cell.pp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # == Type: nova::cell_v2::cell
  2. #
  3. # Resource for managing cell_v2 cells.
  4. #
  5. # === Parameters
  6. #
  7. # [*extra_params*]
  8. # (String) Extra parameters to pass to the nova-manage commands.
  9. # Defaults to ''.
  10. #
  11. # [*transport_url*]
  12. # (String) AMQP transport url for the cell.
  13. # If not defined, the [DEFAULT]/transport_url is used from the nova
  14. # configuration file.
  15. # Defaults to undef.
  16. #
  17. # [*database_connection*]
  18. # (String) Database connection url for the cell.
  19. # If not defined, the [DEFAULT]/database_connection is used from the nova
  20. # configuration file.
  21. # Defaults to undef.
  22. #
  23. define nova::cell_v2::cell (
  24. $extra_params = '',
  25. $transport_url = undef,
  26. $database_connection = undef
  27. ) {
  28. include ::nova::deps
  29. if $transport_url {
  30. $transport_url_real = "--transport-url=${transport_url}"
  31. } else {
  32. $transport_url_real = ''
  33. }
  34. if $database_connection {
  35. $database_connection_real = "--database_connection=${database_connection}"
  36. } else {
  37. $database_connection_real = ''
  38. }
  39. exec { "nova-cell_v2-cell-${title}":
  40. path => [ '/bin', '/usr/bin' ],
  41. command => "nova-manage ${extra_params} cell_v2 create_cell --name=${title} ${transport_url_real} ${database_connection_real}",
  42. unless => "nova-manage ${extra_params} cell_v2 list_cells | grep -q ${title}",
  43. logoutput => on_failure,
  44. subscribe => Anchor['nova::cell_v2::begin'],
  45. notify => Anchor['nova::cell_v2::end'],
  46. }
  47. }