Skip to content

Commit e6f9f4a

Browse files
committed
Add regional disk update capability
1 parent ac50923 commit e6f9f4a

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

pkg/gce-cloud-provider/compute/gce-compute.go

+16-1
Original file line numberDiff line numberDiff line change
@@ -479,9 +479,24 @@ func (cloud *CloudProvider) updateZonalDisk(ctx context.Context, project string,
479479
}
480480

481481
func (cloud *CloudProvider) updateRegionalDisk(ctx context.Context, project string, volKey *meta.Key, existingDisk *CloudDisk, params common.ModifyVolumeParameters) error {
482-
// TODO : Implement this
482+
483+
updatedDisk := &computev1.Disk{
484+
Name: existingDisk.GetName(),
485+
ProvisionedIops: params.IOPS,
486+
ProvisionedThroughput: params.Throughput,
487+
}
488+
489+
diskUpdateOp := cloud.service.RegionDisks.Update(project, volKey.Region, volKey.Name, updatedDisk)
490+
diskUpdateOp.Paths("provisionedIops", "provisionedThroughput")
491+
updateOpResult, err := diskUpdateOp.Context(ctx).Do()
492+
493+
if err != nil {
494+
return fmt.Errorf("error updating disk %v: %w", volKey, err)
495+
}
496+
fmt.Printf("http status : %d", updateOpResult.HTTPStatusCode)
483497
return nil
484498
}
499+
485500
func convertV1CustomerEncryptionKeyToBeta(v1Key *computev1.CustomerEncryptionKey) *computebeta.CustomerEncryptionKey {
486501
return &computebeta.CustomerEncryptionKey{
487502
KmsKeyName: v1Key.KmsKeyName,

0 commit comments

Comments
 (0)