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

Add 'args' as optional configuration parameter when creating a VM #245

Merged
merged 5 commits into from
Jan 11, 2024

Conversation

rhpijnacker
Copy link
Contributor

@rhpijnacker rhpijnacker commented Dec 31, 2023

To create macOS VMs in Proxmox, the args parameter needs to be set to pass some additional values to the underlying KVM. This PR adds support for setting this in the packer source.

This builds on https://github.com/Telmate/proxmox-api-go/pull/117/files, which already makes it possible to pass Args in the ConfigQemu struct.

Closes #243

@rhpijnacker rhpijnacker requested a review from a team as a code owner December 31, 2023 10:28
@hashicorp-cla
Copy link

hashicorp-cla commented Dec 31, 2023

CLA assistant check
All committers have signed the CLA.

@rhpijnacker rhpijnacker changed the title [WIP] Add 'args' as optional configuration parameter when creating a VM Add 'args' as optional configuration parameter when creating a VM Jan 1, 2024
@rhpijnacker
Copy link
Contributor Author

I tested this by deploying a VM that includes the args= property.
I'm not sure what kind of unit test to add.

Copy link
Contributor

@lbajolet-hashicorp lbajolet-hashicorp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @rhpijnacker,

Thanks for the PR! I left a few comments which err more on the nitpick side of things than anything else, the code itself looks good to me.
To be sure, have you tested those changes locally? Does it work as you would expect? Nevermind this, I just saw your second message, all clear here, I don't think there's a lot of tests for this plugin already (might be good to have some eventually) so I would think we'll rely on good will and manual testing for now.

@@ -97,6 +97,10 @@ type Config struct {
// `debian-12;template`.
Tags string `mapstructure:"tags"`

// Arbitrary arguments passed to KVM. For example
// ` -no-reboot -smbios type=0,vendor=FOO`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, is the space in front of no-reboot voluntary or is it a typo? If it is intended, I would suggest documenting it clearly so users aren't surprised in case they don't add one and it fails unexpectedly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no reason for that space. Removed it.

// Arbitrary arguments passed to KVM. For example
// ` -no-reboot -smbios type=0,vendor=FOO`.
// Note: this option is for experts only.
Args string `mapstructure:"args"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bit nitpicky on my part, but just for clarity, since this is for extra raw args, and since this is for advanced use-cases only, I would suggest making the name more explicit here, something along the lines of qemu_extra_args.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Renamed it to qemu_additional_args (to stay consistent with e.g. additional_iso_files).
Renamed the internal structure-property to AdditionalArgs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: Succesfully tested it manually with the new name.

Copy link
Contributor

@lbajolet-hashicorp lbajolet-hashicorp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the reroll @rhpijnacker!

This looks good to me, I'll merge this PR now.

@lbajolet-hashicorp
Copy link
Contributor

FYI: CI was complaining that the generated code differed, I presume you had amended the docs and hcl2spec files manually?
If you want to contribute to the plugin later, I suggest using the make generate target for this, we're using a tool from our SDK to generate the docs partials and the hcl2spec files from the Go code so we don't need to manually maintain those.

I've pushed the change on your branch, on top of your commits, so we can merge this now.

@lbajolet-hashicorp lbajolet-hashicorp merged commit f0aca8b into hashicorp:main Jan 11, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can I set "args=" to specify additional arguments in the Proxmox plugin
3 participants