Skip to content

Update vm-instance to support additional persistent disks#3935

Merged
tpdownes merged 1 commit into
GoogleCloudPlatform:developfrom
tpdownes:feat_additional_disks_vm_instance
Apr 13, 2025
Merged

Update vm-instance to support additional persistent disks#3935
tpdownes merged 1 commit into
GoogleCloudPlatform:developfrom
tpdownes:feat_additional_disks_vm_instance

Conversation

@tpdownes

Copy link
Copy Markdown
Contributor

Add a simple input variable that enables the specification of additional persistent disks, configuring their type and size. Future work to allow additional access modes for the disks themselves (multi-writer, etc) and additional modes for attaching them (read-only).

This is a squashed version of #3886 which was closed to protect the branch that may remain in use by other users until this PR lands in an official release of the Toolkit.

This PR can be evaluated using

---
blueprint_name: feat-request

vars:
  deployment_name: poc-feat
  project_id: $$PROJECT$$
  region: us-central1
  zone: us-central1-f

deployment_groups:
- group: primary
  modules:
  - id: network
    source: modules/network/vpc
  - id: vm
    source: modules/compute/vm-instance
    use:
    - network
    settings:
      machine_type: n1-standard-32
      instance_count: 2
      additional_persistent_disks:
        count: 3
        type: pd-ssd
        size: 250
      startup_script: |
        #!/bin/bash
        parted --script /dev/disk/by-id/google-additional-disk-0 mklabel gpt
        parted --script /dev/disk/by-id/google-additional-disk-0 mkpart primary ext4 0% 100%
        parted --script /dev/disk/by-id/google-additional-disk-1 mklabel gpt
        parted --script /dev/disk/by-id/google-additional-disk-1 mkpart primary ext4 0% 100%
        parted --script /dev/disk/by-id/google-additional-disk-2 mklabel gpt
        parted --script /dev/disk/by-id/google-additional-disk-2 mkpart primary ext4 0% 100%
        mkfs.ext4 -m 0 /dev/disk/by-id/google-additional-disk-0-part1
        mkfs.ext4 -m 0 /dev/disk/by-id/google-additional-disk-1-part1
        mkfs.ext4 -m 0 /dev/disk/by-id/google-additional-disk-2-part1
        mkdir -p /mnt/p0
        mkdir -p /mnt/p1
        mkdir -p /mnt/p2
        mount /dev/disk/by-id/google-additional-disk-0-part1 /mnt/p0
        mount /dev/disk/by-id/google-additional-disk-1-part1 /mnt/p1
        mount /dev/disk/by-id/google-additional-disk-2-part1 /mnt/p2

SSH to the VM reveals the 3 disks ready for access.

ext_tpdownes_google_com@poc-feat-0 ~]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs         59G     0   59G   0% /dev
tmpfs            59G     0   59G   0% /dev/shm
tmpfs            59G   17M   59G   1% /run
tmpfs            59G     0   59G   0% /sys/fs/cgroup
/dev/sda2       200G  6.9G  193G   4% /
/dev/sda1       200M  5.8M  194M   3% /boot/efi
tmpfs            12G     0   12G   0% /run/user/0
/dev/sdb1       246G   28K  246G   1% /mnt/p0
/dev/sdc1       246G   28K  246G   1% /mnt/p1
/dev/sdd1       246G   28K  246G   1% /mnt/p2
tmpfs            12G     0   12G   0% /run/user/2715883726

and on the 2nd VM:

[ext_tpdownes_google_com@poc-feat-1 ~]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs         59G     0   59G   0% /dev
tmpfs            59G     0   59G   0% /dev/shm
tmpfs            59G   17M   59G   1% /run
tmpfs            59G     0   59G   0% /sys/fs/cgroup
/dev/sda2       200G  6.9G  193G   4% /
/dev/sda1       200M  5.8M  194M   3% /boot/efi
tmpfs            12G     0   12G   0% /run/user/0
/dev/sdb1       246G   28K  246G   1% /mnt/p0
/dev/sdc1       246G   28K  246G   1% /mnt/p1
/dev/sdd1       246G   28K  246G   1% /mnt/p2
tmpfs            12G     0   12G   0% /run/user/2715883726

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 #

Add a simple input variable that enables the specification of additional
persistent disks, configuring their type and size. Future work to allow
additional access modes for the disks themselves (multi-writer, etc) and
additional modes for attaching them (read-only).

Co-authored-by: Sam Skillman <samskillman@google.com>
@tpdownes tpdownes requested a review from samskillman April 13, 2025 19:46
@tpdownes tpdownes requested a review from a team as a code owner April 13, 2025 19:46
@tpdownes tpdownes added the release-key-new-features Added to release notes under the "Key New Features" heading. label Apr 13, 2025
@tpdownes tpdownes merged commit c346890 into GoogleCloudPlatform:develop Apr 13, 2025
@tpdownes tpdownes deleted the feat_additional_disks_vm_instance branch April 13, 2025 20:28
@samskillman samskillman assigned tpdownes and unassigned samskillman Apr 13, 2025
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