Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cloudinit ready template generation #51

Merged
merged 1 commit into from Jan 21, 2023
Merged

Fix cloudinit ready template generation #51

merged 1 commit into from Jan 21, 2023

Conversation

BMeach
Copy link

@BMeach BMeach commented Jan 12, 2023

Adds a line of code that should fix the issues decribed here on the XCP-NG Forum

The following fix calls the xapi VM.remove_from_other_config hook to remove any "disks" entries from the vm that will be turned into a template via Packer. Currently this fix has only been tested with the Xen Orchestra "Ubuntu Focal Fossa 20.04" default template.

@ddelnano
Copy link
Owner

@BryceTech122 thanks for getting this PR open. I feel confident that this is the fix, but I'd like to test this PR end to end myself. Once I validate the testing you've done, I'll merge and release a bugfix version of the packer plugin.

@BMeach
Copy link
Author

BMeach commented Jan 13, 2023

@ddelnano sounds good, let me know if I can help in testing at all. Currently im using this fix 10x times a day only on ubuntu 20.04 though

@ddelnano
Copy link
Owner

@BryceTech122 apologies for the wait. My normal development environment (homelab) has been unstable and hindered my ability to test this. I was able to use the environment that the Xen Orchestra terraform provider is tested in after completing some setup.

I was able to create 2 templates: one on master and one with this branch. The former is unable to use cloud init (as seen in the screenshot below) due to its other-config property having a disks: key. The latter works as expected and doesn't have a disks: key in its other-config.

Screenshot_20230120_235943
Screenshot_20230120_235926

[09:00 R620-1 ~]# xe template-list | grep -B 1 packer
uuid ( RO)                : f5d5d36c-b0bd-8474-7266-5ffa176432ff
          name-label ( RW): packer-ubuntu-2004-20230121073403
--
uuid ( RO)                : 05320e0a-39db-8d76-d98b-d8dbc42d823a
          name-label ( RW): packer-ubuntu-2004-broken-20230121065103

# Verify the non "broken" named template doesn't contain "disks:"
[09:00 R620-1 ~]# xe template-param-list uuid=f5d5d36c-b0bd-8474-7266-5ffa176432ff | grep other-config
                          other-config (MRW): base_template_name: Ubuntu Focal Fossa 20.04; import_task: OpaqueRef:13a80d23-9058-40cc-bc09-3df8844e1f5f; mac_seed: 98ac2c4e-f097-a12a-d415-d6ae467f9ce0; install-methods: cdrom,nfs,http,ftp; linux_template: true

# Verify the broken named template does include a "disks:" key
[09:00 R620-1 ~]# xe template-param-list uuid=05320e0a-39db-8d76-d98b-d8dbc42d823a | grep other-config
                          other-config (MRW): base_template_name: Ubuntu Focal Fossa 20.04; import_task: OpaqueRef:13a80d23-9058-40cc-bc09-3df8844e1f5f; mac_seed: 434b259e-d5fd-b4ce-7bb1-647462925c1a; disks: <provision><disk bootable="true" device="0" size="10737418240" sr="" type="system"/></provision>; install-methods: cdrom,nfs,http,ftp; linux_template: true

@ddelnano
Copy link
Owner

I'll be creating a bugfix release now and you should be able to packer init it once the artifacts are uploaded to the github release from the CI job.

@ddelnano ddelnano merged commit 79c6b50 into ddelnano:master Jan 21, 2023
@BMeach
Copy link
Author

BMeach commented Jan 21, 2023

Thank you for your and Oliver's help in resolving this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants