From ab7c43d8efed6bf03162147a3c9aa19ce6f48d46 Mon Sep 17 00:00:00 2001 From: Edwin Wang Date: Wed, 31 Dec 2014 13:45:36 +0800 Subject: [PATCH] Add config for IBM FlashSystem Modify config in attributes/default.rb, recipes/cinder-common.rb, spec/volume_spec.rb, spec/cinder_common_spec.rb and templates/default/cinder.conf.erb with SAN login and password. It has been merged in Kilo. iSCSI code is on the way. Change-Id: I784f69424a5f1b20f99ba5faccc85b3066e23de3 --- README.md | 10 +++++++- attributes/default.rb | 15 +++++++++++- recipes/cinder-common.rb | 3 +++ recipes/volume.rb | 8 +++++++ spec/cinder_common_spec.rb | 38 +++++++++++++++++++++++++++++++ spec/volume_spec.rb | 10 ++++++++ templates/default/cinder.conf.erb | 22 ++++++++++++++++++ 7 files changed, 104 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4816879..8f543be 100644 --- a/README.md +++ b/README.md @@ -161,6 +161,13 @@ Cinder attributes * `openstack['block-storage']['storwize']['storwize_svc_multipath_enabled'] - Connect with multipath (FC only; iSCSI multipath is controlled by Nova) * `openstack['block-storage']['storwize']['storwize_svc_multihostmap_enabled'] - Allows vdisk to multi host mapping +### FlashSystem attributes ### +* `openstack['block-storage']['san']['san_ip'] - IP address of FlashSystem Cluster node +* `openstack['block-storage']['san']['san_login'] - Username for FlashSystem Cluster node +* `openstack['block-storage']['flashsystem']['flashsystem_connection_protocol'] - The connection protocol for FlashSystem data path (FC) +* `openstack['block-storage']['flashsystem']['flashsystem_multipath_enabled'] - The multipath enablement flag (FC only) +* `openstack['block-storage']['flashsystem']['flashsystem_multihostmap_enabled'] - Enable vdisk to multi-host mapping + ### VMware attributes ### * `openstack['block-storage']['vmware']['secret_name']` - VMware databag secret name * `openstack['block-storage']['vmware']['vmware_host_ip']` - IP address for connecting to VMware ESX/VC server. (string value) @@ -242,12 +249,13 @@ License and Author | **Author** | Chen Zhiwei () | | **Author** | Mark Vanderwiel () | | **Author** | Eric Zhou () | +| **Author** | Edwin Wang () | | | | | **Copyright** | Copyright (c) 2012, Rackspace US, Inc. | | **Copyright** | Copyright (c) 2012-2013, AT&T Services, Inc. | | **Copyright** | Copyright (c) 2013, Opscode, Inc. | | **Copyright** | Copyright (c) 2013-2014, SUSE Linux GmbH | -| **Copyright** | Copyright (c) 2013-2014, IBM, Corp. | +| **Copyright** | Copyright (c) 2013-2015, IBM, Corp. | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/attributes/default.rb b/attributes/default.rb index 65f41e7..e59163b 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -186,6 +186,16 @@ default['openstack']['block-storage']['solidfire']['san_login'] = node['openstac default['openstack']['block-storage']['solidfire']['sf_emulate'] = 'False' default['openstack']['block-storage']['solidfire']['iscsi_ip_prefix'] = nil +# FlashSystem Support +default['openstack']['block-storage']['flashsystem']['san_ip'] = node['openstack']['block-storage']['san']['san_ip'] +default['openstack']['block-storage']['flashsystem']['san_login'] = node['openstack']['block-storage']['san']['san_login'] +# The connection protocol for FlashSystem data path (FC only, will introduce iSCSI in Liberty) +default['openstack']['block-storage']['flashsystem']['flashsystem_connection_protocol'] = 'FC' +# The multipath enablement flag (FC only, iSCSI multipath will be controlled by Nova) +default['openstack']['block-storage']['flashsystem']['flashsystem_multipath_enabled'] = false +# Enable vdisk to multi-host mapping +default['openstack']['block-storage']['flashsystem']['flashsystem_multihostmap_enabled'] = true + # EMC VMAX/VNX tSupport # The EmcUserName user's password is stored in an encrypted databag and # accessed with openstack-common cookbook library's "get_password" routeine. You @@ -322,6 +332,7 @@ when 'fedora', 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this 'cinder_nfs_packages' => ['nfs-utils', 'nfs-utils-lib'], 'cinder_emc_packages' => ['pywbem'], 'cinder_svc_packages' => ['sysfsutils'], + 'cinder_flashsystem_packages' => ['sysfsutils'], 'package_overrides' => '' } when 'suse' @@ -342,7 +353,8 @@ when 'suse' 'cinder_iscsitarget_service' => 'tgtd', 'cinder_nfs_packages' => ['nfs-utils'], 'cinder_emc_packages' => ['python-pywbem'], - 'cinder_svc_packages' => ['sysfsutils'] + 'cinder_svc_packages' => ['sysfsutils'], + 'cinder_flashsystem_packages' => ['sysfsutils'] } when 'debian' # operating system user and group names @@ -363,6 +375,7 @@ when 'debian' 'cinder_nfs_packages' => ['nfs-common'], 'cinder_emc_packages' => ['python-pywbem'], 'cinder_svc_packages' => ['sysfsutils'], + 'cinder_flashsystem_packages' => ['sysfsutils'], 'package_overrides' => "-o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef'" } end diff --git a/recipes/cinder-common.rb b/recipes/cinder-common.rb index 8a9d4b9..8d52e0b 100644 --- a/recipes/cinder-common.rb +++ b/recipes/cinder-common.rb @@ -52,6 +52,8 @@ when 'cinder.volume.drivers.ibm.storwize_svc.StorwizeSVCDriver' end when 'cinder.volume.drivers.solidfire.SolidFire' solidfire_pass = get_password 'user', node['openstack']['block-storage']['solidfire']['san_login'] +when 'cinder.volume.drivers.ibm.flashsystem.FlashSystemDriver' + flashsystem_pass = get_password 'user', node['openstack']['block-storage']['flashsystem']['san_login'] when 'cinder.volume.drivers.ibm.ibmnas.IBMNAS_NFSDriver' ibmnas_pass = get_password 'user', node['openstack']['block-storage']['ibmnas']['nas_login'] when 'cinder.volume.drivers.vmware.vmdk.VMwareVcVmdkDriver' @@ -105,6 +107,7 @@ template '/etc/cinder/cinder.conf' do glance_port: glance_api_endpoint.port, ibmnas_pass: ibmnas_pass, solidfire_pass: solidfire_pass, + flashsystem_pass: flashsystem_pass, storwize_pass: storwize_pass, volume_api_bind_address: cinder_api_bind.host, volume_api_bind_port: cinder_api_bind.port, diff --git a/recipes/volume.rb b/recipes/volume.rb index 0c288a8..46b9e0d 100644 --- a/recipes/volume.rb +++ b/recipes/volume.rb @@ -119,6 +119,14 @@ when 'cinder.volume.drivers.ibm.storwize_svc.StorwizeSVCDriver' end end +when 'cinder.volume.drivers.ibm.flashsystem.FlashSystemDriver' + platform_options['cinder_flashsystem_packages'].each do |pkg| + package pkg do + options platform_options['package_overrides'] + action :upgrade + end + end + when 'cinder.volume.drivers.ibm.gpfs.GPFSDriver' directory node['openstack']['block-storage']['gpfs']['gpfs_mount_point_base'] do mode '0755' diff --git a/spec/cinder_common_spec.rb b/spec/cinder_common_spec.rb index 27409c5..f6c72a3 100644 --- a/spec/cinder_common_spec.rb +++ b/spec/cinder_common_spec.rb @@ -683,6 +683,44 @@ describe 'openstack-block-storage::cinder-common' do end end + context 'flashsystem settings' do + before do + node.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.ibm.flashsystem.FlashSystemDriver' + end + + it 'has flashsystem password' do + expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', /^san_password=test_pass$/) + end + + it 'has a default attribute' do + %w(san_ip=127.0.0.1 + flashsystem_connection_protocol=FC + flashsystem_multihostmap_enabled=true).each do |attr| + expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', /^#{attr}$/) + end + end + + it 'has a overridden attribute' do + %w(san_ip + flashsystem_connection_protocol + flashsystem_multihostmap_enabled).each do |attr| + node.set['openstack']['block-storage']['flashsystem'][attr] = "flashsystem_#{attr}_value" + expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', /^#{attr}=flashsystem_#{attr}_value$/) + end + end + + context 'FlashSystem with FC connection protocol' do + before do + node.set['openstack']['block-storage']['storwize']['flashsystem_connection_protocol'] = 'FC' + end + + it 'has a multipath enabled attribute' do + node.set['openstack']['block-storage']['flashsystem']['flashsystem_multipath_enabled'] = 'flashsystem_multipath_enabled_value' + expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', /^flashsystem_multipath_enabled=flashsystem_multipath_enabled_value$/) + end + end + end + context 'emc settings' do before do node.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.emc.emc_smis_iscsi.EMCSMISISCSIDriver' diff --git a/spec/volume_spec.rb b/spec/volume_spec.rb index fa11620..1fc98f9 100644 --- a/spec/volume_spec.rb +++ b/spec/volume_spec.rb @@ -201,6 +201,16 @@ describe 'openstack-block-storage::volume' do end end + context 'FlashSystem Driver' do + before do + node.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.ibm.flashsystem.FlashSystemDriver' + end + + it 'upgrades sysfsutils package' do + expect(chef_run).to upgrade_package 'sysfsutils' + end + end + describe 'targets.conf' do let(:file) { chef_run.template('/etc/tgt/targets.conf') } diff --git a/templates/default/cinder.conf.erb b/templates/default/cinder.conf.erb index 2e59823..89a9019 100644 --- a/templates/default/cinder.conf.erb +++ b/templates/default/cinder.conf.erb @@ -800,6 +800,28 @@ iscsi_ip_prefix=<%= node["openstack"]["block-storage"]["solidfire"]["iscsi_ip_pr <% end %> <% end %> +<% if @enabled_drivers.include?("cinder.volume.drivers.ibm.flashsystem.FlashSystemDriver") -%> +######## defined in cinder.volume.drivers.ibm.flashsystem.FlashSystemDriver ######## + +san_ip=<%= node["openstack"]["block-storage"]["flashsystem"]["san_ip"] %> +#### (StrOpt) IP address of FlashSystem Cluster Node + +san_login=<%= node["openstack"]["block-storage"]["flashsystem"]["san_login"] %> +#### (StrOpt) Username for FlashSystem Cluster Admin + +san_password=<%= @flashsystem_pass %> +#### (StrOpt) Password for FlashSystem Cluster Admin + +flashsystem_connection_protocol=<%= node["openstack"]["block-storage"]["flashsystem"]["flashsystem_connection_protocol"] %> +#### (StrOpt) Connection protocol (FC only) + +flashsystem_multipath_enabled=<%= node["openstack"]["block-storage"]["flashsystem"]["flashsystem_multipath_enabled"] %> +#### (BoolOpt) Multipath flag (FC only) + +flashsystem_multihostmap_enabled=<%= node["openstack"]["block-storage"]["flashsystem"]["flashsystem_multihostmap_enabled"] %> +#### (BoolOpt) Multi host mapping flag +<% end -%> + #### (BoolOpt) Allow tenants to specify QOS on create <% if @enabled_drivers.include?("cinder.volume.drivers.ibm.storwize_svc.StorwizeSVCDriver") %> ######## defined in cinder.volume.storwize_svc ########