Note that check_instance_id() is only needed if you want to avoid fetching metadata/userdata a second time; it does not prevent cloud-init from knowing it's on the same instance; In all cases, the metadata that indicates the instance-id _must_ remain associated with the instance.
Looking at the logs; it appears that after reboot the Customization file is not found and OVF datasource _get_data() method returns False; which tells cloud-init that it's not using OVF as a datasource.
1. firstboot finds OVF Customication
2019-07-24 07:50:43,682 - util.py[DEBUG]: Cloud-init v. 19.1-1-gbaa47854-0ubuntu1~18.04.1 running 'init-local' at Wed, 24 Jul 2019 07:50:43 +0000. Up 12.30 seconds.
...
2019-07-24 07:50:43,802 - __init__.py[DEBUG]: Searching for local data source in: ['DataSourceOVF']
2019-07-24 07:50:43,802 - handlers.py[DEBUG]: start: init-local/search-OVF: searching for local data from DataSourceOVF
2019-07-24 07:50:43,802 - __init__.py[DEBUG]: Seeing if we can get any data from <class 'cloudinit.sources.DataSourceOVF.DataSourceOVF'>
2019-07-24 07:50:43,802 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2019-07-24 07:50:43,813 - DataSourceOVF.py[DEBUG]: VMware Virtualization Platform found
2019-07-24 07:50:43,813 - DataSourceOVF.py[DEBUG]: Found the customization plugin at /usr/lib/open-vm-tools/plugins/vmsvc/libdeployPkgPlugin.so
2019-07-24 07:50:43,813 - DataSourceOVF.py[DEBUG]: Waiting for VMware Customization Config File
2019-07-24 07:50:48,818 - util.py[DEBUG]: waiting for configuration file took 5.005 seconds
2019-07-24 07:50:48,823 - DataSourceOVF.py[DEBUG]: Found VMware Customization Config File at /var/run/vmware-imc/cust.cfg
2019-07-24 07:50:49,928 - handlers.py[DEBUG]: finish: init-local/search-OVF: SUCCESS: found local data from DataSourceOVF
2019-07-24 07:50:49,929 - stages.py[INFO]: Loaded datasource DataSourceOVF - DataSourceOVF [seed=vmware-tools]
This sets the instance id to:
2019-07-24 07:50:49,945 - util.py[DEBUG]: Creating symbolic link from '/var/lib/cloud/instance' => '/var/lib/cloud/instances/iid-vmware-QokNwWPI'
2. Second boot of same instance does not find metadata from DataSourceOVF
2019-07-24 07:56:49,746 - DataSourceOVF.py[DEBUG]: VMware Virtualization Platform found
2019-07-24 07:56:49,746 - DataSourceOVF.py[DEBUG]: Found the customization plugin at /usr/lib/open-vm-tools/plugins/vmsvc/libdeployPkgPlugin.so
2019-07-24 07:56:49,746 - DataSourceOVF.py[DEBUG]: Waiting for VMware Customization Config File
2019-07-24 07:58:19,856 - util.py[DEBUG]: waiting for configuration file took 90.110 seconds
2019-07-24 07:58:19,858 - DataSourceOVF.py[DEBUG]: Did not find VMware Customization Config File
2019-07-24 07:58:20,152 - main.py[DEBUG]: [local] Exiting without datasource
Why did the customization data for the instance go away?
Note that check_instance_id() is only needed if you want to avoid fetching metadata/userdata a second time; it does not prevent cloud-init from knowing it's on the same instance; In all cases, the metadata that indicates the instance-id _must_ remain associated with the instance.
Looking at the logs; it appears that after reboot the Customization file is not found and OVF datasource _get_data() method returns False; which tells cloud-init that it's not using OVF as a datasource.
1. firstboot finds OVF Customication
2019-07-24 07:50:43,682 - util.py[DEBUG]: Cloud-init v. 19.1-1- gbaa47854- 0ubuntu1~ 18.04.1 running 'init-local' at Wed, 24 Jul 2019 07:50:43 +0000. Up 12.30 seconds. search- OVF: searching for local data from DataSourceOVF sources. DataSourceOVF. DataSourceOVF' >
...
2019-07-24 07:50:43,802 - __init__.py[DEBUG]: Searching for local data source in: ['DataSourceOVF']
2019-07-24 07:50:43,802 - handlers.py[DEBUG]: start: init-local/
2019-07-24 07:50:43,802 - __init__.py[DEBUG]: Seeing if we can get any data from <class 'cloudinit.
2019-07-24 07:50:43,802 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: New instance first boot
2019-07-24 07:50:43,813 - DataSourceOVF. py[DEBUG] : VMware Virtualization Platform found py[DEBUG] : Found the customization plugin at /usr/lib/ open-vm- tools/plugins/ vmsvc/libdeploy PkgPlugin. so py[DEBUG] : Waiting for VMware Customization Config File py[DEBUG] : Found VMware Customization Config File at /var/run/ vmware- imc/cust. cfg search- OVF: SUCCESS: found local data from DataSourceOVF
2019-07-24 07:50:43,813 - DataSourceOVF.
2019-07-24 07:50:43,813 - DataSourceOVF.
2019-07-24 07:50:48,818 - util.py[DEBUG]: waiting for configuration file took 5.005 seconds
2019-07-24 07:50:48,823 - DataSourceOVF.
2019-07-24 07:50:49,928 - handlers.py[DEBUG]: finish: init-local/
2019-07-24 07:50:49,929 - stages.py[INFO]: Loaded datasource DataSourceOVF - DataSourceOVF [seed=vmware-tools]
This sets the instance id to:
2019-07-24 07:50:49,945 - util.py[DEBUG]: Creating symbolic link from '/var/lib/ cloud/instance' => '/var/lib/ cloud/instances /iid-vmware- QokNwWPI'
2. Second boot of same instance does not find metadata from DataSourceOVF
2019-07-24 07:56:49,746 - DataSourceOVF. py[DEBUG] : VMware Virtualization Platform found py[DEBUG] : Found the customization plugin at /usr/lib/ open-vm- tools/plugins/ vmsvc/libdeploy PkgPlugin. so py[DEBUG] : Waiting for VMware Customization Config File
2019-07-24 07:56:49,746 - DataSourceOVF.
2019-07-24 07:56:49,746 - DataSourceOVF.
2019-07-24 07:58:19,856 - util.py[DEBUG]: waiting for configuration file took 90.110 seconds py[DEBUG] : Did not find VMware Customization Config File
2019-07-24 07:58:19,858 - DataSourceOVF.
2019-07-24 07:58:20,152 - main.py[DEBUG]: [local] Exiting without datasource
Why did the customization data for the instance go away?