Create Swift directory d1 if needed

Swift added a requirement that storage directories must exist before
using them. In case of the d1 directory in TripleO - used when there are
no "real disks" - it has to be created by TripleO in advance.

Related-Bug: 1729569
Change-Id: I49e395ac379ced01adb60d8d9f951c08718b1c61
This commit is contained in:
Christian Schwede 2017-11-02 17:02:04 +00:00 committed by Emilien Macchi
parent eb1c46e40a
commit ffd524d7f1
2 changed files with 25 additions and 0 deletions

View File

@ -27,10 +27,20 @@
# for more details.
# Defaults to hiera('step')
#
# [*use_local_dir*]
# (Optional) Creates a local directory to store data on the system disk
# Defaults to true
#
# [*local_dir*]
# (Optional) Defines the directory name to use for the local storage
# Defaults to /srv/node/d1
#
class tripleo::profile::base::swift::storage (
# Deprecated conditional to support ControllerEnableSwiftStorage parameter
$enable_swift_storage = true,
$step = Integer(hiera('step')),
$use_local_dir = true,
$local_dir = '/srv/node/d1',
) {
if $step >= 4 {
if $enable_swift_storage {
@ -50,6 +60,14 @@ class tripleo::profile::base::swift::storage (
$swift_components = ['account', 'container', 'object']
swift::storage::filter::recon { $swift_components : }
swift::storage::filter::healthcheck { $swift_components : }
if $use_local_dir {
ensure_resource('file', $local_dir, {
ensure => 'directory',
owner => 'swift',
group => 'swift',
require => Package['swift'],
})
}
}
}
}

View File

@ -0,0 +1,7 @@
---
fixes:
- |
Swift added a requirement to ensure that storage directories exist before
using them. However, when local directories are used in Tripleo (storing
data in /srv/node/d1), these are missing by default and thus Swift won't
store any data. This fix creates this directory if needed.