summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@brickies.net>2016-08-23 16:48:38 -0400
committerScott Moser <smoser@brickies.net>2016-08-23 16:48:38 -0400
commite18ed85921139d34f015b43075a21335e87fb319 (patch)
tree0586efae33fb992c8558e0e141029bb68eb8c712
parent13d251917fbd888344ecc91c9308c733890b7d2d (diff)
downloadcloud-init-git-e18ed85921139d34f015b43075a21335e87fb319.tar.gz
Import version 0.7.7~bzr1156-0ubuntu1ubuntu/0.7.7_bzr1156-0ubuntu1
Imported using git-dsc-commit.
-rw-r--r--debian/changelog8
-rw-r--r--debian/cloud-init.preinst75
2 files changed, 81 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog
index 085a2d01..b99e77de 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+cloud-init (0.7.7~bzr1156-0ubuntu1) xenial; urgency=medium
+
+ * New upstream snapshot.
+ * d/cloud-init.preinst: migrate Azure instance ID from old ID to stable
+ ID (LP: #1506187).
+
+ -- Ben Howard <ben.howard@ubuntu.com> Tue, 17 Nov 2015 11:59:49 -0700
+
cloud-init (0.7.7~bzr1155-0ubuntu1) xenial; urgency=medium
* New upstream snapshot.
diff --git a/debian/cloud-init.preinst b/debian/cloud-init.preinst
index e5c7755f..e383c092 100644
--- a/debian/cloud-init.preinst
+++ b/debian/cloud-init.preinst
@@ -105,6 +105,73 @@ convert_varlib_05x_06x() {
return 0
}
+azure_apply_new_instance_id_1506187() {
+ # With LP: #1506187, the Azure instance ID detection method was changed
+ # to use the DMI data. In order to prevent existing instances from thinking
+ # they are new instances, the instance ID needs to be updated here.
+
+ if grep DataSourceAzure /var/lib/cloud/instance/datasource > /dev/null 2>&1; then
+
+ product_id_f="/sys/devices/virtual/dmi/id/product_uuid"
+ instance_id_f="/var/lib/cloud/data/instance-id"
+
+ if [ ! -e "${product_id_f}" -o ! -e "${instance_id_f}" ]; then
+ return 0
+ fi
+
+ # Get the current instance ID's (new and old)
+ new_instance_id="$(cat ${product_id_f})"
+ old_instance_id="$(cat ${instance_id_f})"
+
+ if [ "${new_instance_id}" = "${old_instance_id}" ]; then
+ # this may have been applied for a prior version, i.e. upgrading
+ # from 14.04 to 16.04
+ return 0
+
+ elif [ -z "${new_instance_id}" -o -z "${old_instance_id}" ]; then
+ cat <<EOM
+
+WARNING: Failed to migrate old instance ID to new instance ID.
+ Cloud-init may detect this instance as a new instance upon reboot.
+ Please see: https://bugs.launchpad.net/bug/1506187
+
+EOM
+
+ elif [ "${new_instance_id}" != "${old_instance_id}" ]; then
+ cat <<EOM
+
+AZURE: this instance uses an unstable instance ID. Cloud-init will
+ migrate the instance ID from:
+ ${old_instance_id}
+ to:
+ ${new_instance_id}
+ For more information about this change, please see:
+ https://bugs.launchpad.net/bug/1506187
+ https://azure.microsoft.com/en-us/blog/accessing-and-using-azure-vm-unique-id
+
+EOM
+
+ # Write the new instance id
+ echo "${new_instance_id}" > /var/lib/cloud/data/instance-id
+
+ # Remove the symlink for the instance
+ rm /var/lib/cloud/instance
+
+ # Rename the old instance id to the new one
+ mv /var/lib/cloud/instances/${old_instance_id} \
+ /var/lib/cloud/instances/${new_instance_id}
+
+ # Link the old id to the new one, just incase
+ ln -s /var/lib/cloud/instances/${new_instance_id} \
+ /var/lib/cloud/instances/${old_instance_id}
+
+ # Make the active instance the new id
+ ln -s /var/lib/cloud/instances/${new_instance_id} \
+ /var/lib/cloud/instance
+ fi
+fi
+}
+
case "$1" in
install|upgrade)
# removing obsolete conffiles from the 'ec2-init' package
@@ -130,7 +197,7 @@ case "$1" in
for f in ${old_confs}; do
rm_conffile cloud-init "/etc/init/${f}.conf"
done
- fi
+ fi
if dpkg --compare-versions "$2" le "0.5.11-0ubuntu1"; then
# rename the config entries in sem/ so they're not run again
@@ -159,7 +226,11 @@ case "$1" in
if [ -e /var/lib/cloud/instance/sem/user-scripts ]; then
ln -sf user-scripts /var/lib/cloud/instance/sem/config-scripts-user
fi
-
+
+ # 0.7.7-bzr1556 introduced new instance ID source for Azure
+ if dpkg --compare-versions "$2" le "0.7.7~bzr1556-0ubuntu1"; then
+ azure_apply_new_instance_id_1506187
+ fi
d=/etc/cloud/
if [ -f "$d/distro.cfg" ] && [ ! -f "$d/cloud.cfg.d/90_dpkg.cfg" ]; then