Closed betweenclouds closed 2 years ago
@betweenclouds gosc could customize the VM through 2 ways: one is traditional customization, which calls its own engine to apply the customization specification. Another is cloud-init, which converts the customization specification to cloud-init meta data and delegate the customization to cloud-init. These 2 types of customization are controlled by flag disable_vmware_customization of file /etc/cloud/cloud.cfg
Regarding to cloud-init, its meta data/user data could read from:
You can't customize a VM with gosc + guestinfo.ovfEnv at the same time. As you know, traditional gosc customization will reboot the VM, this will interrupt the guestinfo.ovfEnv (cloud-init) and lead to unexpected results. You could provide us below logs for further analysis. Thanks. /var/log/vmware-imc/*.log /var/log/cloud-init.log
@PengpengSun Do you have any documentation about the interaction of cloud-init and gosc? Thanks.
Do you have any documentation about the interaction of cloud-init and gosc? Thanks.
Yes, there is a KB https://kb.vmware.com/s/article/59557 on how to enable or disable Linux guest customization with cloud-init.
As @xiaofengw-vmware mentioned, gosc traditional(legacy) workflow could interrupt cloud-init execution since there is a reboot triggered by gosc workflow. And vice versa, cloud-init execution could cause gosc traditional(legacy) workflow fail. For ubuntu, the suggestion way is use either gosc or cloud-init, not both of them at the same boot.
The logs will tell us more details on what happened, we probably will see the conflict happened between gosc and cloud-init. Beside /var/log/vmware-imc/*.log, please run 'cloud-init collect-logs' and share the tar file.
Thank you both for looking into this.
So, do you think that the issue here is that I set the IP with govc (this happend with gosc?) and then trigger the cloud-init with the guestinfo.ovfEnv var? I did this because I did not found any other clean way to set a fixed IP to the VM.
I tried both disable_vmware_customization=true and false, but get the same results. is it possible to config, gosc that it waits for cloud-init or is this the wrong way? Are there any options to configure gosc from outside, like the guestinfo vars? How do I give gosc the user-data to handover to cloud-init like @xiaofengw-vmware describes in point 1? Is this done in vCenter with a "VM Customization Specifications"? But then I cannot add any own user-data?
I will collect and attach the logs now.
```
2022-04-07 12:31:11,877 - util.py[DEBUG]: Cloud-init v. 21.4-0ubuntu1~20.04.1 running 'init-local' at Thu, 07 Apr 2022 12:31:11 +0000. Up 4.93 seconds.
2022-04-07 12:31:11,877 - main.py[DEBUG]: No kernel command line url found.
2022-04-07 12:31:11,877 - main.py[DEBUG]: Closing stdin.
2022-04-07 12:31:11,879 - util.py[DEBUG]: Writing to /var/log/cloud-init.log - ab: [644] 0 bytes
2022-04-07 12:31:11,879 - util.py[DEBUG]: Changing the ownership of /var/log/cloud-init.log to 104:4
2022-04-07 12:31:11,879 - util.py[DEBUG]: Writing to /var/lib/cloud/data/python-version - wb: [644] 3 bytes
2022-04-07 12:31:11,880 - util.py[DEBUG]: Attempting to remove /var/lib/cloud/instance/boot-finished
2022-04-07 12:31:11,880 - util.py[DEBUG]: Attempting to remove /var/lib/cloud/data/no-net
2022-04-07 12:31:11,880 - handlers.py[DEBUG]: start: init-local/check-cache: attempting to read from cache [check]
2022-04-07 12:31:11,880 - util.py[DEBUG]: Reading from /var/lib/cloud/instance/obj.pkl (quiet=False)
2022-04-07 12:31:11,880 - stages.py[DEBUG]: no cache found
2022-04-07 12:31:11,880 - handlers.py[DEBUG]: finish: init-local/check-cache: SUCCESS: no cache found
2022-04-07 12:31:11,880 - util.py[DEBUG]: Attempting to remove /var/lib/cloud/instance
2022-04-07 12:31:11,882 - stages.py[DEBUG]: Using distro class
Describe the bug
We struggling since a long time with the correct customization steps from a default ubuntu cloud image in one step (not create a template first and clone from this). We use govc to clone the imported ubuntu OVA, change the IP and add a minimal user-data, then start the VM. The VM reboots one time (initiated from gosc?) and is then configured.
The resulting VMs sometimes has the correct hostname (from the VM name) and sometimes just "ubuntu".
Why is this incosistent? Is there a documentation about the interaction of cloud-init and gosc (which part runs when and do they interact)?
I'm happy to deliver logs if needed.
Reproduction steps
Expected behavior
Every clone should be configured correct and consistent.
Additional context
To rule out any doubled user-data, I also tried this with the cdrom removed and vapp options disabled in the template with the same results.