-
Notifications
You must be signed in to change notification settings - Fork 378
Add ValidateVolumeCapabilities error code for volume too small #92
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
When using ValidateVolumeCapabilities for pre-provisioned volumes, VolumeInfo is allowed to contain a `capacity_bytes` field. If the pre-provisioned volume is smaller than this value, there was no appropriate error code to return. This patch adds such a code. Signed-off-by: Travis Rhoden <[email protected]>
As I work with this a little bit more, I'm a bit confused on the correct way to return an error from
However, this will return an error at the gRPC level, and the caller would not then be reading the This may be my lack of gRPC experience speaking. Or maybe it is for the most common types of scenarios, error codes have been enumerated, but not others? I would think there is an error code for each thing that may not match in Is my understanding way off here? |
Hi @codenrhoden, I concur with your question above except for one thing:
That's not technically true. It will return an error in the RPC |
Hi @codenrhoden, I think perhaps this is the distinction. Imagine you receive a |
Hi @codenrhoden, I still share your concern. If my above attempt at answering the reasoning behind the distinction was not correct or sufficient, then I'd propose one of the two following compromises: Solution 1Refactor the message ValidateVolumeCapabilitiesResponse {
message Result {}
// One of the following fields MUST be specified.
oneof reply {
Result result = 1;
Error error = 2;
}
} And then ensure that there is a valid error code for every possible reason that Solution 2Refactor message ValidateVolumeCapabilitiesResponse {
message Result {
// True if the Plugin supports the specified capabilities for the
// given volume. This field is REQUIRED.
bool supported = 1;
// Message to the CO if `supported` above is false. This field is
// OPTIONAL.
string message = 2;
// An error code that can also indicate why `supported`
// above is false. This field is OPTIONAL.
ValidateVolumeCapabilitiesErrorCode errorCode = 3;
}
// One of the following fields MUST be specified.
oneof reply {
Result result = 1;
Error error = 2;
}
} |
@akutz, yeah, exactly. As I was actually implementing a So unless it's like you said, and you only return |
Hi @codenrhoden, I imagine it could come down to the same way libStorage executors would return It's such a thin distinction that I think the supported and message fields are just there for occasions when there isn't an error code. |
Related - Now that I'll wait to hear from others before adding that, as I'd like to know whether to keep |
If implementations are always returning an error code when something is unsupported, then we can probably simplify the RPC response: message ValidateVolumeCapabilitiesResponse {
message Result {
// intentionally empty: failed validation requests should generate an error
}
// One of the following fields MUST be specified.
oneof reply {
Result result = 1;
Error error = 2;
}
} I know that @saad-ali has been thinking about refactoring error codes/handling. Maybe he has some insight here? |
Hi @jdef, Isn't that the same as Solution 1 from this comment above? I'm in favor of it as long as we update the description of the // `ValidateVolumeCapabilities` specific error.
message ValidateVolumeCapabilitiesError {
enum ValidateVolumeCapabilitiesErrorCode {
// Default value for backwards compatibility. SHOULD NOT be
// returned by Plugins. However, if a Plugin returns a
// `ValidateVolumeCapabilitiesErrorCode` code that an older CSI
// client is not aware of, the client will see this code (the
// default fallback).
//
// Recovery behavior: Caller SHOULD consider updating CSI client
// to match Plugin CSI version.
UNKNOWN = 0; Alternatively we could add a new error code named |
Yes, it's the same as your Solution 1; for some reason I read your comment
differently the first pass through (who knows why).
`UNKNOWN` has a special meaning/purpose and I think we should avoid
overloading it. There's already an `error_description` field for the
RPC-specific error type - are you suggesting that we need some other kind
of message field in addition to that?
…On Tue, Aug 29, 2017 at 1:41 PM, Schley Andrew Kutz < ***@***.***> wrote:
Hi @jdef <https://github.com/jdef>,
Isn't that the same as *Solution 1* from this comment
<#92 (comment)>
above? I'm in favor of it as long as we update the description of the
UNKNOWN error code to indicate that it is valid and clients should see
the associated error message *or* we add a new error code named MESSAGE
that explicitly indicates to see the error's associated string data.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#92 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACPVLMGFryd-xCZHFNZuFODMkjPCksBwks5sdE1QgaJpZM4PB7WO>
.
|
Hi @jdef, I'm suggesting that if we get rid of any of the data in the Because not all errors will be described by codes in advance. One of the nice things about the |
FWIW the current implementation of errors is fine IMO, and there is already code in the wild to parse them. I think any RPC with what is essentially a boolean response will be subject to this same discussion -- should an error be used to represent the |
should probably be re-cast now that #115 has landed, perhaps as a case where |
VolumeInfo / capacity is no longer an input to the ValidateVolumeCapabilities RPC, so this PR no longer applies; closing it out. Please re-open if you believe this has been closed in error. |
When using
ValidateVolumeCapabilities
for pre-provisioned volumes,VolumeInfo
is allowed to contain acapacity_bytes
field. If thepre-provisioned volume is smaller than this value, there was no
appropriate error code to return. This patch adds such a code.
While the spec only mentions needed to validate the
VolumeCapabilities
, e.g.this seems like an import thing to verify as well.
I was just going to raise the question as an Issue, but this took about the same amount of time.