summaryrefslogtreecommitdiff
path: root/trove/taskmanager
diff options
context:
space:
mode:
authorLingxian Kong <anlin.kong@gmail.com>2019-12-12 00:26:09 +1300
committerLingxian Kong <anlin.kong@gmail.com>2019-12-14 12:55:56 +1300
commita0a10f0b947c63ac06787b490afd0ebecef1477e (patch)
treea75d6ebdfb2e31d984c4b458a3b1624f4d42444c /trove/taskmanager
parentf16020392d9eb81727a97608f8e9be432f97c388 (diff)
downloadtrove-a0a10f0b947c63ac06787b490afd0ebecef1477e.tar.gz
Support HEALTHY status for db instance
- 'HEALTHY' means the db service is responsive, 'ACTIVE' means the db service is alive. - Remove the CI job fakemodetests, but will add similar testing task in the future. - Fix the periodic CI job - Remove MongoDB and related jobs Change-Id: I5abe9091ba203297dc87db5fba139179166321f7
Diffstat (limited to 'trove/taskmanager')
-rwxr-xr-xtrove/taskmanager/models.py28
1 files changed, 18 insertions, 10 deletions
diff --git a/trove/taskmanager/models.py b/trove/taskmanager/models.py
index 311e4639..fc9952ab 100755
--- a/trove/taskmanager/models.py
+++ b/trove/taskmanager/models.py
@@ -764,9 +764,11 @@ class FreshInstanceTasks(FreshInstance, NotifyMixin, ConfigurationMixin):
"""
service = InstanceServiceStatus.find_by(instance_id=self.id)
status = service.get_status()
+
if (status == rd_instance.ServiceStatuses.RUNNING or
- status == rd_instance.ServiceStatuses.INSTANCE_READY):
- return True
+ status == rd_instance.ServiceStatuses.INSTANCE_READY or
+ status == rd_instance.ServiceStatuses.HEALTHY):
+ return True
elif status not in [rd_instance.ServiceStatuses.NEW,
rd_instance.ServiceStatuses.BUILDING,
rd_instance.ServiceStatuses.UNKNOWN,
@@ -1388,6 +1390,7 @@ class BuiltInstanceTasks(BuiltInstance, NotifyMixin, ConfigurationMixin):
utils.poll_until(
server_finished_rebuilding,
sleep_time=2, time_out=600)
+
if not self.server_status_matches(['ACTIVE']):
raise TroveError(_("Instance %(instance)s failed to "
"upgrade to %(datastore_version)s"),
@@ -1752,7 +1755,8 @@ class ResizeVolumeAction(object):
'old_volume_size': self.old_size,
'new_size': self.new_size})
- if self.instance.server.status == InstanceStatus.ACTIVE:
+ if self.instance.server.status in [InstanceStatus.ACTIVE,
+ InstanceStatus.HEALTHY]:
self._resize_active_volume()
self.instance.reset_task_status()
# send usage event for size reported by cinder
@@ -1768,13 +1772,17 @@ class ResizeVolumeAction(object):
).notify()
else:
self.instance.reset_task_status()
- msg = _("Failed to resize instance %(id)s volume for server "
- "%(server_id)s. The instance must be in state %(state)s "
- "not %(inst_state)s.") % {
- 'id': self.instance.id,
- 'server_id': self.instance.server.id,
- 'state': InstanceStatus.ACTIVE,
- 'inst_state': self.instance.server.status}
+ msg = (
+ "Failed to resize instance %(id)s volume for server "
+ "%(server_id)s. The instance must be in state %(state)s "
+ "not %(inst_state)s." %
+ {
+ 'id': self.instance.id,
+ 'server_id': self.instance.server.id,
+ 'state': [InstanceStatus.ACTIVE, InstanceStatus.HEALTHY],
+ 'inst_state': self.instance.server.status
+ }
+ )
raise TroveError(msg)