From dbc6d7ecdfae27317b6aaec7cc1966495e1924d8 Mon Sep 17 00:00:00 2001 From: rexlee8776 Date: Thu, 22 Jun 2017 12:14:38 +0000 Subject: auto restart influxdb and grafana support JIRA: YARDSTICK-686 Change-Id: If486df4d825f9d0b03eeaa77716cc2855e2f1bd0 Signed-off-by: rexlee8776 --- api/resources/env_action.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'api') 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), -- cgit 1.2.3-korg