-
Notifications
You must be signed in to change notification settings - Fork 159
Improve error messages for ControllerExpandVolume / CreateSnapshot of multi-zone PV. #1718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hi @hungnguyen243. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/ok-to-test |
/retest-required |
1 similar comment
/retest-required |
I checked the e2e snapshot failure, the snapshot operation hadn't returned success before we tried to delete the disk, so that's why we got the operation error: https://screenshot.googleplex.com/7aHcpQdMhw4sBr5 |
/retest-required |
/retest |
/lgtm |
pkg/gce-pd-csi-driver/controller.go
Outdated
@@ -1158,6 +1158,11 @@ func (gceCS *GCEControllerServer) CreateSnapshot(ctx context.Context, req *csi.C | |||
return nil, status.Errorf(codes.InvalidArgument, "CreateSnapshot Volume ID is invalid: %v", err.Error()) | |||
} | |||
|
|||
volumeIsMultiZone := isMultiZoneVolKey(volKey) | |||
if gceCS.multiZoneVolumeHandleConfig.Enable && volumeIsMultiZone { | |||
return nil, fmt.Errorf("Snapshots are not supported with the `multi-zone` PV volumeHandle feature.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should return a proper status.Error (eg: InvalidArgument)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also omit the backticks. This will be printed to the terminal, so it won't be markdown formatted
pkg/gce-pd-csi-driver/controller.go
Outdated
|
||
volumeIsMultiZone := isMultiZoneVolKey(volKey) | ||
if gceCS.multiZoneVolumeHandleConfig.Enable && volumeIsMultiZone { | ||
return nil, fmt.Errorf("Resize operation is not supported with the `multi-zone` PVC volumeHandle feature. Please re-create the disk from source if you want a larger size.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think naming this "ControllerExpandVolume" instead of "Resize operation" is actually better. It describes the RPC, as "Resize" is more of a Container Orchestrator term.
pkg/gce-pd-csi-driver/controller.go
Outdated
|
||
volumeIsMultiZone := isMultiZoneVolKey(volKey) | ||
if gceCS.multiZoneVolumeHandleConfig.Enable && volumeIsMultiZone { | ||
return nil, fmt.Errorf("Resize operation is not supported with the `multi-zone` PVC volumeHandle feature. Please re-create the disk from source if you want a larger size.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use "volume" instead of "disk". Also, print out the volumeID in the error message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some tests that validate passing in a "multi-zone" volumeID returns the appropriate error (eg: InvalidArgument) for these two RPCs.
pkg/gce-pd-csi-driver/controller.go
Outdated
@@ -1158,6 +1158,11 @@ func (gceCS *GCEControllerServer) CreateSnapshot(ctx context.Context, req *csi.C | |||
return nil, status.Errorf(codes.InvalidArgument, "CreateSnapshot Volume ID is invalid: %v", err.Error()) | |||
} | |||
|
|||
volumeIsMultiZone := isMultiZoneVolKey(volKey) | |||
if gceCS.multiZoneVolumeHandleConfig.Enable && volumeIsMultiZone { | |||
return nil, status.Errorf(codes.InvalidArgument, "Snapshots are not supported with the multi-zone PV volumeHandle feature") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also emit the volumeID here?
@@ -255,6 +255,77 @@ func TestCreateSnapshotArguments(t *testing.T) { | |||
} | |||
} | |||
|
|||
func TestUnsupporteddMultiZoneCreateSnapshot(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/TestUnsupporteddMultiZoneCreateSnapshot/TestUnsupportedMultiZoneCreateSnapshot
/lgtm |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hungnguyen243, pwschuurman The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Improve error messages for ControllerExpandVolume / CreateSnapshot of multi-zone PV.
Before:
CreateSnapshot: "Failed to create snapshot: failed to take snapshot of the volume projects/psch-gke-dev/zones/multi-zone/disks/hdml-llama2-70b-hf: "rpc error: code = Unknown desc = CreateSnapshot, failed
to getDisk: googleapi: Error 400: Invalid value for field 'zone': 'multi-zone'. Unknown zone., invalid"
ControllerExpandVolume: "resize volume "my-disk-pv" by resizer "pd.csi.storage.gke.io" failed: rpc error: code = Unknown desc = ControllerExpandVolume failed to resize disk: failed to get disk: googleapi: Error 400: In
valid value for field 'zone': 'multi-zone'. Unknown zone., invalid"
After:
CreateSnapshot: "Snapshots are not supported with the
multi-zone
PV volumeHandle feature"ControllerExpandVolume: "Resize operation is not supported with the
multi-zone
PVC volumeHandle feature. Please re-create the disk from source if you want a larger size."Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: