From c4f4a30922fd1ad702ade8d11a5ced0c13c45a88 Mon Sep 17 00:00:00 2001 From: Derek Higgins Date: Thu, 8 Nov 2012 09:40:12 -0500 Subject: [PATCH] Include /etc/cinder/volumes/ in tgt targets.conf This config isn't included in the RHEL packages --- manifests/volume/iscsi.pp | 11 +++++++++++ spec/classes/cinder_volume_iscsi_spec.rb | 17 +++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/manifests/volume/iscsi.pp b/manifests/volume/iscsi.pp index ad39fa2f..4099b876 100644 --- a/manifests/volume/iscsi.pp +++ b/manifests/volume/iscsi.pp @@ -19,6 +19,17 @@ class cinder::volume::iscsi ( name => $::cinder::params::tgt_package_name, ensure => present, } + + if($::osfamily == 'RedHat') { + file_line { 'cinder include': + path => '/etc/tgt/targets.conf', + line => "include /etc/cinder/volumes/*", + match => '#?include /', + require => Package['tgt'], + notify => Service['tgtd'], + } + } + service { 'tgtd': name => $::cinder::params::tgt_service_name, ensure => running, diff --git a/spec/classes/cinder_volume_iscsi_spec.rb b/spec/classes/cinder_volume_iscsi_spec.rb index ad8202e7..fe0a7f77 100644 --- a/spec/classes/cinder_volume_iscsi_spec.rb +++ b/spec/classes/cinder_volume_iscsi_spec.rb @@ -28,4 +28,21 @@ describe 'cinder::volume::iscsi' do end + describe 'with RedHat' do + + let :params do + req_params + end + + let :facts do + {:osfamily => 'RedHat'} + end + + it { should contain_file_line('cinder include').with( + :line => 'include /etc/cinder/volumes/*', + :path => '/etc/tgt/targets.conf' + ) } + + end + end