diff --git a/deployment_scripts/puppet/manifests/controller.pp b/deployment_scripts/puppet/manifests/controller.pp index 2564eff..5d69902 100755 --- a/deployment_scripts/puppet/manifests/controller.pp +++ b/deployment_scripts/puppet/manifests/controller.pp @@ -20,7 +20,7 @@ $previous_backends = '' class { 'plugin_purestorage_cinder::controller' : backend_name => $backend_name, backends => $previous_backends, - multibackends => $plugin_settings['multibackend'], + multibackend => $plugin_settings['multibackend'], glance_image_cache => $plugin_settings['pure_glance_image_cache'], glance_image_count => $plugin_settings["pure_glance_cache_count"], glance_image_size => $plugin_settings["pure_glance_cache_size"], diff --git a/deployment_scripts/puppet/modules/plugin_purestorage_cinder/lib/facter/cinder_tenant.rb b/deployment_scripts/puppet/modules/plugin_purestorage_cinder/lib/facter/cinder_tenant.rb new file mode 100644 index 0000000..9d54d53 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_purestorage_cinder/lib/facter/cinder_tenant.rb @@ -0,0 +1,7 @@ +require 'facter/util/resolution' + +Facter.add("cinder_tenant") do + setcode do + tenant = Facter::Util::Resolution.exec("/usr/bin/openstack project show cinder_internal_tenant | grep id | awk \'{print $4}\'") + end +end diff --git a/deployment_scripts/puppet/modules/plugin_purestorage_cinder/lib/facter/cinder_user.rb b/deployment_scripts/puppet/modules/plugin_purestorage_cinder/lib/facter/cinder_user.rb new file mode 100644 index 0000000..2ad0cc2 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_purestorage_cinder/lib/facter/cinder_user.rb @@ -0,0 +1,7 @@ +require 'facter/util/resolution' + +Facter.add("cinder_user") do + setcode do + user = Facter::Util::Resolution.exec("/usr/bin/openstack user show cinder_internal_user | grep id | awk \'{print $4}\'") + end +end diff --git a/deployment_scripts/puppet/modules/plugin_purestorage_cinder/manifests/controller.pp b/deployment_scripts/puppet/modules/plugin_purestorage_cinder/manifests/controller.pp index 8d776a7..aefc6b2 100755 --- a/deployment_scripts/puppet/modules/plugin_purestorage_cinder/manifests/controller.pp +++ b/deployment_scripts/puppet/modules/plugin_purestorage_cinder/manifests/controller.pp @@ -16,7 +16,7 @@ class plugin_purestorage_cinder::controller ( $backend_name, $backends, - $multibackends, + $multibackend, $glance_image_cache, $glance_image_count, $glance_image_size, @@ -70,52 +70,43 @@ class plugin_purestorage_cinder::controller ( Package[$::cinder::params::volume_package] -> Cinder_config<||> } - if $multibackend == 'true' { + if $multibackend{ $section = $backend_name + cinder_type {'pure_vol': + ensure => present, + properties => ['volume_backend_name=$section'], + } cinder_config { + "DEFAULT/default_volume_type": value => 'pure_vol'; "DEFAULT/enabled_backends": value => "${backend_name}"; } } else { $section = 'DEFAULT' } -# Insert Glance Image Cache for Cinder settings -# Until we can do this correctly with Keystone and get back the created IDs -# we will do this with the get_random_id below. -# -# if $glance_image_cache == 'true' { -# keystone_tenant { 'cinder_internal_tenant': -# ensure => present, -# description => 'Cinder Internal Tenant', -# enabled => True, -# } -# keystone_user { 'cinder_internal_user': -# ensure => present, -# description => 'Cinder Internal User', -# enabled => True, -# } -# keystone_role { 'admin': -# ensure => present, -# } -# keystone_user_role { 'cinder_internal_user@cinder_internal_tenant': -# roles => ['admin'], -# ensure => present -# } -# -# Currently there is no way to recover a user or tenant ID from keystone in puppet. -# Luckily the glance image cache doesn't actually use keystone to check the IDs so -# we can just, temporarily, assign a randon ID to the two fields. -# When keystone-puppet has the functionality we need we will fix this workaround + if $glance_image_cache{ + keystone_tenant { 'cinder_internal_tenant': + ensure => present, + enabled => True, + } + keystone_user { 'cinder_internal_user': + ensure => present, + enabled => True, + } + keystone_role { 'admin': + ensure => present, + } + keystone_user_role { 'cinder_internal_user@cinder_internal_tenant': + roles => ['admin'], + ensure => present + } - if $glance_image_cache == 'true' { - $PROJECT_ID = get_random_id(32) - $USER_ID = get_random_id(32) cinder_config { - "DEFAULT/cinder_internal_tenant_project_id": value => "$PROJECT_ID"; - "DEFAULT/cinder_internal_tenant_user_id": value => "$USER_ID"; + "DEFAULT/cinder_internal_tenant_project_id": value => $::cinder_tenant; + "DEFAULT/cinder_internal_tenant_user_id": value => $::cinder_user; "$section/image_volume_cache_enabled": value => $glance_image_cache; - "$section/image_volume_cache_max_count": value => $glance_cache_count; - "$section/image_volume_cache_max_size_gb": value => $glance_cache_size; + "$section/image_volume_cache_max_count": value => $glance_image_count; + "$section/image_volume_cache_max_size_gb": value => $glance_image_size; } }