Skip to content

Commit 97ee951

Browse files
committed
modify update to remove regional disk check
1 parent f310525 commit 97ee951

File tree

1 file changed

+3
-28
lines changed

1 file changed

+3
-28
lines changed

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

+3-28
Original file line numberDiff line numberDiff line change
@@ -446,15 +446,9 @@ func (cloud *CloudProvider) InsertDisk(ctx context.Context, project string, volK
446446
func (cloud *CloudProvider) UpdateDisk(ctx context.Context, project string, volKey *meta.Key, existingDisk *CloudDisk, params common.ModifyVolumeParameters) error {
447447

448448
klog.V(5).Infof("Updating disk %v", volKey)
449-
450-
switch volKey.Type() {
451-
case meta.Zonal:
452-
return cloud.updateZonalDisk(ctx, project, volKey, existingDisk, params)
453-
case meta.Regional:
454-
return cloud.updateRegionalDisk(ctx, project, volKey, existingDisk, params)
455-
default:
456-
return fmt.Errorf("could not update disk, key was neither zonal nor regional, instead got: %v", volKey.String())
457-
}
449+
// hyperdisks are zonal disks
450+
// pd-disks do not support modification of IOPS and Throughput
451+
return cloud.updateZonalDisk(ctx, project, volKey, existingDisk, params)
458452
}
459453

460454
func (cloud *CloudProvider) updateZonalDisk(ctx context.Context, project string, volKey *meta.Key, existingDisk *CloudDisk, params common.ModifyVolumeParameters) error {
@@ -478,25 +472,6 @@ func (cloud *CloudProvider) updateZonalDisk(ctx context.Context, project string,
478472
return nil
479473
}
480474

481-
func (cloud *CloudProvider) updateRegionalDisk(ctx context.Context, project string, volKey *meta.Key, existingDisk *CloudDisk, params common.ModifyVolumeParameters) error {
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)
497-
return nil
498-
}
499-
500475
func convertV1CustomerEncryptionKeyToBeta(v1Key *computev1.CustomerEncryptionKey) *computebeta.CustomerEncryptionKey {
501476
return &computebeta.CustomerEncryptionKey{
502477
KmsKeyName: v1Key.KmsKeyName,

0 commit comments

Comments
 (0)