summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorrexlee8776 <limingjiang@huawei.com>2017-06-22 12:14:38 +0000
committerrexlee8776 <limingjiang@huawei.com>2017-06-22 12:14:38 +0000
commitdbc6d7ecdfae27317b6aaec7cc1966495e1924d8 (patch)
tree8cbbb87f2d8dc9b3788b7233776659c7e9ffb0e5 /api
parent5c33b82efbc0f7e58bdcfc4288ce08b7b3c999f2 (diff)
auto restart influxdb and grafana support
JIRA: YARDSTICK-686 Change-Id: If486df4d825f9d0b03eeaa77716cc2855e2f1bd0 Signed-off-by: rexlee8776 <limingjiang@huawei.com>
Diffstat (limited to 'api')
-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),