From 6d909ff139399b78b60b5bdf52bbcb93c7a09e3d Mon Sep 17 00:00:00 2001 From: Mark Vanderwiel Date: Mon, 27 Oct 2014 15:15:53 -0500 Subject: [PATCH] Allow san_password attribute for svc driver * add san_password= for storwize * remove unused san_password attributes, get_password method is used * add tests for password both storewize and solidfire Change-Id: I4afde431332ca914d078bc3e30362ef22961016f Closes-Bug: #1384085 --- CHANGELOG.md | 1 + attributes/default.rb | 2 -- recipes/cinder-common.rb | 3 +++ spec/cinder_common_spec.rb | 5 +++++ spec/spec_helper.rb | 3 --- templates/default/cinder.conf.erb | 4 ++++ 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e465d50..f418ba1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ This file is used to list changes made in each version of the openstack-block-st * Add default_volume_type config option * Update gpfs volume driver path and fix gpfs_images_share_mode initialization * Change to cinder v2 service and endpoint +* Add support for san_password with ibm.storwize_svc.StorwizeSVCDriver ## 10.0.0 * Upgrading to Juno diff --git a/attributes/default.rb b/attributes/default.rb index bd250f4..0c86973 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -132,7 +132,6 @@ default['openstack']['block-storage']['service_role'] = 'admin' default['openstack']['block-storage']['san']['san_ip'] = '127.0.0.1' default['openstack']['block-storage']['san']['san_login'] = 'admin' default['openstack']['block-storage']['san']['san_private_key'] = '/v7000_rsa' -default['openstack']['block-storage']['san']['san_password'] = 'san_password' # NFS support default['openstack']['block-storage']['nfs']['nas_ip'] = '127.0.0.1' @@ -180,7 +179,6 @@ default['openstack']['block-storage']['storwize']['storwize_svc_multihostmap_ena # SolidFire Support default['openstack']['block-storage']['solidfire']['san_ip'] = node['openstack']['block-storage']['san']['san_ip'] default['openstack']['block-storage']['solidfire']['san_login'] = node['openstack']['block-storage']['san']['san_login'] -default['openstack']['block-storage']['solidfire']['san_password'] = node['openstack']['block-storage']['san']['san_password'] default['openstack']['block-storage']['solidfire']['sf_emulate'] = 'False' default['openstack']['block-storage']['solidfire']['iscsi_ip_prefix'] = nil diff --git a/recipes/cinder-common.rb b/recipes/cinder-common.rb index 7836480..2bc1c73 100644 --- a/recipes/cinder-common.rb +++ b/recipes/cinder-common.rb @@ -46,6 +46,8 @@ elsif mq_service_type == 'qpid' end case node['openstack']['block-storage']['volume']['driver'] +when 'cinder.volume.drivers.ibm.storwize_svc.StorwizeSVCDriver' + storwize_pass = get_password 'user', node['openstack']['block-storage']['storwize']['san_login'] when 'cinder.volume.drivers.solidfire.SolidFire' solidfire_pass = get_password 'user', node['openstack']['block-storage']['solidfire']['san_login'] when 'cinder.volume.drivers.ibm.ibmnas.IBMNAS_NFSDriver' @@ -101,6 +103,7 @@ template '/etc/cinder/cinder.conf' do glance_port: glance_api_endpoint.port, ibmnas_pass: ibmnas_pass, solidfire_pass: solidfire_pass, + storwize_pass: storwize_pass, volume_api_bind_address: cinder_api_bind.host, volume_api_bind_port: cinder_api_bind.port, vmware_host_pass: vmware_host_pass, diff --git a/spec/cinder_common_spec.rb b/spec/cinder_common_spec.rb index a9e121a..54af4c6 100644 --- a/spec/cinder_common_spec.rb +++ b/spec/cinder_common_spec.rb @@ -564,6 +564,7 @@ describe 'openstack-block-storage::cinder-common' do it 'has a default attribute' do %w(san_ip=127.0.0.1 san_login=admin + san_password=test_pass san_private_key=/v7000_rsa storwize_svc_volpool_name=volpool storwize_svc_vol_rsize=2 @@ -642,6 +643,10 @@ describe 'openstack-block-storage::cinder-common' do expect(chef_run).to render_file(file.name).with_content(/^sf_emulate_512=test$/) end + it 'has solidfire password' do + expect(chef_run).to render_file(file.name).with_content(/^san_password=test_pass$/) + end + %w(san_login san_ip).each do |attr| it "has solidfire #{attr} set" do node.set['openstack']['block-storage']['solidfire'][attr] = "solidfire_#{attr}_value" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ab32a8a..045fda5 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -48,9 +48,6 @@ shared_context 'block-storage-stubs' do allow_any_instance_of(Chef::Recipe).to receive(:get_password) .with('user', 'guest') .and_return('mq-pass') - allow_any_instance_of(Chef::Recipe).to receive(:get_password) - .with('user', 'solidfire_admin') - .and_return('solidfire_testpass') allow_any_instance_of(Chef::Recipe).to receive(:get_password) .with('service', 'netapp') .and_return 'netapp-pass' diff --git a/templates/default/cinder.conf.erb b/templates/default/cinder.conf.erb index b131073..9531946 100644 --- a/templates/default/cinder.conf.erb +++ b/templates/default/cinder.conf.erb @@ -744,6 +744,10 @@ san_login=<%= node["openstack"]["block-storage"]["storwize"]["san_login"] %> san_private_key=<%= node["openstack"]["block-storage"]["storwize"]["san_private_key"] %> #### (StrOpt) Filename of private key to use for SSH authentication +san_password=<%= @storwize_pass %> +#### (StrOpt) Password for SAN controller + + <% else %> # san_thin_provision=true #### (BoolOpt) Use thin provisioning for SAN volumes?