Ryan Harper has proposed merging ~raharper/cloud-init:fix/ovf-reset-instance-id 
into cloud-init:master.

Commit message:
ovf: do not generate random instance-id for IMC customization path

Cloud-init will not operate properly if the instance-id value changes
on each boot. This is the source of a number of behavioral bugs filed
against cloud-init with OVF datasource. Instead, use a static instance-id
value, iid-vmware-imc, similar to iid-dsovf.

Requested reviews:
  cloud-init Commiters (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~raharper/cloud-init/+git/cloud-init/+merge/373281
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~raharper/cloud-init:fix/ovf-reset-instance-id into cloud-init:master.
diff --git a/cloudinit/sources/DataSourceOVF.py b/cloudinit/sources/DataSourceOVF.py
index b156189..e7794aa 100644
--- a/cloudinit/sources/DataSourceOVF.py
+++ b/cloudinit/sources/DataSourceOVF.py
@@ -406,9 +406,7 @@ def read_vmware_imc(config):
     if config.timezone:
         cfg['timezone'] = config.timezone
 
-    # Generate a unique instance-id so that re-customization will
-    # happen in cloud-init
-    md['instance-id'] = "iid-vmware-" + util.rand_str(strlen=8)
+    md['instance-id'] = "iid-vmware-imc"
     return (md, ud, cfg)
 
 
diff --git a/tests/unittests/test_vmware_config_file.py b/tests/unittests/test_vmware_config_file.py
index f47335e..16343ed 100644
--- a/tests/unittests/test_vmware_config_file.py
+++ b/tests/unittests/test_vmware_config_file.py
@@ -62,13 +62,13 @@ class TestVmwareConfigFile(CiTestCase):
 
         (md1, _, _) = read_vmware_imc(conf)
         self.assertIn(instance_id_prefix, md1["instance-id"])
-        self.assertEqual(len(md1["instance-id"]), len(instance_id_prefix) + 8)
+        self.assertEqual(md1["instance-id"], 'iid-vmware-imc')
 
         (md2, _, _) = read_vmware_imc(conf)
         self.assertIn(instance_id_prefix, md2["instance-id"])
-        self.assertEqual(len(md2["instance-id"]), len(instance_id_prefix) + 8)
+        self.assertEqual(md2["instance-id"], 'iid-vmware-imc')
 
-        self.assertNotEqual(md1["instance-id"], md2["instance-id"])
+        self.assertEqual(md2["instance-id"], md1["instance-id"])
 
     def test_configfile_static_2nics(self):
         """Tests Config class for a configuration with two static NICs."""
_______________________________________________
Mailing list: https://launchpad.net/~cloud-init-dev
Post to     : cloud-init-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~cloud-init-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to