ddelnano / packer-plugin-xenserver

A builder plugin for Packer.IO to support building XenServer images.
Mozilla Public License 2.0
72 stars 37 forks source link

Let users choose if they want a template or a full VM #89

Closed AtaxyaNetwork closed 11 months ago

AtaxyaNetwork commented 1 year ago

Currently, if we use the packer plugin “as is”, the provider will output an XVA file which is an exported VM with the template field set to “true”. In the case of an XVA template, we can “just” reimport it as a template for Xen Orchestra, and then use it to create a VM. For some reason, anyone might want to generate a VM which is NOT a template, so you can import the XVA and run it immediately.

My current workaround is to comment new(xscommon.StepSetVmToTemplate) in the file builder.go, rebuild the provider, and use it.

So, I would like to have a nice packer variable to switch easily between the “XVA template” and the “XVA VM”

I have in mind the steps to achieve this, but since I'm not a good Go developer, I can't have it work as I wish My idea is to:

Maybe it can be done in another way, but, as I said, go is not (yet) my best friend :D

@ddelnano can I have your opinion about this ?

ddelnano commented 1 year ago

Hey @AtaxyaNetwork, thank you for the contributions and sorry for the late reply.

I'm curious to know your motivation for this change. Packer builders are meant for creating machine images. The ideal separation is that a builder provides the image that a terraform provider can consume (for example for AWS's packer-builder-aws/terraform-provider-aws or Xen Orchestra's packer-plugin-xenserver/terraform-provider-xenorchestra). You mentioned that you use Xen Orchestra, so I'd be interested to know if you use the terraform provider and/or any feedback you have.

In my opinion, adding this configuration parameter veers away from how the Hashicorp ecosystem (packer/terraform) is supposed to work. However, I'm open to the contribution as long as the setting is disabled by default (since that is the mental model for all other packer/terraform integrations).

I'll have some comments on your PR soon.

AtaxyaNetwork commented 1 year ago

Hi ! Thank you for your reply !

I did use the terraform provider (and by the way, I appreciate this tool!) for my personal infrastructure, and it's working well !

The motivation for this change is that I have a case where I need to prepare my images, but keep it in the way that I can take it just after packer has finished processing, and have a VM "ready to use" to distribute to other people. If you're using Xen Orchestra, this is the same idea as the Hub: VM ready to be downloaded, imported to your host with the disk resized and ready to use !

I can understand it's a bit out of the scope from the HashiCorp way to use, but I think it can be useful for other people who need to prepare VM ready to be shipped to other people/infrastructure.

I'll look at your comment on my PR soon !

ddelnano commented 11 months ago

Thanks for explaining your use case 👍. Closing since this was completed in #94.