Various post-upgrade fixes

The config file gets restored so the config cache needs refreshing.

Touch .guestagent.prepare.end file after upgrade to fix the problem of
the guestagent not knowing if prepare has ran.

Write the volume mount to fstab to persist after subsequent restarts.

Change-Id: I3831de12c999ef8818e80ecdb29f1d86ff8cd5c8
Closes-bug: #1645460
Depends-On: I5c1714b7839b2736c50f2daa2f4506c4006815a1
This commit is contained in:
Matt Van Dijk 2016-11-28 15:21:46 -05:00
parent 80312c2797
commit c63ca98bd2
5 changed files with 16 additions and 5 deletions

View File

@ -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.

View File

@ -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()

View File

@ -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):

View File

@ -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):

View File

@ -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: