From f70dfc5dc3203e2138ca01d4c66d195f7fd66e93 Mon Sep 17 00:00:00 2001 From: jimmygc Date: Fri, 31 Mar 2017 16:17:40 +0800 Subject: [PATCH] Make glance filesystem_store_datadir configurable. User can use custom directory to store images. For example using a shared file system as backend. Change-Id: Iab7a9a51e619bdbf8f7bd4626ebe4d703e6d4819 --- ansible/group_vars/all.yml | 1 + ansible/roles/destroy/tasks/cleanup_host.yml | 1 + ansible/roles/glance/defaults/main.yml | 2 +- tools/cleanup-host | 5 +++++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 7eaacd14aa..da6c863a05 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -471,6 +471,7 @@ keystone_default_user_role: "_member_" glance_backend_file: "{{ not enable_ceph | bool }}" glance_backend_ceph: "{{ enable_ceph }}" glance_backend_vmware: "no" +glance_file_datadir_volume: "glance" ####################### # Ceilometer options diff --git a/ansible/roles/destroy/tasks/cleanup_host.yml b/ansible/roles/destroy/tasks/cleanup_host.yml index 50bf449505..ba5a343c5b 100644 --- a/ansible/roles/destroy/tasks/cleanup_host.yml +++ b/ansible/roles/destroy/tasks/cleanup_host.yml @@ -3,6 +3,7 @@ command: > env enable_haproxy={{ enable_haproxy }} enable_swift={{ enable_swift }} + glance_file_datadir_volume={{ glance_file_datadir_volume }} kolla_internal_vip_address={{ kolla_internal_vip_address }} kolla_external_vip_address={{ kolla_external_vip_address }} kolla_dev_repos_directory={{ kolla_dev_repos_directory }} diff --git a/ansible/roles/glance/defaults/main.yml b/ansible/roles/glance/defaults/main.yml index 9203eb89fd..139825d34a 100644 --- a/ansible/roles/glance/defaults/main.yml +++ b/ansible/roles/glance/defaults/main.yml @@ -10,7 +10,7 @@ glance_services: volumes: - "{{ node_config_directory }}/glance-api/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" - - "glance:/var/lib/glance/" + - "{{ glance_file_datadir_volume }}:/var/lib/glance/" - "kolla_logs:/var/log/kolla/" glance-registry: container_name: glance_registry diff --git a/tools/cleanup-host b/tools/cleanup-host index bf7584d3cc..0cf4a69b10 100755 --- a/tools/cleanup-host +++ b/tools/cleanup-host @@ -51,6 +51,11 @@ if [[ "$enable_swift" == "yes" ]]; then sed -i '/\/srv\/node\//d' /etc/fstab fi +if [[ "$glance_file_datadir_volume" != "glance" && -d "$glance_file_datadir_volume" ]]; then + echo "Removing glance volume if it is customzied" + rm -rfv $glance_file_datadir_volume +fi + echo "Getting folders name..." FOLDER_PATH="/etc/kolla/" for dir in $FOLDER_PATH*; do