Configure iscsi target service for RHEL7

In RHEL7, tgtd is replaced by LIO, and target deamon service and
targetcli package is used to manage iscsi target.

This fix also set iscsi_helper to lioadm for RHEL7

Change-Id: I5a5b1faec6a6aed9b9f3d5632e704a59e2d5c7b7
closes-bug: #1409619
This commit is contained in:
Jin Hui 2015-01-13 17:14:59 +08:00
parent 0f61b0e4a2
commit 996254f21c
5 changed files with 20 additions and 58 deletions

View File

@ -2,9 +2,11 @@ openstack-block-storage Cookbook CHANGELOG
============================== ==============================
This file is used to list changes made in each version of the openstack-block-storage cookbook. This file is used to list changes made in each version of the openstack-block-storage cookbook.
## 10.1.0 ## 10.1.0
* Add disable logic for stage fix to tgtd issue on RHEL 7
* Use common specific_endpoint routines (bug 1412919) * Use common specific_endpoint routines (bug 1412919)
* Install qemu-img package for volume nodes * Install qemu-img package for volume nodes
* update iscsi_helper for RHEL7
* update cinder_iscsitarget_packages for RHEL7
* update cinder_iscsitarget_service for RHEL7
## 10.0.1 ## 10.0.1
# Update cinder.conf mode from 0644 to 0640 # Update cinder.conf mode from 0644 to 0640

View File

@ -305,6 +305,7 @@ when 'fedora', 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
# operating system user and group names # operating system user and group names
default['openstack']['block-storage']['user'] = 'cinder' default['openstack']['block-storage']['user'] = 'cinder'
default['openstack']['block-storage']['group'] = 'cinder' default['openstack']['block-storage']['group'] = 'cinder'
default['openstack']['block-storage']['volume']['iscsi_helper'] = 'lioadm'
default['openstack']['block-storage']['platform'] = { default['openstack']['block-storage']['platform'] = {
'cinder_common_packages' => ['openstack-cinder'], 'cinder_common_packages' => ['openstack-cinder'],
@ -315,21 +316,14 @@ when 'fedora', 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
'cinder_volume_service' => 'openstack-cinder-volume', 'cinder_volume_service' => 'openstack-cinder-volume',
'cinder_scheduler_packages' => [], 'cinder_scheduler_packages' => [],
'cinder_scheduler_service' => 'openstack-cinder-scheduler', 'cinder_scheduler_service' => 'openstack-cinder-scheduler',
'cinder_iscsitarget_packages' => ['scsi-target-utils'], 'cinder_iscsitarget_packages' => ['targetcli'],
'cinder_iscsitarget_service' => 'tgtd', 'cinder_iscsitarget_service' => 'target',
'cinder_ceph_packages' => ['python-ceph', 'ceph-common'], 'cinder_ceph_packages' => ['python-ceph', 'ceph-common'],
'cinder_nfs_packages' => ['nfs-utils', 'nfs-utils-lib'], 'cinder_nfs_packages' => ['nfs-utils', 'nfs-utils-lib'],
'cinder_emc_packages' => ['pywbem'], 'cinder_emc_packages' => ['pywbem'],
'cinder_svc_packages' => ['sysfsutils'], 'cinder_svc_packages' => ['sysfsutils'],
'package_overrides' => '' 'package_overrides' => ''
} }
if platform_family == 'rhel' && platform_version.to_i == 7
# On RHEL7, tgtd has been removed, disable it here just for now.
# This is a stage fix for bug #1400958, new logic should be added to fully
# support new targetcli on RHEL7
default['openstack']['block-storage']['platform']['cinder_iscsitarget_packages'] = []
default['openstack']['block-storage']['platform']['cinder_iscsitarget_service'] = []
end
when 'suse' when 'suse'
# operating system user and group names # operating system user and group names
default['openstack']['block-storage']['user'] = 'openstack-cinder' default['openstack']['block-storage']['user'] = 'openstack-cinder'

View File

@ -227,19 +227,16 @@ service 'cinder-volume' do
subscribes :restart, 'template[/etc/cinder/cinder.conf]' subscribes :restart, 'template[/etc/cinder/cinder.conf]'
end end
unless node['platform_family'] == 'rhel' && node['platform_version'].to_i == 7 service 'iscsitarget' do
# On RHEL7, tgtd has been removed, disable it here just for now. service_name platform_options['cinder_iscsitarget_service']
# This is a stage fix for bug #1400958, new logic should be added to fully supports status: true, restart: true
# support new targetcli on RHEL7 action :enable
service 'iscsitarget' do end
service_name platform_options['cinder_iscsitarget_service']
supports status: true, restart: true # RHEL7 doesn't need targets.conf file
action :enable template '/etc/tgt/targets.conf' do
end source 'targets.conf.erb'
mode 00600
template '/etc/tgt/targets.conf' do notifies :restart, 'service[iscsitarget]', :immediately
source 'targets.conf.erb' not_if { node['platform_family'] == 'rhel' && node['platform_version'].to_i == 7 }
mode 00600
notifies :restart, 'service[iscsitarget]', :immediately
end
end end

View File

@ -16,11 +16,6 @@ SUSE_OPTS = {
log_level: LOG_LEVEL log_level: LOG_LEVEL
} }
REDHAT_OPTS = { REDHAT_OPTS = {
platform: 'redhat',
version: '6.5',
log_level: LOG_LEVEL
}
REDHAT7_OPTS = {
platform: 'redhat', platform: 'redhat',
version: '7.0', version: '7.0',
log_level: LOG_LEVEL log_level: LOG_LEVEL

View File

@ -36,7 +36,7 @@ describe 'openstack-block-storage::volume' do
end end
it 'upgrades cinder iscsi package' do it 'upgrades cinder iscsi package' do
expect(chef_run).to upgrade_package('scsi-target-utils') expect(chef_run).to upgrade_package('targetcli')
end end
it 'starts cinder volume' do it 'starts cinder volume' do
@ -48,17 +48,8 @@ describe 'openstack-block-storage::volume' do
end end
context 'ISCSI' do context 'ISCSI' do
let(:file) { chef_run.template('/etc/tgt/targets.conf') }
it 'starts iscsi target on boot' do it 'starts iscsi target on boot' do
expect(chef_run).to enable_service('tgtd') expect(chef_run).to enable_service('target')
end
it 'has redhat include' do
node.set['openstack']['block-storage']['volume']['volumes_dir'] = 'volumes_dir_value'
expect(chef_run).to render_file(file.name).with_content(
'include volumes_dir_value/*')
expect(chef_run).not_to render_file(file.name).with_content(
'include /etc/tgt/conf.d/*.conf')
end end
end end
@ -191,22 +182,5 @@ describe 'openstack-block-storage::volume' do
end end
end end
end end
end
describe 'redhat' do
let(:runner) { ChefSpec::Runner.new(REDHAT7_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }
include_context 'block-storage-stubs'
it 'disable tgtd for rhel7' do
# test temp solution for RHEL7 to disable tgtd
# stage fix for bug #1400958
expect(chef_run).not_to upgrade_package('scsi-target-utils')
expect(chef_run).not_to enable_service('iscsitarget')
expect(chef_run).not_to create_template('/etc/tgt/targets.conf')
end
end end
end end