nfs: Ensure nova/glance permissions on nfs mount
Ensure filesystem_store_datadir is a directory with nova or glance permissions before creating the nfs mount. Change-Id: I06a0d95af3829cd803b0af0ebc52fd17b18ff2b3 Closes-Bug: #1443994
This commit is contained in:
parent
353d1bf857
commit
3ab3b139fd
@ -170,6 +170,12 @@ class cloud::compute::hypervisor(
|
||||
# We mount the NFS share in filesystem_store_datadir to fake the
|
||||
# backend.
|
||||
if $nfs_device {
|
||||
file { $filesystem_store_datadir:
|
||||
ensure => 'directory',
|
||||
owner => 'nova',
|
||||
group => 'nova',
|
||||
mode => '0755'
|
||||
}
|
||||
nova_config { 'DEFAULT/instances_path': value => $filesystem_store_datadir; }
|
||||
$nfs_mount = {
|
||||
"${filesystem_store_datadir}" => {
|
||||
@ -180,7 +186,7 @@ class cloud::compute::hypervisor(
|
||||
}
|
||||
}
|
||||
ensure_resource('class', 'nfs', {})
|
||||
create_resources('types::mount', $nfs_mount)
|
||||
create_resources('types::mount', $nfs_mount, {require => File[$filesystem_store_datadir]})
|
||||
|
||||
# Not using /var/lib/nova/instances may cause side effects.
|
||||
if $filesystem_store_datadir != '/var/lib/nova/instances' {
|
||||
|
@ -260,6 +260,12 @@ class cloud::image::api(
|
||||
# We mount the NFS share in filesystem_store_datadir to fake the
|
||||
# backend.
|
||||
if $nfs_device {
|
||||
file { $filesystem_store_datadir:
|
||||
ensure => 'directory',
|
||||
owner => 'glance',
|
||||
group => 'glance',
|
||||
mode => '0755'
|
||||
} ->
|
||||
class { 'glance::backend::file':
|
||||
filesystem_store_datadir => $filesystem_store_datadir
|
||||
}
|
||||
@ -272,7 +278,7 @@ class cloud::image::api(
|
||||
}
|
||||
}
|
||||
ensure_resource('class', 'nfs', {})
|
||||
create_resources('types::mount', $nfs_mount)
|
||||
create_resources('types::mount', $nfs_mount, {require => File[$filesystem_store_datadir]})
|
||||
} else {
|
||||
fail('When running NFS backend, you need to provide nfs_device parameter.')
|
||||
}
|
||||
|
@ -424,6 +424,12 @@ describe 'cloud::compute::hypervisor' do
|
||||
:nfs_options => 'noacl,fsid=123' )
|
||||
end
|
||||
it 'configure nova instances path and NFS mount' do
|
||||
is_expected.to contain_file('/var/lib/nova/instances').with(
|
||||
'ensure' => 'directory',
|
||||
'owner' => 'nova',
|
||||
'group' => 'nova',
|
||||
'mode' => '0755'
|
||||
)
|
||||
is_expected.to contain_nova_config('DEFAULT/instances_path').with('value' => '/var/lib/nova/instances')
|
||||
is_expected.to contain_mount('/var/lib/nova/instances').with({
|
||||
'ensure' => 'mounted',
|
||||
|
@ -125,6 +125,12 @@ describe 'cloud::image::api' do
|
||||
it 'configure Glance with NFS backend' do
|
||||
is_expected.to contain_class('glance::backend::file')
|
||||
is_expected.not_to contain_class('glance::backend::rbd')
|
||||
is_expected.to contain_file('/srv/images/').with(
|
||||
'ensure' => 'directory',
|
||||
'owner' => 'glance',
|
||||
'group' => 'glance',
|
||||
'mode' => '0755'
|
||||
)
|
||||
is_expected.to contain_glance_api_config('glance_store/filesystem_store_datadir').with('value' => '/srv/images/')
|
||||
is_expected.to contain_glance_api_config('glance_store/default_store').with('value' => 'file')
|
||||
is_expected.to contain_mount('/srv/images/').with({
|
||||
|
Loading…
x
Reference in New Issue
Block a user