From 1822d4890d644d81100b6477f645a3e2e47f7308 Mon Sep 17 00:00:00 2001
From: caoyuan <cao.yuan@99cloud.net>
Date: Sun, 22 Apr 2018 21:11:06 +0800
Subject: [PATCH] Avoid creating an empty volume

Avoid creating an empty volume[0] when not use dev mode
for glance.

[0]: https://github.com/openstack/kolla-ansible/blob/master/ansible/roles/glance/defaults/main.yml#L14

Change-Id: Ib27489abe20fb562acbc28263f7680e39d9dab44
---
 ansible/roles/glance/handlers/main.yml           | 4 ++--
 ansible/roles/glance/tasks/bootstrap_service.yml | 2 +-
 ansible/roles/glance/tasks/config.yml            | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ansible/roles/glance/handlers/main.yml b/ansible/roles/glance/handlers/main.yml
index c018ace502..851af6c7e3 100644
--- a/ansible/roles/glance/handlers/main.yml
+++ b/ansible/roles/glance/handlers/main.yml
@@ -12,7 +12,7 @@
     common_options: "{{ docker_common_options }}"
     name: "{{ service.container_name }}"
     image: "{{ service.image }}"
-    volumes: "{{ service.volumes }}"
+    volumes: "{{ service.volumes|reject('equalto', '')|list }}"
   when:
     - action != "config"
     - inventory_hostname in glance_api_hosts
@@ -36,7 +36,7 @@
     common_options: "{{ docker_common_options }}"
     name: "{{ service.container_name }}"
     image: "{{ service.image }}"
-    volumes: "{{ service.volumes }}"
+    volumes: "{{ service.volumes|reject('equalto', '')|list }}"
   when:
     - action != "config"
     - inventory_hostname in groups[service.group]
diff --git a/ansible/roles/glance/tasks/bootstrap_service.yml b/ansible/roles/glance/tasks/bootstrap_service.yml
index e749adced4..4b3c5eb2cc 100644
--- a/ansible/roles/glance/tasks/bootstrap_service.yml
+++ b/ansible/roles/glance/tasks/bootstrap_service.yml
@@ -31,7 +31,7 @@
       BOOTSTRAP:
     name: "bootstrap_glance"
     restart_policy: "never"
-    volumes: "{{ glance_api.volumes }}"
+    volumes: "{{ glance_api.volumes|reject('equalto', '')|list }}"
   run_once: True
   delegate_to: "{{ groups[glance_api.group][0] }}"
 
diff --git a/ansible/roles/glance/tasks/config.yml b/ansible/roles/glance/tasks/config.yml
index 1103d79320..724d2001c4 100644
--- a/ansible/roles/glance/tasks/config.yml
+++ b/ansible/roles/glance/tasks/config.yml
@@ -117,7 +117,7 @@
     common_options: "{{ docker_common_options }}"
     name: "{{ item.value.container_name }}"
     image: "{{ item.value.image }}"
-    volumes: "{{ item.value.volumes }}"
+    volumes: "{{ item.value.volumes|reject('equalto', '')|list }}"
   register: check_glance_containers
   when:
     - action != "config"