lvm: Modify targets.conf in Ubuntu/Debian
The cinder-common package in Ubuntu and Debian used to provide the additional config file for tgt daemon to allow the daemon to expose volumes managed by cinder. However that config file is no longer provided by the package since Wallaby release and now creating attachment fails with the following warning in cinder-volume.log. ``` Failed to create iscsi target for Volume ID: volume-<UUID>. It could be caused by problem with concurrency. Also please ensure your tgtd config file contains 'include /var/lib/cinder/volumes/*' ``` This change ensures the include line is added in Ubuntu/Debian to fix the error. Closes-Bug: #1986518 Change-Id: I0c0615c919447164718c265af603fbc4f5e66b1e (cherry picked from commit94e4e8c5ae
) (cherry picked from commit34b9f69b68
)
This commit is contained in:
parent
904318622e
commit
605430e6c4
|
@ -104,15 +104,13 @@ define cinder::backend::iscsi (
|
|||
'tag' => 'cinder-support-package',
|
||||
})
|
||||
|
||||
if($::osfamily == 'RedHat') {
|
||||
ensure_resource('file_line', "cinder include ${volumes_dir}", {
|
||||
'path' => '/etc/tgt/targets.conf',
|
||||
'line' => "include ${volumes_dir}/*",
|
||||
'match' => '#?include /',
|
||||
'require' => Anchor['cinder::install::end'],
|
||||
'notify' => Anchor['cinder::service::begin'],
|
||||
})
|
||||
}
|
||||
ensure_resource('file_line', "cinder include ${volumes_dir}", {
|
||||
'path' => '/etc/tgt/targets.conf',
|
||||
'line' => "include ${volumes_dir}/*",
|
||||
'match' => '#?include /',
|
||||
'require' => Anchor['cinder::install::end'],
|
||||
'notify' => Anchor['cinder::service::begin'],
|
||||
})
|
||||
|
||||
ensure_resource('service', 'tgtd', {
|
||||
'ensure' => running,
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
fixes:
|
||||
- |
|
||||
`Bug #1986518 <https://bugs.launchpad.net/puppet-cinder/+bug/1986518>`_:
|
||||
The ``cinder::backend::iscsi`` defined resource type now modifies
|
||||
the ``/etc/tgt/targets.conf`` file in Ubuntu and Debian, so that cinder can
|
||||
set up iscsi targets correctly.
|
|
@ -38,6 +38,10 @@ describe 'cinder::backend::iscsi' do
|
|||
is_expected.to contain_cinder_config('hippo/volumes_dir').with_value('/var/lib/cinder/volumes')
|
||||
is_expected.to contain_cinder_config('hippo/target_protocol').with_value('<SERVICE DEFAULT>')
|
||||
}
|
||||
it { is_expected.to contain_file_line('cinder include /var/lib/cinder/volumes').with(
|
||||
:line => 'include /var/lib/cinder/volumes/*',
|
||||
:path => '/etc/tgt/targets.conf'
|
||||
)}
|
||||
end
|
||||
|
||||
context 'with iser protocol' do
|
||||
|
@ -54,6 +58,10 @@ describe 'cinder::backend::iscsi' do
|
|||
end
|
||||
|
||||
it { is_expected.to contain_cinder_config('hippo/volumes_dir').with_value('/etc/cinder/volumes') }
|
||||
it { is_expected.to contain_file_line('cinder include /etc/cinder/volumes').with(
|
||||
:line => 'include /etc/cinder/volumes/*',
|
||||
:path => '/etc/tgt/targets.conf'
|
||||
)}
|
||||
end
|
||||
|
||||
context 'iscsi backend with cinder type' do
|
||||
|
@ -78,13 +86,6 @@ describe 'cinder::backend::iscsi' do
|
|||
end
|
||||
end
|
||||
|
||||
shared_examples 'cinder::backend::iscsi on RedHat' do
|
||||
it { is_expected.to contain_file_line('cinder include /var/lib/cinder/volumes').with(
|
||||
:line => 'include /var/lib/cinder/volumes/*',
|
||||
:path => '/etc/tgt/targets.conf'
|
||||
)}
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
|
@ -94,10 +95,6 @@ describe 'cinder::backend::iscsi' do
|
|||
end
|
||||
|
||||
it_behaves_like 'cinder::backend::iscsi'
|
||||
|
||||
if facts[:osfamily] == 'RedHat'
|
||||
it_behaves_like 'cinder::backend::iscsi on RedHat'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue