Fuel plugin that enables to configure multiple Cinder backend support for Kaminario K2 All-Flash Array
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.

init.pp 3.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. class kaminario::config {
  2. $num = [ '0', '1', '2', '3', '4', '5' ]
  3. $plugin_settings = hiera('cinder_kaminario')
  4. each($num) |$value| {
  5. config {"plugin_${value}":
  6. cinder_node => $plugin_settings["cinder_node_${value}"],
  7. storage_protocol => $plugin_settings["storage_protocol_${value}"],
  8. backend_name => $plugin_settings["backend_name_${value}"],
  9. storage_user => $plugin_settings["storage_user_${value}"],
  10. storage_password => $plugin_settings["storage_password_${value}"],
  11. storage_ip => $plugin_settings["storage_ip_${value}"],
  12. enable_replication => $plugin_settings["enable_replication_${value}"],
  13. replication_ip => $plugin_settings["replication_ip_${value}"],
  14. replication_login => $plugin_settings["replication_login_${value}"],
  15. replication_rpo => $plugin_settings["replication_rpo_${value}"],
  16. replication_password => $plugin_settings["replication_password_${value}"],
  17. num => $value
  18. }
  19. }
  20. }
  21. define config($storage_protocol,$backend_name,$storage_user,$storage_password,$storage_ip,$num,$cinder_node,$enable_replication,$replication_ip,$replication_login,$replication_rpo,$replication_password) {
  22. $sec_name = section_name( $storage_ip , $backend_name )
  23. $config_file = "/etc/cinder/cinder.conf"
  24. if $cinder_node == hiera(user_node_name) {
  25. if $storage_protocol == 'FC'{
  26. ini_subsetting {"enable_backend_${num}":
  27. ensure => present,
  28. section => 'DEFAULT',
  29. key_val_separator => '=',
  30. path => $config_file,
  31. setting => 'enabled_backends',
  32. subsetting => $backend_name,
  33. subsetting_separator => ',',
  34. }->
  35. cinder_config {
  36. "$sec_name/volume_driver" : value => "cinder.volume.drivers.kaminario.kaminario_fc.KaminarioFCDriver";
  37. "$sec_name/volume_backend_name" : value => $backend_name;
  38. "$sec_name/san_ip" : value => $storage_ip;
  39. "$sec_name/san_login" : value => $storage_user;
  40. "$sec_name/san_password" : value => $storage_password;
  41. }
  42. if $enable_replication == true {
  43. $replication_device = get_replication_device($replication_ip, $replication_login , $replication_password , $replication_rpo)
  44. cinder_config {
  45. "$sec_name/replication_device" : value => $replication_device;
  46. }
  47. }
  48. }
  49. if $storage_protocol == 'ISCSI'{
  50. ini_subsetting {"enable_backend_${num}":
  51. ensure => present,
  52. section => 'DEFAULT',
  53. key_val_separator => '=',
  54. path => $config_file,
  55. setting => 'enabled_backends',
  56. subsetting => $backend_name,
  57. subsetting_separator => ',',
  58. }->
  59. cinder_config {
  60. "$sec_name/volume_driver" : value => "cinder.volume.drivers.kaminario.kaminario_iscsi.KaminarioISCSIDriver";
  61. "$sec_name/volume_backend_name" : value => $backend_name;
  62. "$sec_name/san_ip" : value => $storage_ip;
  63. "$sec_name/san_login" : value => $storage_user;
  64. "$sec_name/san_password" : value => $storage_password;
  65. }
  66. if $enable_replication == true {
  67. $replication_device = get_replication_device($replication_ip, $replication_login , $replication_password , $replication_rpo)
  68. cinder_config {
  69. "$sec_name/replication_device" : value => $replication_device;
  70. }
  71. }
  72. }
  73. }
  74. }