From b3b027e731ddef17c857326409f680b9245516c4 Mon Sep 17 00:00:00 2001 From: Pradeep Kilambi Date: Wed, 23 May 2018 12:31:16 -0400 Subject: [PATCH] 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 --- docker/services/gnocchi-api.yaml | 24 ++++++++++++++++++++---- docker/services/gnocchi-metricd.yaml | 9 ++++++++- docker/services/gnocchi-statsd.yaml | 9 ++++++++- puppet/services/gnocchi-base.yaml | 7 +++++++ 4 files changed, 43 insertions(+), 6 deletions(-) diff --git a/docker/services/gnocchi-api.yaml b/docker/services/gnocchi-api.yaml index c576ac0e4a..f047dc81a2 100644 --- a/docker/services/gnocchi-api.yaml +++ b/docker/services/gnocchi-api.yaml @@ -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 diff --git a/docker/services/gnocchi-metricd.yaml b/docker/services/gnocchi-metricd.yaml index 45a43a61db..b72ad66094 100644 --- a/docker/services/gnocchi-metricd.yaml +++ b/docker/services/gnocchi-metricd.yaml @@ -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: diff --git a/docker/services/gnocchi-statsd.yaml b/docker/services/gnocchi-statsd.yaml index c1417163d0..c754390994 100644 --- a/docker/services/gnocchi-statsd.yaml +++ b/docker/services/gnocchi-statsd.yaml @@ -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: diff --git a/puppet/services/gnocchi-base.yaml b/puppet/services/gnocchi-base.yaml index 77cf578179..408e980777 100644 --- a/puppet/services/gnocchi-base.yaml +++ b/puppet/services/gnocchi-base.yaml @@ -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}