Avoid defining resources twice in iscsi backend
In its current form, cinder::backend::iscsi is a define, allowing to call it multiple times, which is desirable (if a server has multiple backends). However, some resources are defined twice if the class is called twice. To avoid this, this patch decorates the resource definition for packages and services with if !defined. Change-Id: I779dfd416da6fe8bb713105ed246172ebf0aae85
This commit is contained in:
parent
f22af86550
commit
715263c21c
@ -98,11 +98,13 @@ define cinder::backend::iscsi (
|
|||||||
|
|
||||||
case $target_helper {
|
case $target_helper {
|
||||||
'tgtadm': {
|
'tgtadm': {
|
||||||
|
if ! defined(Package['tgt']) {
|
||||||
package { 'tgt':
|
package { 'tgt':
|
||||||
ensure => present,
|
ensure => present,
|
||||||
name => $::cinder::params::tgt_package_name,
|
name => $::cinder::params::tgt_package_name,
|
||||||
tag => 'cinder-support-package',
|
tag => 'cinder-support-package',
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if($::osfamily == 'RedHat') {
|
if($::osfamily == 'RedHat') {
|
||||||
file_line { 'cinder include':
|
file_line { 'cinder include':
|
||||||
@ -114,6 +116,7 @@ define cinder::backend::iscsi (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ! defined(Service['tgtd']) {
|
||||||
service { 'tgtd':
|
service { 'tgtd':
|
||||||
ensure => running,
|
ensure => running,
|
||||||
name => $::cinder::params::tgt_service_name,
|
name => $::cinder::params::tgt_service_name,
|
||||||
@ -121,20 +124,25 @@ define cinder::backend::iscsi (
|
|||||||
tag => 'cinder-support-service',
|
tag => 'cinder-support-service',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
'lioadm': {
|
'lioadm': {
|
||||||
|
if ! defined(Service['target']) {
|
||||||
service { 'target':
|
service { 'target':
|
||||||
ensure => running,
|
ensure => running,
|
||||||
enable => true,
|
enable => true,
|
||||||
tag => 'cinder-support-service',
|
tag => 'cinder-support-service',
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ! defined(Package['targetcli']) {
|
||||||
package { 'targetcli':
|
package { 'targetcli':
|
||||||
ensure => present,
|
ensure => present,
|
||||||
name => $::cinder::params::lio_package_name,
|
name => $::cinder::params::lio_package_name,
|
||||||
tag => 'cinder-support-package',
|
tag => 'cinder-support-package',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
fail("Unsupported target helper: ${target_helper}.")
|
fail("Unsupported target helper: ${target_helper}.")
|
||||||
|
Loading…
Reference in New Issue
Block a user