From 191b1c39533d178e88ead403de1b1bc0c2515fed Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Thu, 6 Sep 2012 12:23:45 +0200 Subject: [PATCH] Add support for the 'iscsitarget' implementation of iscsi_helper, an alternative to tgtadm. It requires two packages ( iscsitarget and iscsitarget-dkms ) and runs two services ( open-iscsi and iscsitarget ). --- manifests/volume/iscsi.pp | 28 +++++++++++++++++++++++++- spec/classes/nova_volume_iscsi_spec.rb | 14 +++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/manifests/volume/iscsi.pp b/manifests/volume/iscsi.pp index e0147f5ca..32aeac8e5 100644 --- a/manifests/volume/iscsi.pp +++ b/manifests/volume/iscsi.pp @@ -49,8 +49,34 @@ class nova::volume::iscsi ( nova_config { 'iscsi_helper': value => 'tgtadm' } } + 'iscsitarget': { + package { 'iscsitarget': + ensure => present, + } + + service { 'iscsitarget': + ensure => running, + enable => true, + require => [Nova::Generic_service['volume'], Package['iscsitarget']], + } + + service { 'open-iscsi': + ensure => running, + enable => true, + require => Service['iscsitarget'], + } + + package { 'iscsitarget-dkms': + ensure => present, + } + + file { '/etc/default/iscsitarget': + content => "ISCSITARGET_ENABLE=true\n", + } + } + default: { - fail("Unsupported iscsi helper: ${iscsi_helper}. The supported iscsi helper is tgtadm.") + fail("Unsupported iscsi helper: ${iscsi_helper}. The supported iscsi helper are tgtadm, iscsitarget.") } } } diff --git a/spec/classes/nova_volume_iscsi_spec.rb b/spec/classes/nova_volume_iscsi_spec.rb index b086a080a..c086e9e06 100644 --- a/spec/classes/nova_volume_iscsi_spec.rb +++ b/spec/classes/nova_volume_iscsi_spec.rb @@ -25,6 +25,20 @@ describe 'nova::volume::iscsi' do )} end + describe 'and more specifically on debian os with iscsitarget helper' do + let :facts do + { :osfamily => 'Debian', :operatingsystem => 'Debian' } + end + let :params do + {:iscsi_helper => 'iscsitarget'} + end + it { should contain_package('iscsitarget') } + it { should contain_service('iscsitarget').with_enable(true) } + it { should contain_service('open-iscsi').with_enable(true) } + it { should contain_package('iscsitarget-dkms') } + it { should contain_file('/etc/default/iscsitarget') } + end + it { should contain_nova_config('volume_group').with_value('nova-volumes') } it { should_not contain_nova_config('iscsi_ip_address') }