Skip to content

Persistent Disk Storage Pool Support for vm-instance#5984

Open
rahimkhan19 wants to merge 4 commits into
GoogleCloudPlatform:developfrom
rahimkhan19:pd-support
Open

Persistent Disk Storage Pool Support for vm-instance#5984
rahimkhan19 wants to merge 4 commits into
GoogleCloudPlatform:developfrom
rahimkhan19:pd-support

Conversation

@rahimkhan19

Copy link
Copy Markdown
Contributor

Currently, the vm-instance module provisions standard standalone persistent disks. This PR introduces support for Google Cloud PD Storage Pools to vm-instances

Changes:

  • Added a new disk_storage_pool variable to specify the storage pool for the primary boot disk.
  • Updated the additional_persistent_disks variable to include an optional storage_pool attribute for secondary disks.
  • Updated the google_compute_instance.compute_vm resource to pass the storage_pool to the boot_disk.initialize_params.
  • Updated the google_compute_disk.additional_disks resource to assign the storage pool for dynamically provisioned secondary disks.

Submission Checklist

NOTE: Community submissions can take up to 2 weeks to be reviewed.

Please take the following actions before submitting this pull request.

  • Fork your PR branch from the Toolkit "develop" branch (not main)
  • Test all changes with pre-commit in a local branch #
  • Confirm that "make tests" passes all tests
  • Add or modify unit tests to cover code changes
  • Ensure that unit test coverage remains above 80%
  • Update all applicable documentation
  • Follow Cluster Toolkit Contribution guidelines #

@rahimkhan19 rahimkhan19 self-assigned this Jul 21, 2026
@rahimkhan19 rahimkhan19 added the release-key-new-features Added to release notes under the "Key New Features" heading. label Jul 21, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 vm-instance module by adding support for Google Cloud Persistent Disk Storage Pools. These changes allow users to provision both boot and secondary disks within specific storage pools, providing greater flexibility and control over disk resource management in Google Cloud environments.

Highlights

  • Boot Disk Storage Pool: Added a new disk_storage_pool variable to allow specifying a storage pool for the primary boot disk of vm-instances.
  • Secondary Disk Storage Pool: Updated the additional_persistent_disks variable to include an optional storage_pool attribute for secondary disks.
  • Resource Configuration: Updated google_compute_instance and google_compute_disk resources to propagate the storage pool configuration to the underlying Google Cloud resources.
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 the 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 counterproductive. 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.

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 adds support for storage pools in the vm-instance module, introducing a disk_storage_pool variable for the boot disk and a storage_pool attribute for additional persistent disks. The review feedback recommends using the google-beta provider for the additional disks resource to avoid schema validation errors on older google provider versions, and suggests adding lifecycle preconditions to ensure storage pools are only used with compatible Hyperdisk types. Additionally, the feedback advises updating the variable descriptions to document this Hyperdisk requirement clearly.

Comment thread modules/compute/vm-instance/main.tf
Comment thread modules/compute/vm-instance/variables.tf
Comment thread modules/compute/vm-instance/variables.tf
@rahimkhan19

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 adds support for configuring storage pools on both boot disks and additional persistent disks within the vm-instance module, updating the module to use the google-beta provider for additional disks. The feedback recommends adding a lifecycle precondition to the google_compute_instance.compute_vm resource to ensure that disk_storage_pool is only specified when the boot disk is a Hyperdisk type, ensuring consistent validation across all disk configurations.

Comment thread modules/compute/vm-instance/main.tf
@rahimkhan19

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 adds support for storage pools on boot disks and additional persistent disks in the vm-instance module, restricting their use to Hyperdisk types via Terraform preconditions. The feedback identifies an issue where the precondition for additional disks would fail if a storage pool is specified but the disk count is zero, and suggests a fix to only enforce the validation when disks are actually being provisioned.

Comment thread modules/compute/vm-instance/main.tf
@rahimkhan19

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 adds support for configuring storage pools on both the boot disk and additional persistent disks within the VM instance module, ensuring that storage pools are only used with Hyperdisk types via new Terraform preconditions. The review feedback suggests using try() blocks when referencing attributes of additional_persistent_disks in the disk resource and preconditions to safely handle cases where the variable is explicitly set to null, preventing potential plan-time crashes.

Comment thread modules/compute/vm-instance/main.tf
Comment thread modules/compute/vm-instance/main.tf
@rahimkhan19
rahimkhan19 marked this pull request as ready for review July 22, 2026 04:58
@rahimkhan19
rahimkhan19 requested a review from a team as a code owner July 22, 2026 04:58
@rahimkhan19 rahimkhan19 assigned arpit974 and unassigned rahimkhan19 Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-key-new-features Added to release notes under the "Key New Features" heading.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants