Update Cinder BDD backend configuration

Currently Cinder BDD backend is used only fake iscsi_helper - which
is allow to attach volumes only locally. Since [1] merged BlockDeviceDriver
supports to attach volumes to any instance on any node. Hence we need
to manage needed daemons.

[1] Ic22f03860a43b767e9097ce6dc5b397cf9f3f076

Related-bug: #1560499
Change-Id: Ifee3fb8435cb48a3087f5924c3b01ec94275a5eb
This commit is contained in:
Denis Egorenko 2016-03-23 19:41:53 +03:00
parent a9912c88a5
commit 9c11b47dc4
2 changed files with 43 additions and 4 deletions

View File

@ -30,7 +30,7 @@
#
# [*iscsi_helper*]
# (Optional) iSCSI target user-land tool to use.
# Defaults to fake.
# Defaults to tgtadm.
#
# [*iscsi_protocol*]
# (Optional) Protocol to use as iSCSI driver
@ -64,7 +64,7 @@ define cinder::backend::bdd (
$volume_driver = 'cinder.volume.drivers.block_device.BlockDeviceDriver',
$volume_group = $::os_service_default,
$volumes_dir = '/var/lib/cinder/volumes',
$iscsi_helper = 'fake',
$iscsi_helper = 'tgtadm',
$iscsi_protocol = $::os_service_default,
$volume_clear = $::os_service_default,
$extra_options = {},
@ -86,4 +86,41 @@ define cinder::backend::bdd (
create_resources('cinder_config', $extra_options)
case $iscsi_helper {
'tgtadm': {
ensure_packages('tgt', {
ensure => present,
name => $::cinder::params::tgt_package_name})
ensure_resource('service', 'tgtd', {
ensure => present,
name => $::cinder::params::tgt_service_name,
require => Package['tgt']})
if($::osfamily == 'RedHat') {
ensure_resource('file_line', 'cinder include', {
path => '/etc/tgt/targets.conf',
line => "include ${volumes_dir}/*",
match => '#?include /',
require => Package['tgt'],
notify => Service['tgtd']})
}
}
'lioadm': {
ensure_packages('targetcli', {
ensure => present,
name => $::cinder::params::lio_package_name})
ensure_resource('service', 'target', {
ensure => running,
enable => true,
require => Package['targetcli']})
}
default: {
fail("Unsupported iscsi helper: ${iscsi_helper}.")
}
}
}

View File

@ -16,7 +16,7 @@ describe 'cinder::backend::bdd' do
should contain_cinder_config('hippo/volume_backend_name').with_value('hippo')
should contain_cinder_config('hippo/volume_driver').with_value('cinder.volume.drivers.block_device.BlockDeviceDriver')
should contain_cinder_config('hippo/available_devices').with_value('/dev/sda')
should contain_cinder_config('hippo/iscsi_helper').with_value('fake')
should contain_cinder_config('hippo/iscsi_helper').with_value('tgtadm')
should contain_cinder_config('hippo/volumes_dir').with_value('/var/lib/cinder/volumes')
should contain_cinder_config('hippo/iscsi_ip_address').with_value('127.0.0.2')
should contain_cinder_config('hippo/volume_group').with_value('<SERVICE DEFAULT>')
@ -32,7 +32,8 @@ describe 'cinder::backend::bdd' do
:available_devices => '/dev/sdb,/dev/sdc',
:volumes_dir => '/var/lib/cinder/bdd-volumes',
:volume_clear => 'zero',
:volume_group => 'cinder',
:volume_group => 'cinder',
:iscsi_helper => 'lioadm',
})
end
@ -40,6 +41,7 @@ describe 'cinder::backend::bdd' do
should contain_cinder_config('hippo/available_devices').with_value('/dev/sdb,/dev/sdc')
should contain_cinder_config('hippo/volumes_dir').with_value('/var/lib/cinder/bdd-volumes')
should contain_cinder_config('hippo/iscsi_ip_address').with_value('10.20.0.2')
should contain_cinder_config('hippo/iscsi_helper').with_value('lioadm')
should contain_cinder_config('hippo/volume_group').with_value('cinder')
should contain_cinder_config('hippo/volume_clear').with_value('zero')
end