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,10 +98,12 @@ define cinder::backend::iscsi (
|
||||
|
||||
case $target_helper {
|
||||
'tgtadm': {
|
||||
package { 'tgt':
|
||||
ensure => present,
|
||||
name => $::cinder::params::tgt_package_name,
|
||||
tag => 'cinder-support-package',
|
||||
if ! defined(Package['tgt']) {
|
||||
package { 'tgt':
|
||||
ensure => present,
|
||||
name => $::cinder::params::tgt_package_name,
|
||||
tag => 'cinder-support-package',
|
||||
}
|
||||
}
|
||||
|
||||
if($::osfamily == 'RedHat') {
|
||||
@ -114,25 +116,31 @@ define cinder::backend::iscsi (
|
||||
}
|
||||
}
|
||||
|
||||
service { 'tgtd':
|
||||
ensure => running,
|
||||
name => $::cinder::params::tgt_service_name,
|
||||
enable => true,
|
||||
tag => 'cinder-support-service',
|
||||
if ! defined(Service['tgtd']) {
|
||||
service { 'tgtd':
|
||||
ensure => running,
|
||||
name => $::cinder::params::tgt_service_name,
|
||||
enable => true,
|
||||
tag => 'cinder-support-service',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
'lioadm': {
|
||||
service { 'target':
|
||||
ensure => running,
|
||||
enable => true,
|
||||
tag => 'cinder-support-service',
|
||||
if ! defined(Service['target']) {
|
||||
service { 'target':
|
||||
ensure => running,
|
||||
enable => true,
|
||||
tag => 'cinder-support-service',
|
||||
}
|
||||
}
|
||||
|
||||
package { 'targetcli':
|
||||
ensure => present,
|
||||
name => $::cinder::params::lio_package_name,
|
||||
tag => 'cinder-support-package',
|
||||
if ! defined(Package['targetcli']) {
|
||||
package { 'targetcli':
|
||||
ensure => present,
|
||||
name => $::cinder::params::lio_package_name,
|
||||
tag => 'cinder-support-package',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user