Skip to content

Conversation

@elsoa-invitech
Copy link

Contributor's Note

  • I have added / updated documentation in /docs for any user-facing features or additions.
  • I have added / updated acceptance tests in /fwprovider/tests for any new or updated resources / data sources.
  • I have ran make example to verify that the change works as expected.

Proof of Work

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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 hotplug configuration option. This feature provides greater flexibility in managing VM resources by allowing users to specify which hotplug capabilities (e.g., for network, disk, or USB devices) should be enabled, thereby improving dynamic resource allocation and operational efficiency without requiring a VM restart.

Highlights

  • New VM Hotplug Parameter: Introduced a new optional hotplug parameter for virtual machines, allowing users to selectively enable or disable hotplug features for various components.
  • Default Hotplug Configuration: The hotplug parameter defaults to 'network,disk,usb', providing out-of-the-box hotplug capabilities for these common VM resources.
  • Documentation Update: Updated the documentation for the virtual_environment_vm resource to include details about the newly added hotplug parameter.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Signed-off-by: Első András <elsoa@invitech.hu>
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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.

Comment on lines +1077 to +1082
mkHotplug: {
Type: schema.TypeString,
Description: "Selectively enable hotplug features",
Optional: true,
Default: "network,disk,usb",
},
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

This new hotplug parameter is not fully implemented and has a few issues.

  1. Critical: Missing Implementation: The hotplug parameter 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 vmCreateCustom and vmCreateClone to pass the hotplug value when creating/cloning a VM.
    • Add logic to vmUpdate to handle changes to the hotplug parameter.
    • Add logic to vmReadCustom to read the hotplug configuration from Proxmox and update the Terraform state.
  2. Bug: Incorrect Default Value: The Proxmox API expects net for network hotplug, not network. The default value should be changed. I've included this in the suggestion.

  3. Missing Validation: Input for hotplug is not validated. Please add a ValidateDiagFunc to ensure only valid values (cpu, disk, memory, net, usb, 0, 1, or a comma-separated list) are accepted.

  4. Vague Description: The description should be more detailed, explaining the accepted values. I've included this in the suggestion.

Suggested change
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",
},

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Owner

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
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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.

Suggested change
- `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`.

@bpg bpg marked this pull request as draft November 22, 2025 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants