summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2019-12-27 04:10:03 +0000
committerGerrit Code Review <review@openstack.org>2019-12-27 04:10:03 +0000
commit29dd2c3008bbc51af66eac889f486b7dc66dd51f (patch)
treea7782807916a0c587ee5a04933813b61925e3d58
parent7680b5ef0e3608b2c45f057f65337c4af3d5659d (diff)
parentb217577894533dbbe6a5b2339b6720030f311d01 (diff)
downloadtrove-29dd2c3008bbc51af66eac889f486b7dc66dd51f.tar.gz
Merge "Fix unmount path for instance upgrade" into stable/train
-rw-r--r--doc/source/user/upgrade-datastore.rst73
-rw-r--r--trove/guestagent/datastore/mysql_common/manager.py2
-rwxr-xr-xtrove/taskmanager/models.py13
3 files changed, 49 insertions, 39 deletions
diff --git a/doc/source/user/upgrade-datastore.rst b/doc/source/user/upgrade-datastore.rst
index dd494e2d..8b16eea2 100644
--- a/doc/source/user/upgrade-datastore.rst
+++ b/doc/source/user/upgrade-datastore.rst
@@ -2,13 +2,13 @@
Upgrade datastore
=================
-You can upgrade your datastore version. When you perform an upgrade,
-the system automatically manages data and configuration files of your
-database.
+You can upgrade the datastore version of the database instance. When you
+perform an upgrade, the system automatically manages data and
+configuration files of your database.
To perform datastore upgrade, you need:
-- A supported OS image with the target datastore version.
+- A guest image with the target datastore version.
- A Trove database instance to be upgrade.
@@ -17,7 +17,7 @@ for a single instance database.
.. note::
- **Before** you begin make sure that:
+ **Before** upgrading, make sure that:
- Your target datastore is binary compatible with the current
datastore. Each database provider has its own compatibilty
@@ -35,17 +35,16 @@ Upgrading datastore
#. **Check instance status**
- Use :command:`openstack database instance list` to check whether the
- status of your instance is ACTIVE.
+ Make sure the instance status is HEALTHY before upgrading.
.. code-block:: console
- $openstack database instance list
- +--------------------------------------+------------+-----------+-------------------+--------+-----------+------+-----------+
- | ID | Name | Datastore | Datastore Version | Status | Flavor ID | Size | Region |
- +--------------------------------------+------------+-----------+-------------------+--------+-----------+------+-----------+
- | 55411e95-1670-497f-8d92-0179f3b4fdd4 | redis_test | redis | 3.2.6 | ACTIVE | 6 | 5 | RegionOne |
- +--------------------------------------+------------+-----------+-------------------+--------+-----------+------+-----------+
+ $ openstack database instance list
+ +--------------------------------------+------------+-----------+-------------------+---------+-----------+-----------+------+-----------+
+ | ID | Name | Datastore | Datastore Version | Status | Addresses | Flavor ID | Size | Region |
+ +--------------------------------------+------------+-----------+-------------------+---------+-----------+-----------+------+-----------+
+ | 55411e95-1670-497f-8d92-0179f3b4fdd4 | redis_test | redis | 3.2.6 | HEALTHY | 10.1.0.25 | 6 | 1 | RegionOne |
+ +--------------------------------------+------------+-----------+-------------------+---------+-----------+-----------+------+-----------+
#. **Check if target version is available**
@@ -54,36 +53,42 @@ Upgrading datastore
.. code-block:: console
- $openstack datastore version list redis
- +--------------------------------------+-------+
- | ID | Name |
- +--------------------------------------+-------+
- | 483debec-b7c3-4167-ab1d-1765795ed7eb | 3.2.6 |
- | 507f666e-193c-4194-9d9d-da8342dcb4f1 | 3.2.7 |
- +--------------------------------------+-------+
+ $ openstack datastore version list redis
+ +--------------------------------------+-------+
+ | ID | Name |
+ +--------------------------------------+-------+
+ | 483debec-b7c3-4167-ab1d-1765795ed7eb | 3.2.6 |
+ | 507f666e-193c-4194-9d9d-da8342dcb4f1 | 3.2.7 |
+ +--------------------------------------+-------+
#. **Run upgrade**
- Use :command:`openstack database instance` command to upgrade your
- datastore for the selected instance.
+ Use :command:`openstack database instance upgrade` command to upgrade the
+ datastore of the instance.
.. code-block:: console
- $openstack database instance 55411e95-1670-497f-8d92-0179f3b4fdd4 3.2.7
+ $ openstack database instance 55411e95-1670-497f-8d92-0179f3b4fdd4 3.2.7
-#. **Wait until status changes from UPGRADE to ACTIVE**
+#. **Wait until status changes from UPGRADE to HEALTHY**
- You can use :command:`openstack database instance list` to check the
+ Use :command:`openstack database instance list` to check the
current status.
.. code-block:: console
- $openstack database instance list
- +--------------------------------------+------------+-----------+-------------------+---------+-----------+------+-----------+
- | ID | Name | Datastore | Datastore Version | Status | Flavor ID | Size | Region |
- +--------------------------------------+------------+-----------+-------------------+---------+-----------+------+-----------+
- | 55411e95-1670-497f-8d92-0179f3b4fdd4 | redis_test | redis | 3.2.7 | UPGRADE | 6 | 5 | RegionOne |
- +--------------------------------------+------------+-----------+-------------------+---------+-----------+------+-----------+
+ $ openstack database instance list
+ +--------------------------------------+------------+-----------+-------------------+---------+-----------+-----------+------+-----------+
+ | ID | Name | Datastore | Datastore Version | Status | Addresses | Flavor ID | Size | Region |
+ +--------------------------------------+------------+-----------+-------------------+---------+-----------+-----------+------+-----------+
+ | 55411e95-1670-497f-8d92-0179f3b4fdd4 | redis_test | redis | 3.2.7 | UPGRADE | 10.1.0.25 | 6 | 5 | RegionOne |
+ +--------------------------------------+------------+-----------+-------------------+---------+-----------+-----------+------+-----------+
+ $ openstack database instance list
+ +--------------------------------------+------------+-----------+-------------------+---------+-----------+-----------+------+-----------+
+ | ID | Name | Datastore | Datastore Version | Status | Addresses | Flavor ID | Size | Region |
+ +--------------------------------------+------------+-----------+-------------------+---------+-----------+-----------+------+-----------+
+ | 55411e95-1670-497f-8d92-0179f3b4fdd4 | redis_test | redis | 3.2.7 | HEALTHY | 10.1.0.25 | 6 | 5 | RegionOne |
+ +--------------------------------------+------------+-----------+-------------------+---------+-----------+-----------+------+-----------+
Other datastores
~~~~~~~~~~~~~~~~
@@ -91,6 +96,6 @@ Other datastores
Upgrade for other datastores works in the same way. Currently Trove
supports upgrades for the following datastores:
-- MySQL,
-- MariaDB,
-- Redis.
+- MySQL
+- MariaDB
+- Redis
diff --git a/trove/guestagent/datastore/mysql_common/manager.py b/trove/guestagent/datastore/mysql_common/manager.py
index 83dea547..3d9e149a 100644
--- a/trove/guestagent/datastore/mysql_common/manager.py
+++ b/trove/guestagent/datastore/mysql_common/manager.py
@@ -269,7 +269,7 @@ class MySqlManager(manager.Manager):
operating_system.copy("%s/." % os.path.expanduser('~'), home_save,
preserve=True, as_root=True)
- self.unmount_volume(context, mount_point=data_dir)
+ self.unmount_volume(context, mount_point=mount_point)
return {
'mount_point': mount_point,
'save_dir': save_dir,
diff --git a/trove/taskmanager/models.py b/trove/taskmanager/models.py
index 8d480188..e774846f 100755
--- a/trove/taskmanager/models.py
+++ b/trove/taskmanager/models.py
@@ -1346,8 +1346,8 @@ class BuiltInstanceTasks(BuiltInstance, NotifyMixin, ConfigurationMixin):
datastore_status.save()
def upgrade(self, datastore_version):
- LOG.debug("Upgrading instance %s to new datastore version %s",
- self, datastore_version)
+ LOG.info("Upgrading instance %s to new datastore version %s",
+ self.id, datastore_version)
def server_finished_rebuilding():
self.refresh_compute_server_info()
@@ -1390,17 +1390,22 @@ class BuiltInstanceTasks(BuiltInstance, NotifyMixin, ConfigurationMixin):
files=injected_files)
utils.poll_until(
server_finished_rebuilding,
- sleep_time=2, time_out=600)
+ sleep_time=5, time_out=600)
+
if not self.server_status_matches(['ACTIVE']):
raise TroveError(_("Instance %(instance)s failed to "
"upgrade to %(datastore_version)s"),
instance=self,
datastore_version=datastore_version)
+ LOG.info('Finished rebuilding server for instance %s', self.id)
+
self.guest.post_upgrade(upgrade_info)
self.reset_task_status()
-
+ LOG.info("Finished upgrading instance %s to new datastore "
+ "version %s",
+ self.id, datastore_version)
except Exception as e:
LOG.exception(e)
err = inst_models.InstanceTasks.BUILDING_ERROR_SERVER