Add a way to override base path when file driver is used

The goal is to be able to point the Gnocchi file driver directory
to an NFS share.

A new parameter GnocchiFileBasePath allows to customize
the bind mount to /var/lib/gnocchi.

Change-Id: I868a368161f4a529e5e7dc3593dc6862e3196247
This commit is contained in:
Pradeep Kilambi 2018-05-23 12:31:16 -04:00 committed by Mehdi Abaakouk
parent a33d05d30d
commit b3b027e731
4 changed files with 43 additions and 6 deletions

View File

@ -60,6 +60,11 @@ parameters:
description: >
The Ceph cluster name must be at least 1 character and contain only
letters and numbers.
GnocchiFileBasePath:
default: '/var/lib/gnocchi'
description: Path to use when file driver is used. This could be NFS or a
flat file.
type: string
conditions:
@ -151,8 +156,15 @@ outputs:
image: *gnocchi_api_image
user: root
volumes:
- /var/lib/gnocchi:/var/lib/gnocchi:rw
command: ['/bin/bash', '-c', 'chown -R gnocchi:gnocchi /var/lib/gnocchi']
- str_replace:
template: GNOCCHI_FILE_BASE_PATH:GNOCCHI_FILE_BASE_PATH
params: {GNOCCHI_FILE_BASE_PATH: {get_param: GnocchiFileBasePath}}
command:
- '/bin/bash'
- '-c'
- str_replace:
template: 'chown -R gnocchi:gnocchi GNOCCHI_FILE_BASE_PATH'
params: {GNOCCHI_FILE_BASE_PATH: {get_param: GnocchiFileBasePath}}
step_4:
gnocchi_db_sync:
image: *gnocchi_api_image
@ -166,7 +178,9 @@ outputs:
-
- /var/lib/kolla/config_files/gnocchi_db_sync.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/gnocchi/:/var/lib/kolla/config_files/src:ro
- /var/lib/gnocchi:/var/lib/gnocchi:rw
- str_replace:
template: GNOCCHI_FILE_BASE_PATH:GNOCCHI_FILE_BASE_PATH
params: {GNOCCHI_FILE_BASE_PATH: {get_param: GnocchiFileBasePath}}
- /var/log/containers/gnocchi:/var/log/gnocchi
- /var/log/containers/httpd/gnocchi-api:/var/log/httpd
- /etc/ceph:/var/lib/kolla/config_files/src-ceph:ro
@ -184,7 +198,9 @@ outputs:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
-
- /var/lib/gnocchi:/var/lib/gnocchi:rw
- str_replace:
template: GNOCCHI_FILE_BASE_PATH:GNOCCHI_FILE_BASE_PATH
params: {GNOCCHI_FILE_BASE_PATH: {get_param: GnocchiFileBasePath}}
- /var/lib/kolla/config_files/gnocchi_api.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/gnocchi/:/var/lib/kolla/config_files/src:ro
- /var/log/containers/gnocchi:/var/log/gnocchi

View File

@ -48,6 +48,11 @@ parameters:
description: >
The Ceph cluster name must be at least 1 character and contain only
letters and numbers.
GnocchiFileBasePath:
default: '/var/lib/gnocchi'
description: Path to use when file driver is used. This could be NFS or a
flat file.
type: string
resources:
@ -125,9 +130,11 @@ outputs:
-
- /var/lib/kolla/config_files/gnocchi_metricd.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/gnocchi/:/var/lib/kolla/config_files/src:ro
- /var/lib/gnocchi:/var/lib/gnocchi:rw
- /var/log/containers/gnocchi:/var/log/gnocchi
- /etc/ceph:/var/lib/kolla/config_files/src-ceph:ro
- str_replace:
template: GNOCCHI_FILE_BASE_PATH:GNOCCHI_FILE_BASE_PATH
params: {GNOCCHI_FILE_BASE_PATH: {get_param: GnocchiFileBasePath}}
environment:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
host_prep_tasks:

View File

@ -48,6 +48,11 @@ parameters:
description: >
The Ceph cluster name must be at least 1 character and contain only
letters and numbers.
GnocchiFileBasePath:
default: '/var/lib/gnocchi'
description: Path to use when file driver is used. This could be NFS or a
flat file.
type: string
resources:
@ -126,8 +131,10 @@ outputs:
- /var/lib/kolla/config_files/gnocchi_statsd.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/gnocchi/:/var/lib/kolla/config_files/src:ro
- /var/log/containers/gnocchi:/var/log/gnocchi
- /var/lib/gnocchi:/var/lib/gnocchi:rw
- /etc/ceph:/var/lib/kolla/config_files/src-ceph:ro
- str_replace:
template: GNOCCHI_FILE_BASE_PATH:GNOCCHI_FILE_BASE_PATH
params: {GNOCCHI_FILE_BASE_PATH: {get_param: GnocchiFileBasePath}}
environment:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
host_prep_tasks:

View File

@ -93,6 +93,12 @@ parameters:
description: S3 storage access key secret.
type: string
hidden: true
GnocchiFileBasePath:
default: '/var/lib/gnocchi'
description: Path to use when file driver is used. This could be NFS or a
flat file.
type: string
conditions:
service_debug_unset: {equals : [{get_param: GnocchiDebug}, '']}
@ -128,6 +134,7 @@ outputs:
template: " --sacks-number NUM_SACKS"
params:
NUM_SACKS: {get_param: NumberOfStorageSacks}
gnocchi::storage::file::file_basepath: {get_param: GnocchiFileBasePath}
gnocchi::storage::swift::swift_user: 'service:gnocchi'
gnocchi::storage::swift::swift_auth_version: 3
gnocchi::storage::swift::swift_key: {get_param: GnocchiPassword}