Merge "Set right status when grow/shrink failed."

This commit is contained in:
Zuul 2018-01-09 20:03:41 +00:00 committed by Gerrit Code Review
commit 5abca67b0b
4 changed files with 27 additions and 11 deletions

View File

@ -22,6 +22,7 @@ from trove.common.strategies.cluster import base
from trove.common import utils
from trove.instance.models import DBInstance
from trove.instance.models import Instance
from trove.instance import tasks as inst_tasks
from trove.taskmanager import api as task_api
import trove.taskmanager.models as task_models
@ -245,7 +246,8 @@ class CassandraClusterTasks(task_models.ClusterTasks):
LOG.debug("Cluster configuration finished successfully.")
except Exception:
LOG.exception(_("Error growing cluster."))
self.update_statuses_on_failure(cluster_id)
self.update_statuses_on_failure(
cluster_id, status=inst_tasks.InstanceTasks.GROWING_ERROR)
timeout = Timeout(CONF.cluster_usage_timeout)
try:
@ -255,7 +257,8 @@ class CassandraClusterTasks(task_models.ClusterTasks):
if t is not timeout:
raise # not my timeout
LOG.exception(_("Timeout for growing cluster."))
self.update_statuses_on_failure(cluster_id)
self.update_statuses_on_failure(
cluster_id, status=inst_tasks.InstanceTasks.GROWING_ERROR)
finally:
timeout.cancel()
@ -325,7 +328,9 @@ class CassandraClusterTasks(task_models.ClusterTasks):
LOG.debug("Cluster configuration finished successfully.")
except Exception:
LOG.exception(_("Error shrinking cluster."))
self.update_statuses_on_failure(cluster_id)
self.update_statuses_on_failure(
cluster_id,
status=inst_tasks.InstanceTasks.SHRINKING_ERROR)
timeout = Timeout(CONF.cluster_usage_timeout)
try:
@ -335,7 +340,8 @@ class CassandraClusterTasks(task_models.ClusterTasks):
if t is not timeout:
raise # not my timeout
LOG.exception(_("Timeout for shrinking cluster."))
self.update_statuses_on_failure(cluster_id)
self.update_statuses_on_failure(
cluster_id, status=inst_tasks.InstanceTasks.SHRINKING_ERROR)
finally:
timeout.cancel()

View File

@ -25,6 +25,7 @@ from trove.common import utils
from trove.instance import models
from trove.instance.models import DBInstance
from trove.instance.models import Instance
from trove.instance import tasks as inst_tasks
from trove.taskmanager import api as task_api
import trove.taskmanager.models as task_models
@ -250,7 +251,8 @@ class MongoDbClusterTasks(task_models.ClusterTasks):
if t is not timeout:
raise # not my timeout
LOG.exception(_("timeout for growing cluster."))
self.update_statuses_on_failure(cluster_id)
self.update_statuses_on_failure(
cluster_id, status=inst_tasks.InstanceTasks.GROWING_ERROR)
finally:
timeout.cancel()
@ -285,7 +287,8 @@ class MongoDbClusterTasks(task_models.ClusterTasks):
if t is not timeout:
raise # not my timeout
LOG.exception(_("timeout for shrinking cluster."))
self.update_statuses_on_failure(cluster_id)
self.update_statuses_on_failure(
cluster_id, status=inst_tasks.InstanceTasks.SHRINKING_ERROR)
finally:
timeout.cancel()

View File

@ -20,6 +20,7 @@ from trove.common.i18n import _
from trove.common.strategies.cluster import base
from trove.instance.models import DBInstance
from trove.instance.models import Instance
from trove.instance import tasks as inst_tasks
from trove.taskmanager import api as task_api
import trove.taskmanager.models as task_models
@ -142,10 +143,12 @@ class RedisClusterTasks(task_models.ClusterTasks):
if t is not timeout:
raise # not my timeout
LOG.exception(_("Timeout for growing cluster."))
self.update_statuses_on_failure(cluster_id)
self.update_statuses_on_failure(
cluster_id, status=inst_tasks.InstanceTasks.GROWING_ERROR)
except Exception:
LOG.exception(_("Error growing cluster %s."), cluster_id)
self.update_statuses_on_failure(cluster_id)
self.update_statuses_on_failure(
cluster_id, status=inst_tasks.InstanceTasks.GROWING_ERROR)
finally:
timeout.cancel()

View File

@ -21,6 +21,7 @@ from trove.common.strategies.cluster.experimental.vertica.api import \
VerticaCluster
from trove.instance.models import DBInstance
from trove.instance.models import Instance
from trove.instance import tasks as inst_tasks
from trove.taskmanager import api as task_api
import trove.taskmanager.models as task_models
@ -162,10 +163,12 @@ class VerticaClusterTasks(task_models.ClusterTasks):
if t is not timeout:
raise # not my timeout
LOG.exception(_("Timeout for growing cluster."))
self.update_statuses_on_failure(cluster_id)
self.update_statuses_on_failure(
cluster_id, status=inst_tasks.InstanceTasks.GROWING_ERROR)
except Exception:
LOG.exception(_("Error growing cluster %s."), cluster_id)
self.update_statuses_on_failure(cluster_id)
self.update_statuses_on_failure(
cluster_id, status=inst_tasks.InstanceTasks.GROWING_ERROR)
finally:
timeout.cancel()
@ -212,7 +215,8 @@ class VerticaClusterTasks(task_models.ClusterTasks):
if t is not timeout:
raise
LOG.exception(_("Timeout for shrinking cluster."))
self.update_statuses_on_failure(cluster_id)
self.update_statuses_on_failure(
cluster_id, status=inst_tasks.InstanceTasks.SHRINKING_ERROR)
finally:
timeout.cancel()