Add EMC VMAX/VNX support as a provider for cinder
- Add EMC attributes - Create cinder_emc_config.xml when EMC driver is used. - Installs appropriate packages when EMC driver is used. - Add tests for new cinder_emc_config.xml - Add tests for changed attributes in existing cinder.conf - Add tests for package installs Change-Id: I5a44e3626784814f57e15a43ce459a4d36d31c6b Implements: blueprint emc-cinder-provider
This commit is contained in:
parent
2c1e480a81
commit
e7bcd475a9
|
@ -139,6 +139,18 @@ default['openstack']['block-storage']['solidfire']['san_password'] = node['opens
|
|||
default['openstack']['block-storage']['solidfire']['sf_emulate'] = 'False'
|
||||
default['openstack']['block-storage']['solidfire']['iscsi_ip_prefix'] = nil
|
||||
|
||||
# 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
|
||||
# are expected to create the user and pass in a wrapper cookbook.
|
||||
default['openstack']['block-storage']['emc']['iscsi_target_prefix'] = 'iqn.1992-04.com.emc'
|
||||
default['openstack']['block-storage']['emc']['cinder_emc_config_file'] = '/etc/cinder/cinder_emc_config.xml'
|
||||
default['openstack']['block-storage']['emc']['StorageType'] = 0
|
||||
default['openstack']['block-storage']['emc']['EcomServerIP'] = '127.0.0.1'
|
||||
default['openstack']['block-storage']['emc']['EcomServerPort'] = '5988'
|
||||
default['openstack']['block-storage']['emc']['EcomUserName'] = 'admin'
|
||||
default['openstack']['block-storage']['emc']['MaskingView'] = nil
|
||||
|
||||
# logging attribute
|
||||
default['openstack']['block-storage']['syslog']['use'] = false
|
||||
default['openstack']['block-storage']['syslog']['facility'] = 'LOG_LOCAL2'
|
||||
|
@ -197,6 +209,7 @@ when 'fedora', 'redhat', 'centos' # :pragma-foodcritic: ~FC024 - won't fix this
|
|||
'cinder_iscsitarget_service' => 'tgtd',
|
||||
'cinder_ceph_packages' => ['python-ceph'],
|
||||
'cinder_nfs_packages' => ['nfs-utils', 'nfs-utils-lib'],
|
||||
'cinder_emc_packages' => ['pywbem'],
|
||||
'package_overrides' => ''
|
||||
}
|
||||
when 'suse'
|
||||
|
@ -217,7 +230,8 @@ when 'suse'
|
|||
'cinder_ceph_packages' => ['python-ceph'],
|
||||
'cinder_iscsitarget_packages' => ['tgt'],
|
||||
'cinder_iscsitarget_service' => 'tgtd',
|
||||
'cinder_nfs_packages' => ['nfs-utils']
|
||||
'cinder_nfs_packages' => ['nfs-utils'],
|
||||
'cinder_emc_packages' => ['python-pywbem']
|
||||
}
|
||||
when 'ubuntu'
|
||||
# operating system user and group names
|
||||
|
@ -238,6 +252,7 @@ when 'ubuntu'
|
|||
'cinder_iscsitarget_packages' => ['tgt'],
|
||||
'cinder_iscsitarget_service' => 'tgt',
|
||||
'cinder_nfs_packages' => ['nfs-common'],
|
||||
'cinder_emc_packages' => ['python-pywbem'],
|
||||
'package_overrides' => "-o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef'"
|
||||
}
|
||||
end
|
||||
|
|
|
@ -150,6 +150,25 @@ when 'cinder.volume.drivers.lvm.LVMISCSIDriver'
|
|||
action [:enable, :start]
|
||||
end
|
||||
end
|
||||
|
||||
when 'cinder.volume.drivers.emc.emc_smis_iscsi.EMCSMISISCSIDriver'
|
||||
platform_options['cinder_emc_packages'].each do |pkg|
|
||||
package pkg do
|
||||
options platform_options['package_overrides']
|
||||
action :upgrade
|
||||
end
|
||||
end
|
||||
|
||||
ecom_password = get_password('user', node['openstack']['block-storage']['emc']['EcomUserName'])
|
||||
|
||||
template node['openstack']['block-storage']['emc']['cinder_emc_config_file'] do
|
||||
source 'cinder_emc_config.xml.erb'
|
||||
variables(
|
||||
ecom_password: ecom_password
|
||||
)
|
||||
mode 00644
|
||||
notifies :restart, 'service[iscsitarget]', :immediately
|
||||
end
|
||||
end
|
||||
|
||||
service 'cinder-volume' do
|
||||
|
|
|
@ -287,6 +287,23 @@ describe 'openstack-block-storage::cinder-common' do
|
|||
expect(@chef_run).to render_file(@file.name).with_content('iscsi_ip_prefix=203.0.113.*')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'emc settings' do
|
||||
before do
|
||||
@chef_run.node.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.emc.emc_smis_iscsi.EMCSMISISCSIDriver'
|
||||
@chef_run.node.set['openstack']['block-storage']['emc']['iscsi_target_prefix'] = 'test.prefix'
|
||||
@chef_run.node.set['openstack']['block-storage']['emc']['cinder_emc_config_file'] = '/etc/test/config.file'
|
||||
@chef_run.converge 'openstack-block-storage::cinder-common'
|
||||
end
|
||||
|
||||
it 'has emc iscsi_target_prefix' do
|
||||
expect(@chef_run).to render_file(@file.name).with_content('iscsi_target_prefix=test.prefix')
|
||||
end
|
||||
|
||||
it 'has cinder_emc_config_file' do
|
||||
expect(@chef_run).to render_file(@file.name).with_content('cinder_emc_config_file=/etc/test/config.file')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '/var/lock/cinder' do
|
||||
|
@ -303,5 +320,4 @@ describe 'openstack-block-storage::cinder-common' do
|
|||
expect(sprintf('%o', @dir.mode)).to eq '700'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -51,6 +51,9 @@ def block_storage_stubs # rubocop:disable MethodLength
|
|||
::Chef::Recipe.any_instance.stub(:get_password)
|
||||
.with('service', 'openstack_image_cephx_key')
|
||||
.and_return('cephx-key')
|
||||
::Chef::Recipe.any_instance.stub(:get_password)
|
||||
.with('user', 'admin')
|
||||
.and_return('emc_test_pass')
|
||||
::Chef::Application.stub(:fatal!)
|
||||
end
|
||||
|
||||
|
|
|
@ -64,6 +64,15 @@ describe 'openstack-block-storage::volume' do
|
|||
expect(chef_run).to upgrade_package 'nfs-utils-lib'
|
||||
end
|
||||
|
||||
it 'installs emc packages' do
|
||||
chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS do |n|
|
||||
n.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.emc.emc_smis_iscsi.EMCSMISISCSIDriver'
|
||||
end
|
||||
chef_run.converge 'openstack-block-storage::volume'
|
||||
|
||||
expect(chef_run).to upgrade_package 'pywbem'
|
||||
end
|
||||
|
||||
it 'has redhat include' do
|
||||
file = '/etc/tgt/targets.conf'
|
||||
|
||||
|
|
|
@ -57,6 +57,15 @@ describe 'openstack-block-storage::volume' do
|
|||
expect(chef_run).not_to upgrade_package 'nfs-utils-lib'
|
||||
end
|
||||
|
||||
it 'installs emc packages' do
|
||||
chef_run = ::ChefSpec::Runner.new ::SUSE_OPTS do |n|
|
||||
n.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.emc.emc_smis_iscsi.EMCSMISISCSIDriver'
|
||||
end
|
||||
chef_run.converge 'openstack-block-storage::volume'
|
||||
|
||||
expect(chef_run).to upgrade_package 'python-pywbem'
|
||||
end
|
||||
|
||||
it 'has suse include' do
|
||||
file = '/etc/tgt/targets.conf'
|
||||
|
||||
|
|
|
@ -45,6 +45,15 @@ describe 'openstack-block-storage::volume' do
|
|||
expect(@chef_run).to upgrade_package 'tgt'
|
||||
end
|
||||
|
||||
it 'installs emc packages' do
|
||||
chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n|
|
||||
n.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.emc.emc_smis_iscsi.EMCSMISISCSIDriver'
|
||||
end
|
||||
chef_run.converge 'openstack-block-storage::volume'
|
||||
|
||||
expect(chef_run).to upgrade_package 'python-pywbem'
|
||||
end
|
||||
|
||||
it 'installs nfs packages' do
|
||||
chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n|
|
||||
n.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.netapp.nfs.NetAppDirect7modeNfsDriver'
|
||||
|
@ -240,5 +249,58 @@ describe 'openstack-block-storage::volume' do
|
|||
expect(@chef_run).to create_template(@filename)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'cinder_emc_config.xml' do
|
||||
before do
|
||||
@chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n|
|
||||
n.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.emc.emc_smis_iscsi.EMCSMISISCSIDriver'
|
||||
end
|
||||
@chef_run.converge 'openstack-block-storage::volume'
|
||||
@filename = '/etc/cinder/cinder_emc_config.xml'
|
||||
@file = @chef_run.template(@filename)
|
||||
end
|
||||
|
||||
it 'creates cinder emc config file' do
|
||||
expect(@chef_run).to create_template(@filename)
|
||||
end
|
||||
|
||||
it 'has proper modes' do
|
||||
expect(sprintf('%o', @file.mode)).to eq('644')
|
||||
end
|
||||
|
||||
it 'has StorageType' do
|
||||
expect(@chef_run).to render_file(@file.name).with_content('<StorageType>0</StorageType>')
|
||||
end
|
||||
|
||||
it 'has EcomServerIp' do
|
||||
expect(@chef_run).to render_file(@file.name).with_content('<EcomServerIp>127.0.0.1</EcomServerIp>')
|
||||
end
|
||||
|
||||
it 'has EcomServerPort' do
|
||||
expect(@chef_run).to render_file(@file.name).with_content('<EcomServerPort>5988</EcomServerPort>')
|
||||
end
|
||||
|
||||
it 'has EcomUserName' do
|
||||
expect(@chef_run).to render_file(@file.name).with_content('<EcomUserName>admin</EcomUserName>')
|
||||
end
|
||||
|
||||
it 'has EcomPassword' do
|
||||
expect(@chef_run).to render_file(@file.name).with_content('<EcomPassword>emc_test_pass</EcomPassword>')
|
||||
end
|
||||
|
||||
it 'does not have MaskingView when not specified' do
|
||||
expect(@chef_run).not_to render_file(@file.name).with_content('<MaskingView>')
|
||||
end
|
||||
|
||||
it 'has MaskingView when specified' do
|
||||
@chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n|
|
||||
n.set['openstack']['block-storage']['emc']['MaskingView'] = 'testMaskingView'
|
||||
n.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.emc.emc_smis_iscsi.EMCSMISISCSIDriver'
|
||||
end
|
||||
@chef_run.converge 'openstack-block-storage::volume'
|
||||
|
||||
expect(@chef_run).to render_file(@file.name).with_content('<MaskingView>testMaskingView</MaskingView>')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -808,6 +808,13 @@ storwize_svc_multihostmap_enabled=<%= node["openstack"]["block-storage"]["storwi
|
|||
|
||||
<% end %>
|
||||
|
||||
<% if node["openstack"]["block-storage"]["volume"]["driver"] == "cinder.volume.drivers.emc.emc_smis_iscsi.EMCSMISISCSIDriver" %>
|
||||
|
||||
iscsi_target_prefix=<%= node["openstack"]["block-storage"]["emc"]["iscsi_target_prefix"] %>
|
||||
cinder_emc_config_file=<%= node["openstack"]["block-storage"]["emc"]["cinder_emc_config_file"] %>
|
||||
|
||||
<% end %>
|
||||
|
||||
######## defined in cinder.volume.xiv ########
|
||||
|
||||
# xiv_proxy=xiv_openstack.nova_proxy.XIVNovaProxy
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<EMC>
|
||||
<StorageType><%= node["openstack"]["block-storage"]["emc"]["StorageType"] %></StorageType>
|
||||
<EcomServerIp><%= node["openstack"]["block-storage"]["emc"]["EcomServerIP"] %></EcomServerIp>
|
||||
<EcomServerPort><%= node["openstack"]["block-storage"]["emc"]["EcomServerPort"] %></EcomServerPort>
|
||||
<EcomUserName><%= node["openstack"]["block-storage"]["emc"]["EcomUserName"] %></EcomUserName>
|
||||
<EcomPassword><%= @ecom_password %></EcomPassword>
|
||||
<% unless node["openstack"]["block-storage"]["emc"]["MaskingView"].nil? %>
|
||||
<MaskingView><%= node["openstack"]["block-storage"]["emc"]["MaskingView"] %></MaskingView>
|
||||
<% end %>
|
||||
</EMC>
|
Loading…
Reference in New Issue