You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This bug was originally filed in Launchpad as LP: #1998998
Launchpad details
affected_projects = []
assignee = None
assignee_name = None
date_closed = 2023-02-22T16:52:32.106568+00:00
date_created = 2022-12-07T04:37:33.678461+00:00
date_fix_committed = 2023-02-22T16:52:32.106568+00:00
date_fix_released = 2023-02-22T16:52:32.106568+00:00
id = 1998998
importance = high
is_complete = True
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1998998
milestone = None
owner = chad.smith
owner_name = Chad Smith
private = False
status = fix_released
submitter = chad.smith
submitter_name = Chad Smith
tags = ['bitesize']
duplicates = []
Launchpad user Chad Smith(chad.smith) wrote on 2022-12-07T04:37:33.678461+00:00
cloud-init 22.4.2
On Azure, datasource details change across reboot cloud-init incorrectly removes /run/cloud-init/cloud-id-azure symlink.
2022-12-07 04:14:17,920 - util.py[DEBUG]: Creating symbolic link from '/run/cloud-init/cloud-id' => '/run/cloud-init/cloud-id-azure'
2022-12-07 04:14:17,920 - util.py[DEBUG]: Attempting to remove /run/cloud-init/cloud-id-azure
FRESH LAUNCH
ubuntu@test-focal:$ ls -l /run/cloud-init/cloud-id
lrwxrwxrwx 1 root root 30 Dec 7 04:10 /run/cloud-init/cloud-id -> /run/cloud-init/cloud-id-azure
ubuntu@test-focal:$ grep cloud-id /var/log/cloud-init.log
2022-12-07 04:10:34,734 - util.py[DEBUG]: Writing to /run/cloud-init/cloud-id-azure - wb: [644] 6 bytes
2022-12-07 04:10:34,735 - util.py[DEBUG]: Creating symbolic link from '/run/cloud-init/cloud-id' => '/run/cloud-init/cloud-id-azure'
ACROSS REBOOT
ubuntu@test-focal:~$ ls -l /run/cloud-init/cloud-id
lrwxrwxrwx 1 root root 30 Dec 7 04:14 /run/cloud-init/cloud-id -> /run/cloud-init/cloud-id-azure
2022-12-07 04:14:17,920 - util.py[DEBUG]: Writing to /run/cloud-init/cloud-id-azure - wb: [644] 6 bytes
2022-12-07 04:14:17,920 - util.py[DEBUG]: Creating symbolic link from '/run/cloud-init/cloud-id' => '/run/cloud-init/cloud-id-azure'
2022-12-07 04:14:17,920 - util.py[DEBUG]: Attempting to remove /run/cloud-init/cloud-id-azure
It looks like the symlink cleanup logic introduced in 217ef6b (which was released in cloud-init v. 21.4) doesn't do a proper comparison of previous-datasource to current datasource
Debug logs added to https://github.com/canonical/cloud-init/blob/main/cloudinit/sources/__init__.py#L443 shows that we are comparing the incorrect source file /root/cloud-init/cloud-id versus actually comparing the cloud-specific symlink name /run/cloud-init/cloud-id-, resulting in a removal of the cloud-specific link name across reboot.
Likely all we need is a correction in logic like the following:
diff --git a/cloudinit/sources/init.py b/cloudinit/sources/init.py
index 85e094ac5..3fb08ead2 100644
--- a/cloudinit/sources/init.py
+++ b/cloudinit/sources/init.py
@@ -439,8 +439,9 @@ class DataSource(CloudInitPickleMixin, metaclass=abc.ABCMeta):
prev_cloud_id_file = os.path.realpath(cloud_id_file)
else:
prev_cloud_id_file = cloud_id_file
Launchpad user Alberto Contreras(aciba) wrote on 2023-02-22T16:52:33.051720+00:00
This bug is believed to be fixed in cloud-init in version 23.1. If this is still a problem for you, please make a comment and set the state back to New
This bug was originally filed in Launchpad as LP: #1998998
Launchpad details
Launchpad user Chad Smith(chad.smith) wrote on 2022-12-07T04:37:33.678461+00:00
cloud-init 22.4.2
On Azure, datasource details change across reboot cloud-init incorrectly removes /run/cloud-init/cloud-id-azure symlink.
2022-12-07 04:14:17,920 - util.py[DEBUG]: Creating symbolic link from '/run/cloud-init/cloud-id' => '/run/cloud-init/cloud-id-azure'
2022-12-07 04:14:17,920 - util.py[DEBUG]: Attempting to remove /run/cloud-init/cloud-id-azure
FRESH LAUNCH
ubuntu@test-focal:
$ ls -l /run/cloud-init/cloud-id$ grep cloud-id /var/log/cloud-init.loglrwxrwxrwx 1 root root 30 Dec 7 04:10 /run/cloud-init/cloud-id -> /run/cloud-init/cloud-id-azure
ubuntu@test-focal:
2022-12-07 04:10:34,734 - util.py[DEBUG]: Writing to /run/cloud-init/cloud-id-azure - wb: [644] 6 bytes
2022-12-07 04:10:34,735 - util.py[DEBUG]: Creating symbolic link from '/run/cloud-init/cloud-id' => '/run/cloud-init/cloud-id-azure'
ACROSS REBOOT
ubuntu@test-focal:~$ ls -l /run/cloud-init/cloud-id
lrwxrwxrwx 1 root root 30 Dec 7 04:14 /run/cloud-init/cloud-id -> /run/cloud-init/cloud-id-azure
2022-12-07 04:14:17,920 - util.py[DEBUG]: Writing to /run/cloud-init/cloud-id-azure - wb: [644] 6 bytes
2022-12-07 04:14:17,920 - util.py[DEBUG]: Creating symbolic link from '/run/cloud-init/cloud-id' => '/run/cloud-init/cloud-id-azure'
2022-12-07 04:14:17,920 - util.py[DEBUG]: Attempting to remove /run/cloud-init/cloud-id-azure
It looks like the symlink cleanup logic introduced in 217ef6b (which was released in cloud-init v. 21.4) doesn't do a proper comparison of previous-datasource to current datasource
Debug logs added to https://github.com/canonical/cloud-init/blob/main/cloudinit/sources/__init__.py#L443 shows that we are comparing the incorrect source file /root/cloud-init/cloud-id versus actually comparing the cloud-specific symlink name /run/cloud-init/cloud-id-, resulting in a removal of the cloud-specific link name across reboot.
2022-12-07 04:25:58,162 - init.py[WARNING]: previous_cloud_id_file /run/cloud-init/cloud-id-azure != cloud_id_file /run/cloud-init/cloud-id
Likely all we need is a correction in logic like the following:
diff --git a/cloudinit/sources/init.py b/cloudinit/sources/init.py
index 85e094ac5..3fb08ead2 100644
--- a/cloudinit/sources/init.py
+++ b/cloudinit/sources/init.py
@@ -439,8 +439,9 @@ class DataSource(CloudInitPickleMixin, metaclass=abc.ABCMeta):
prev_cloud_id_file = os.path.realpath(cloud_id_file)
else:
prev_cloud_id_file = cloud_id_file
The text was updated successfully, but these errors were encountered: