From cdfc0442e9062a92dfa725afc10434a748ed0f74 Mon Sep 17 00:00:00 2001
From: "wu.chunyang" <wu.chunyang@99cloud.net>
Date: Wed, 12 Dec 2018 10:35:11 +0000
Subject: [PATCH] add debug option to  ceph mon or osd start command

when ceph_mon and ceph_osd start failed, add debug option will
print more info. now when ceph_mon and ceph_osd containers start
failed, docker logs ceph_mon print none log

Closes-Bug: #1815707

Change-Id: I3c5086019808a9738714f5279ec74cbb9b7a8587
---
 ansible/roles/ceph/defaults/main.yml          | 1 +
 ansible/roles/ceph/templates/ceph-mon.json.j2 | 2 +-
 ansible/roles/ceph/templates/ceph-osd.json.j2 | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/ansible/roles/ceph/defaults/main.yml b/ansible/roles/ceph/defaults/main.yml
index 43dfc646cc..49c70f156c 100644
--- a/ansible/roles/ceph/defaults/main.yml
+++ b/ansible/roles/ceph/defaults/main.yml
@@ -52,6 +52,7 @@ ceph_rgw_image_full: "{{ ceph_rgw_image }}:{{ ceph_rgw_tag }}"
 # Ceph
 ####################
 osd_initial_weight: "1"
+ceph_debug: "{{ openstack_logging_debug }}"
 
 # Increase tcmalloc cache size
 ceph_tcmalloc_tc_bytes: "134217728"
diff --git a/ansible/roles/ceph/templates/ceph-mon.json.j2 b/ansible/roles/ceph/templates/ceph-mon.json.j2
index 7ad4b19bac..68e50cd523 100644
--- a/ansible/roles/ceph/templates/ceph-mon.json.j2
+++ b/ansible/roles/ceph/templates/ceph-mon.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/ceph-mon -f -i {{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }} --public-addr {{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }}:6789",
+    "command": "/usr/bin/ceph-mon -f {% if ceph_debug %}-d{% endif %} -i {{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }} --public-addr {{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }}:6789",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/ceph.conf",
diff --git a/ansible/roles/ceph/templates/ceph-osd.json.j2 b/ansible/roles/ceph/templates/ceph-osd.json.j2
index 043a65ea14..fd4fc3e97f 100644
--- a/ansible/roles/ceph/templates/ceph-osd.json.j2
+++ b/ansible/roles/ceph/templates/ceph-osd.json.j2
@@ -1,5 +1,5 @@
 {
-    "command": "/usr/bin/ceph-osd -f --public-addr {{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }} --cluster-addr {{ hostvars[inventory_hostname]['ansible_' + cluster_interface]['ipv4']['address'] }}",
+    "command": "/usr/bin/ceph-osd -f {% if ceph_debug %}-d{% endif %} --public-addr {{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }} --cluster-addr {{ hostvars[inventory_hostname]['ansible_' + cluster_interface]['ipv4']['address'] }}",
     "config_files": [
         {
             "source": "{{ container_config_directory }}/ceph.conf",