summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2017-06-22 20:51:25 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-06-22 20:51:25 +0000
commitb2ebe10ed516a99fe16b6bfad04b3797e8821ee0 (patch)
treeecf382ed69280adc9873755c42c40b49eb1c3793
parente80c35164e7dfee4fe4a3652b71b8775c1c0857a (diff)
parentdbc6d7ecdfae27317b6aaec7cc1966495e1924d8 (diff)
Merge "auto restart influxdb and grafana support"
-rw-r--r--api/resources/env_action.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/api/resources/env_action.py b/api/resources/env_action.py
index 7bfaf27a7..dd6566526 100644
--- a/api/resources/env_action.py
+++ b/api/resources/env_action.py
@@ -20,6 +20,7 @@ import glob
from six.moves import configparser
from oslo_serialization import jsonutils
from docker import Client
+from docker.utils import create_host_config
from api.database.handler import AsyncTaskHandler
from api.utils import influx
@@ -98,7 +99,9 @@ def _create_data_source():
def _create_grafana_container(client):
ports = [3000]
port_bindings = {k: k for k in ports}
- host_config = client.create_host_config(port_bindings=port_bindings)
+ restart_policy = {"MaximumRetryCount": 0, "Name": "always"}
+ host_config = client.create_host_config(port_bindings=port_bindings,
+ restart_policy=restart_policy)
container = client.create_container(image='%s:%s' % (consts.GRAFANA_IMAGE,
consts.GRAFANA_TAG),
@@ -150,7 +153,9 @@ def _create_influxdb_container(client):
ports = [8083, 8086]
port_bindings = {k: k for k in ports}
- host_config = client.create_host_config(port_bindings=port_bindings)
+ restart_policy = {"MaximumRetryCount": 0, "Name": "always"}
+ host_config = client.create_host_config(port_bindings=port_bindings,
+ restart_policy=restart_policy)
container = client.create_container(image='%s:%s' % (consts.INFLUXDB_IMAGE,
consts.INFLUXDB_TAG),