Merge "Update Cinder BDD backend configuration"

This commit is contained in:
Jenkins
2016-03-23 22:41:46 +00:00
committed by Gerrit Code Review
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