summaryrefslogtreecommitdiff
path: root/trove/instance
diff options
context:
space:
mode:
authorLingxian Kong <anlin.kong@gmail.com>2020-10-13 23:51:46 +1300
committerLingxian Kong <anlin.kong@gmail.com>2020-10-23 23:50:39 +1300
commitd1af33f17b0994ac1d0ca5acca91f2f29bc82ce9 (patch)
tree03d0da87c98820a21b1d4c87523df90410bf3e89 /trove/instance
parent4df3dceeeee8d92f1c876effa4375f88e3249bca (diff)
downloadtrove-d1af33f17b0994ac1d0ca5acca91f2f29bc82ce9.tar.gz
Support mysql 8.0
* MySQL 5.7 and MySQL 8.0 need different percona-xtrabackup package version. Added Percona XtraBackup 8 support for MySQL 8.x backup and restore. * Construct different backup container image names for MySQL 5.7 and MySQL 8.0 based on the default option value. * Two docker images are uploaded for backup/restore: openstacktrove/db-backup-mysql5.7:1.0.0 and openstacktrove/db-backup-mysql8.0:1.0.0. Trove guest agent can automatically choose the approriate one based on the datastore version. * Added option "secure-file-priv=NULL" in MySQL config template to fix https://github.com/docker-library/mysql/issues/541. * Stop using IDENTIFIED BY in GRANT clause (also REVOKE). Starting with MySQL 8 creating a user implicitly using the GRANT command is not supported. Story: #2008275 Task: #41143 Change-Id: Ibdec63324b1b39ba9b8a38dbe529da17bbb06767
Diffstat (limited to 'trove/instance')
-rw-r--r--trove/instance/models.py42
1 files changed, 23 insertions, 19 deletions
diff --git a/trove/instance/models.py b/trove/instance/models.py
index cc392798..37e607c9 100644
--- a/trove/instance/models.py
+++ b/trove/instance/models.py
@@ -332,23 +332,29 @@ class SimpleInstance(object):
@property
def status(self):
+ LOG.info(f"Getting instance status for {self.id}, "
+ f"task status: {self.db_info.task_status}, "
+ f"datastore status: {self.datastore_status.status}, "
+ f"server status: {self.db_info.server_status}")
+
+ task_status = self.db_info.task_status
+ server_status = self.db_info.server_status
+ ds_status = self.datastore_status.status
+
# Check for taskmanager errors.
- if self.db_info.task_status.is_error:
+ if task_status.is_error:
return InstanceStatus.ERROR
- action = self.db_info.task_status.action
+ action = task_status.action
# Check if we are resetting status or force deleting
- if (srvstatus.ServiceStatuses.UNKNOWN == self.datastore_status.status
- and action == InstanceTasks.DELETING.action):
+ if (srvstatus.ServiceStatuses.UNKNOWN == ds_status
+ and action == InstanceTasks.DELETING.action):
return InstanceStatus.SHUTDOWN
- elif (srvstatus.ServiceStatuses.UNKNOWN ==
- self.datastore_status.status):
- return InstanceStatus.ERROR
# Check for taskmanager status.
if InstanceTasks.BUILDING.action == action:
- if 'ERROR' == self.db_info.server_status:
+ if 'ERROR' == server_status:
return InstanceStatus.ERROR
return InstanceStatus.BUILD
if InstanceTasks.REBOOTING.action == action:
@@ -369,13 +375,12 @@ class SimpleInstance(object):
return InstanceStatus.DETACH
# Check for server status.
- if self.db_info.server_status in ["BUILD", "ERROR", "REBOOT",
- "RESIZE"]:
- return self.db_info.server_status
+ if server_status in ["BUILD", "ERROR", "REBOOT", "RESIZE"]:
+ return server_status
# As far as Trove is concerned, Nova instances in VERIFY_RESIZE should
# still appear as though they are in RESIZE.
- if self.db_info.server_status in ["VERIFY_RESIZE"]:
+ if server_status in ["VERIFY_RESIZE"]:
return InstanceStatus.RESIZE
# Check if there is a backup running for this instance
@@ -384,23 +389,22 @@ class SimpleInstance(object):
# Report as Shutdown while deleting, unless there's an error.
if 'DELETING' == action:
- if self.db_info.server_status in ["ACTIVE", "SHUTDOWN", "DELETED",
- "HEALTHY"]:
+ if server_status in ["ACTIVE", "SHUTDOWN", "DELETED", "HEALTHY"]:
return InstanceStatus.SHUTDOWN
else:
LOG.error("While shutting down instance (%(instance)s): "
"server had status (%(status)s).",
- {'instance': self.id,
- 'status': self.db_info.server_status})
+ {'instance': self.id, 'status': server_status})
return InstanceStatus.ERROR
# Check against the service status.
# The service is only paused during a reboot.
- if srvstatus.ServiceStatuses.PAUSED == self.datastore_status.status:
+ if ds_status == srvstatus.ServiceStatuses.PAUSED:
return InstanceStatus.REBOOT
- # If the service status is NEW, then we are building.
- if srvstatus.ServiceStatuses.NEW == self.datastore_status.status:
+ elif ds_status == srvstatus.ServiceStatuses.NEW:
return InstanceStatus.BUILD
+ elif ds_status == srvstatus.ServiceStatuses.UNKNOWN:
+ return InstanceStatus.ERROR
# For everything else we can look at the service status mapping.
return self.datastore_status.status.api_status