Created attachment 1676404 [details] VM_yaml_file_screen_shot Description of problem: Import a RHEL7.6 VM that has cloud-init package installed, and cloud-init service enabled, In the Import VM dialog, cloud init screen fill this custom script: write_files: - path: "/tmp/test.txt" content: Here is a line. Import the VM, and then start the VM. The file was not created on the VM, as expected, according to the provided custom script. In the VM yaml file the cloudInitNoCloud section is in the attached cloud-init-in-yaml.png Version-Release number of selected component (if applicable): CNV-2.2.0-10
This bug was initially reported in Bug 1786350, and was separated to this current bug.
With patch [1] applied, I followed: - create Fedora 29 VM with cloud-init hostname and ssh_authorized_keys set via form in the UI - and subsequently see /home/fedora/.ssh/authorized_keys to be filled with the key (so IIUC, this issue is fixed) Next, - turn off the VM - edit VM's YAML to contain following: ``` - cloudInitNoCloud: userData: | #cloud-config name: default hostname: my-host password: fedora chpasswd: { expire: False } write_files: - path: "/tmp/test.txt" content: Here is a line. ssh_authorized_keys: - >- ssh-rsa AAAAB3ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ0Ig22WIK1rsnmvV2b0zbJEkRlDBaXOa1N/H/bC1YpKRWi2kiMVfh023vkTwOt/P4D8Db1tNEQxV8JS97JNli+6Oxas+mI6BdS+iSXjORCg5Dvghx8rHFvimHTJz35KW7 mlibra.redhat.com name: cloudinitdisk ``` - once the VM is started, I can still see proper content in the authorized_keys file, same as the expected content in the `/tmp/test.txt` file. Next, - Custom script entered by the UI form works as well (means: is executed). So far I did not try on rhel-7.6 since I have difficulties to get the image. Will keep trying. I did not try within the v2v flow but the behavior should be the same in this part. Ilanit, can you please confirm that this is the expected behavior? And verify for both create and import RHEL-7.6 flows, please? [1] https://github.com/openshift/console/pull/4923
Update: I have just succeeded with the steps above on RHEL 7.6 too The only thing missing to be tested is v2v Import flow but the code is shared with the Create VM flow.
Based on Marek's verification, for cloud-init, both by form fill with ssh key, and custom script, in VM creation, moving bug to verified.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2020:2409