-
-
Notifications
You must be signed in to change notification settings - Fork 231
feat(vm): add hotplug parameter to vm #2356
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
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @elsoa-invitech, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the virtual machine resource by adding a new Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Signed-off-by: Első András <elsoa@invitech.hu>
881be95 to
9a2380a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a new hotplug parameter for VMs. However, the implementation is incomplete. The parameter is defined in the Terraform schema but is never actually used to configure the VM in Proxmox. It needs to be handled in the create, read, and update functions of the resource. Additionally, the value network for the hotplug feature seems incorrect; it should likely be net according to Proxmox's API. I've left detailed comments on the specific changes required.
| mkHotplug: { | ||
| Type: schema.TypeString, | ||
| Description: "Selectively enable hotplug features", | ||
| Optional: true, | ||
| Default: "network,disk,usb", | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new hotplug parameter is not fully implemented and has a few issues.
-
Critical: Missing Implementation: The
hotplugparameter is defined here but is not used in the resource's CRUD functions (vmCreateCustom,vmCreateClone,vmUpdate,vmReadCustom). As a result, this feature does not work. You need to:- Add logic to
vmCreateCustomandvmCreateCloneto pass thehotplugvalue when creating/cloning a VM. - Add logic to
vmUpdateto handle changes to thehotplugparameter. - Add logic to
vmReadCustomto read thehotplugconfiguration from Proxmox and update the Terraform state.
- Add logic to
-
Bug: Incorrect Default Value: The Proxmox API expects
netfor network hotplug, notnetwork. The default value should be changed. I've included this in the suggestion. -
Missing Validation: Input for
hotplugis not validated. Please add aValidateDiagFuncto ensure only valid values (cpu,disk,memory,net,usb,0,1, or a comma-separated list) are accepted. -
Vague Description: The description should be more detailed, explaining the accepted values. I've included this in the suggestion.
| mkHotplug: { | |
| Type: schema.TypeString, | |
| Description: "Selectively enable hotplug features", | |
| Optional: true, | |
| Default: "network,disk,usb", | |
| }, | |
| mkHotplug: { | |
| Type: schema.TypeString, | |
| Description: "A comma-separated list of features to enable for hot-plugging. Supported values are `net`, `disk`, `cpu`, `memory`, and `usb`. Set to `0` to disable all, or `1` to enable all.", | |
| Optional: true, | |
| Default: "net,disk,usb", | |
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @elsoa-invitech 👋🏼 thanks for contributing!
Yeah, 🤖 is right, there are few more things that need to be added for this to work.
I can take a look later on the weekend to give you more feedback.
| is a relative path under `/usr/share/kvm/`. | ||
| - `xvga` - (Optional) Marks the PCI(e) device as the primary GPU of the VM. | ||
| With this enabled the `vga` configuration argument will be ignored. | ||
| - `hotplug` - (Optional) Selectively enable hotplug features |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description for hotplug is a bit vague. It would be helpful to list the possible values and their meaning. Also, note that the Proxmox API expects net for network hotplug.
| - `hotplug` - (Optional) Selectively enable hotplug features | |
| - `hotplug` - (Optional) A comma-separated list of features to enable for hot-plugging. Supported values are `net`, `disk`, `cpu`, `memory`, and `usb`. Set to `0` to disable all, or `1` to enable all. Defaults to `net,disk,usb`. |
Contributor's Note
/docsfor any user-facing features or additions./fwprovider/testsfor any new or updated resources / data sources.make exampleto verify that the change works as expected.Proof of Work
Community Note