diff --git a/releasenotes/notes/post-upgrade-fixes-828811607826d433.yaml b/releasenotes/notes/post-upgrade-fixes-828811607826d433.yaml new file mode 100644 index 0000000000..ca276a5176 --- /dev/null +++ b/releasenotes/notes/post-upgrade-fixes-828811607826d433.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - After upgrading the guestagent was in an inconsistent state. This became + apparent after restarting or resizing the instance after upgrading. diff --git a/trove/guestagent/datastore/experimental/postgresql/manager.py b/trove/guestagent/datastore/experimental/postgresql/manager.py index 840513123e..b945131cea 100644 --- a/trove/guestagent/datastore/experimental/postgresql/manager.py +++ b/trove/guestagent/datastore/experimental/postgresql/manager.py @@ -159,7 +159,8 @@ class Manager(manager.Manager): self.app.stop_db() if 'device' in upgrade_info: self.mount_volume(context, mount_point=upgrade_info['mount_point'], - device_path=upgrade_info['device']) + device_path=upgrade_info['device'], + write_to_fstab=True) self.app.restore_files_post_upgrade(upgrade_info) self.app.start_db() diff --git a/trove/guestagent/datastore/experimental/postgresql/service.py b/trove/guestagent/datastore/experimental/postgresql/service.py index a59d711058..1f7ce687eb 100644 --- a/trove/guestagent/datastore/experimental/postgresql/service.py +++ b/trove/guestagent/datastore/experimental/postgresql/service.py @@ -561,6 +561,8 @@ class PgSqlApp(object): force=True, as_root=True) operating_system.remove(upgrade_info['save_etc'], force=True, as_root=True) + self.configuration_manager.refresh_cache() + self.status.set_ready() class PgSqlAppStatus(service.BaseDbStatus): diff --git a/trove/guestagent/datastore/mysql_common/manager.py b/trove/guestagent/datastore/mysql_common/manager.py index b670dd0fa7..07be748edf 100644 --- a/trove/guestagent/datastore/mysql_common/manager.py +++ b/trove/guestagent/datastore/mysql_common/manager.py @@ -290,6 +290,7 @@ class MySqlManager(manager.Manager): operating_system.copy("%s/." % upgrade_info['home_save'], os.path.expanduser('~'), preserve=True, as_root=True) + self.configuration_manager.refresh_cache() app.start_mysql() def restart(self, context): diff --git a/trove/guestagent/datastore/service.py b/trove/guestagent/datastore/service.py index f5042f3acb..a3af9af819 100644 --- a/trove/guestagent/datastore/service.py +++ b/trove/guestagent/datastore/service.py @@ -97,16 +97,19 @@ class BaseDbStatus(object): """Called before restarting DB server.""" self.restart_mode = True + def set_ready(self): + prepare_end_file = guestagent_utils.build_file_path( + self.GUESTAGENT_DIR, self.PREPARE_END_FILENAME) + operating_system.write_file(prepare_end_file, '') + self.__refresh_prepare_completed() + def end_install(self, error_occurred=False, post_processing=False): """Called after prepare has ended.""" # Set the "we're done" flag if there's no error and # no post_processing is necessary if not (error_occurred or post_processing): - prepare_end_file = guestagent_utils.build_file_path( - self.GUESTAGENT_DIR, self.PREPARE_END_FILENAME) - operating_system.write_file(prepare_end_file, '') - self.__refresh_prepare_completed() + self.set_ready() final_status = None if error_occurred: