From 73c7288cb4b3f42db76bcfc34124f2fdc936750c Mon Sep 17 00:00:00 2001 From: Maddie Ford Date: Tue, 9 Jan 2024 16:44:53 -0800 Subject: [PATCH 1/4] Daemon should remove published_hostname file and log useful warning --- azurelinuxagent/pa/deprovision/default.py | 3 ++- azurelinuxagent/pa/provision/default.py | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/azurelinuxagent/pa/deprovision/default.py b/azurelinuxagent/pa/deprovision/default.py index edf736811..f781bd4c5 100644 --- a/azurelinuxagent/pa/deprovision/default.py +++ b/azurelinuxagent/pa/deprovision/default.py @@ -158,7 +158,8 @@ def del_lib_dir_files(self, warnings, actions): # pylint: disable=W0613 'partition', 'Protocol', 'SharedConfig.xml', - 'WireServerEndpoint' + 'WireServerEndpoint', + 'published_hostname' ] known_files_glob = [ 'Extensions.*.xml', diff --git a/azurelinuxagent/pa/provision/default.py b/azurelinuxagent/pa/provision/default.py index 91fe04eda..a872d70fd 100644 --- a/azurelinuxagent/pa/provision/default.py +++ b/azurelinuxagent/pa/provision/default.py @@ -172,9 +172,11 @@ def check_provisioned_file(self): s = fileutil.read_file(ProvisionHandler.provisioned_file_path()).strip() if not self.osutil.is_current_instance_id(s): if len(s) > 0: - logger.warn("VM is provisioned, " - "but the VM unique identifier has changed -- " - "clearing cached state") + msg = "VM is provisioned, but the VM unique identifier has changed. This indicates the VM may be " \ + "created from an image that was not properly deprovisioned or generalized, which can result in " \ + "unexpected behavior from the guest agent -- clearing cached state" + logger.warn(msg) + self.report_event(msg) from azurelinuxagent.pa.deprovision \ import get_deprovision_handler deprovision_handler = get_deprovision_handler() From fd9ed8609124c4ed09f1e9568198009b785c6104 Mon Sep 17 00:00:00 2001 From: Maddie Ford Date: Tue, 9 Jan 2024 17:00:27 -0800 Subject: [PATCH 2/4] Clean up fast track file if vm id has changed --- azurelinuxagent/pa/deprovision/default.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azurelinuxagent/pa/deprovision/default.py b/azurelinuxagent/pa/deprovision/default.py index f781bd4c5..1ab1bda8c 100644 --- a/azurelinuxagent/pa/deprovision/default.py +++ b/azurelinuxagent/pa/deprovision/default.py @@ -159,7 +159,8 @@ def del_lib_dir_files(self, warnings, actions): # pylint: disable=W0613 'Protocol', 'SharedConfig.xml', 'WireServerEndpoint', - 'published_hostname' + 'published_hostname', + 'fast_track.json' ] known_files_glob = [ 'Extensions.*.xml', From 36992cd7f6e0dd6834e969dcdd11de55f52044f6 Mon Sep 17 00:00:00 2001 From: Maddie Ford Date: Tue, 9 Jan 2024 17:07:28 -0800 Subject: [PATCH 3/4] Clean up initial_goal_state file if vm id has changed --- azurelinuxagent/pa/deprovision/default.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azurelinuxagent/pa/deprovision/default.py b/azurelinuxagent/pa/deprovision/default.py index 1ab1bda8c..3363ef3c7 100644 --- a/azurelinuxagent/pa/deprovision/default.py +++ b/azurelinuxagent/pa/deprovision/default.py @@ -160,7 +160,8 @@ def del_lib_dir_files(self, warnings, actions): # pylint: disable=W0613 'SharedConfig.xml', 'WireServerEndpoint', 'published_hostname', - 'fast_track.json' + 'fast_track.json', + 'initial_goal_state' ] known_files_glob = [ 'Extensions.*.xml', From f10be2cea3e7c8191a7b3c5451024d5304b7713d Mon Sep 17 00:00:00 2001 From: Maddie Ford Date: Wed, 10 Jan 2024 10:39:41 -0800 Subject: [PATCH 4/4] Clean up rsm_update file if vm id has changed --- azurelinuxagent/pa/deprovision/default.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azurelinuxagent/pa/deprovision/default.py b/azurelinuxagent/pa/deprovision/default.py index 3363ef3c7..35b4ae82e 100644 --- a/azurelinuxagent/pa/deprovision/default.py +++ b/azurelinuxagent/pa/deprovision/default.py @@ -161,7 +161,8 @@ def del_lib_dir_files(self, warnings, actions): # pylint: disable=W0613 'WireServerEndpoint', 'published_hostname', 'fast_track.json', - 'initial_goal_state' + 'initial_goal_state', + 'rsm_update.json' ] known_files_glob = [ 'Extensions.*.xml',