From c27d0123ab8c70dbb558f2378f181dc52c0fb534 Mon Sep 17 00:00:00 2001 From: Panagiotis Karalis Date: Mon, 29 Oct 2018 15:13:54 +0200 Subject: [PATCH] Turn the filesystem directory to be configurable Update the ownership of the directory about NFS mount point(s). This patch could be also stand as an improvement for future use. Making the filesystem directory configurable, we are able to store the image in the different directory (or in a new path) under glance_system_user_home repo, which is able to be configured dynamically, for instance, via deployment of a scenario. Change-Id: I7403ac9bd85ea3ed149e13cb57c51039602f6ba1 Signed-off-by: Panagiotis Karalis --- defaults/main.yml | 2 +- tasks/glance_install.yml | 4 +++- templates/glance-api.conf.j2 | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 37765f95..927d395c 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -207,7 +207,7 @@ glance_policy_dirs: policy.d # Define nfs information to enable nfs shares as mounted directories for # glance. The ``glance_nfs_client`` value is a list of dictionaries that must # be filled out completely to enable the persistent NFS mounts. - +glance_nfs_local_directory: "images" glance_nfs_client: [] # Example of the expected dict structure: diff --git a/tasks/glance_install.yml b/tasks/glance_install.yml index 18f2a419..61c3dd54 100644 --- a/tasks/glance_install.yml +++ b/tasks/glance_install.yml @@ -50,6 +50,8 @@ owner: "{{ glance_system_user_name }}" group: "{{ glance_system_group_name }}" mode: "0755" + owner: "{{ item.owner | default(glance_system_user_name) }}" + group: "{{ item.group | default(glance_system_group_name) }}" with_items: "{{ glance_nfs_client }}" # NOTE(cloudnull): During an upgrade the local directory may exist on a source @@ -111,7 +113,7 @@ mode: "0700" - path: "{{ glance_system_user_home }}/cache/registry" - path: "{{ glance_system_user_home }}/scrubber" - - path: "{{ glance_system_user_home }}/images" + - path: "{{ glance_system_user_home }}/{{ glance_nfs_local_directory }}" mode: "0755" - name: Install distro packages diff --git a/templates/glance-api.conf.j2 b/templates/glance-api.conf.j2 index 083cc4ec..bf847d8f 100644 --- a/templates/glance-api.conf.j2 +++ b/templates/glance-api.conf.j2 @@ -84,7 +84,7 @@ default_store = {{ glance_default_store }} stores = {% for backend in glance_available_stores %}{{ backend }}{% if not loop.last %},{% endif %}{% endfor %} {% if 'file' in glance_available_stores %} -filesystem_store_datadir = {{ glance_system_user_home }}/images/ +filesystem_store_datadir = {{ glance_system_user_home }}/{{ glance_nfs_local_directory }}/ {% endif %} {% if 'swift' in glance_available_stores %}