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

Clarification on keep_vm, format, output_directory, and sr_name. #76

Open DesignsWithDavid opened 1 year ago

DesignsWithDavid commented 1 year ago

I have experimented with this plugin for several days now and after reading through the documentation, I am still confused on the exact functionality of keep_vm, format, output_directory, and sr_name.

To begin, I was under the impression that the sr_name provided the storage repository where the resulting files would be stored. If that is the case, what is the need for an output directory on the local machine? Are these two functionalities mutually exclusive, meaning, either you create a template OR you store the resulting XVA?

Additionally, is the logic for keep_vm reversed? Or am I missing something? It seems that if keep_vm=on_success is set, and the creation of the template is successful, the vm is actually deleted. Does "keeping" refer to downloading the XVA as opposed to keeping a template? Is this better names "keep_template"?

The documentation states that keep_vm=on_success "requests that the VM only be cleaned up if an artifact was produced. The latter is useful for debugging templates that fail." Wouldn't it make sense that you would keep the vm on failure? This wording confuses me.

Lastly, for the format setting, the documentation states, "Set to "none" to export nothing; this is only useful with "keep_vm" set to "always" or "on_success"." If keeping the vm means downloading it to the local machine at the output_directory, why would you every set the format to "none"?

Once these points are clarified, I would be more that willing to help update the documentation so that the next newbie is not as confused.

Shackelford-Arden commented 8 months ago

@DesignsWithDavid , now that it's been a while, I'm curious if you've come to better understand any of these points as you've used the plugin more? One might say I'm one of the "next newbie"s you mentioned :smile:

DesignsWithDavid commented 6 months ago

Unfortunately, I am still unclear on these terms.

CoolReaper commented 4 months ago

This is my understanding as I've done some extensive testing:

The idea of using Packer is to create a template VM, therefore, once Packer runs all its tasks, it saves the VM and its disks as template on the host. Additionally it might export to a path. Here is where format and output_directory come into place. They define in which format and to where you want the export to happen.

For Format if you set to none, nothing is exported if build is successful, but the template is still created if build is successful.

Keep_VM I believe has some bugs, but the idea is to define whether the VM should be deleted if Packer fails some task or not. Indeed I've also experimented with it and the VM will always get deleted unless I set keep_VM to always. Still, even if set to always, if the build is successful, it will create a template and delete the VM, so I believe that Keep_VM should be understood as "what should Packer do if build is not successful". I haven't found any use case for "on_success". I think it doesn't work. Setting it to "Always" will leave the VM running if you cancel the build. Setting it to "Never" will delete the VM in all use cases.

SR_Name is definitely not related with any kind of output. it's the Storage Repository where the VM disks will be created.

And yes, I also found the documentation quite confusing. Hope this helps somehow.