From 67489e63f07ea73d934e51666f19229a629a6c77 Mon Sep 17 00:00:00 2001
From: Sergii Golovatiuk <sgolovat@redhat.com>
Date: Wed, 11 Jul 2018 10:49:27 +0200
Subject: [PATCH] Increase the step for gnocchi_db_sync

swift-proxy and gnocchi both run on step_4. However, swift_proxy should
be ready before gnocchi. This patch moves gnocchi_db_sync to step_5 to
be sure that swift-proxy is started before gnocchi. gnocchi_db_sync has
higher start_order to start before other gnocchi services.

Change-Id: I0044c78c4a6d751fc9d0cf6b54ed634032933934
Closes-Bug: 1781162
---
 docker/services/ceilometer-agent-central.yaml | 4 ++--
 docker/services/gnocchi-api.yaml              | 5 +++--
 docker/services/gnocchi-metricd.yaml          | 1 +
 docker/services/gnocchi-statsd.yaml           | 1 +
 4 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/docker/services/ceilometer-agent-central.yaml b/docker/services/ceilometer-agent-central.yaml
index 83844bdd1e..a5beb52748 100644
--- a/docker/services/ceilometer-agent-central.yaml
+++ b/docker/services/ceilometer-agent-central.yaml
@@ -120,7 +120,7 @@ outputs:
               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
         step_5:
           ceilometer_gnocchi_upgrade:
-            start_order: 1
+            start_order: 99
             image: *ceilometer_agent_central_image
             net: host
             detach: false
@@ -137,7 +137,7 @@ outputs:
             command:
               - '/usr/bin/bootstrap_host_exec'
               - 'ceilometer_agent_central'
-              - "su ceilometer -s /bin/bash -c 'for n in {1..10}; do /usr/bin/ceilometer-upgrade --skip-metering-database && exit 0 || sleep 5; done; exit 1'"
+              - "su ceilometer -s /bin/bash -c 'for n in {1..10}; do /usr/bin/ceilometer-upgrade --skip-metering-database && exit 0 || sleep 30; done; exit 1'"
       host_prep_tasks:
         - name: create persistent logs directory
           file:
diff --git a/docker/services/gnocchi-api.yaml b/docker/services/gnocchi-api.yaml
index f047dc81a2..79fd4bc89e 100644
--- a/docker/services/gnocchi-api.yaml
+++ b/docker/services/gnocchi-api.yaml
@@ -165,8 +165,9 @@ outputs:
               - str_replace:
                   template: 'chown -R gnocchi:gnocchi GNOCCHI_FILE_BASE_PATH'
                   params: {GNOCCHI_FILE_BASE_PATH: {get_param: GnocchiFileBasePath}}
-        step_4:
+        step_5:
           gnocchi_db_sync:
+            start_order: 0
             image: *gnocchi_api_image
             net: host
             detach: false
@@ -186,9 +187,9 @@ outputs:
                   - /etc/ceph:/var/lib/kolla/config_files/src-ceph:ro
             environment:
               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
-        step_5:
           gnocchi_api:
             image: *gnocchi_api_image
+            start_order: 1
             net: host
             privileged: false
             restart: always
diff --git a/docker/services/gnocchi-metricd.yaml b/docker/services/gnocchi-metricd.yaml
index 4db2fb903b..62b6e1f96e 100644
--- a/docker/services/gnocchi-metricd.yaml
+++ b/docker/services/gnocchi-metricd.yaml
@@ -118,6 +118,7 @@ outputs:
       docker_config:
         step_5:
           gnocchi_metricd:
+            start_order: 1
             image: {get_param: DockerGnocchiMetricdImage}
             net: host
             privileged: false
diff --git a/docker/services/gnocchi-statsd.yaml b/docker/services/gnocchi-statsd.yaml
index 910d5c4fb6..1c7f341da3 100644
--- a/docker/services/gnocchi-statsd.yaml
+++ b/docker/services/gnocchi-statsd.yaml
@@ -118,6 +118,7 @@ outputs:
       docker_config:
         step_5:
           gnocchi_statsd:
+            start_order: 1
             image: {get_param: DockerGnocchiStatsdImage}
             net: host
             privileged: false