Skip to content
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

WiP - CSI Spec 51e48d38 (gRPC Errors) #32

Merged
merged 2 commits into from
Nov 15, 2017

Conversation

akutz
Copy link
Member

@akutz akutz commented Nov 13, 2017

This patch introduces support for the CSI specification, revision 51e48d38. This is a very important update as it shutters the old CSI error model in favor of the new, standard gRPC error codes.

This patch also includes new, unified client/server interceptors for validating requests/responses against the CSI specification, handling logging, and transmitting a unique request ID from the client to the server.

  • Update interceptors
  • Update Mock SP
  • Update csc

@akutz akutz self-assigned this Nov 13, 2017
@akutz akutz changed the title CSI Spec 51e48d38 (gRPC Errors) WiP - CSI Spec 51e48d38 (gRPC Errors) Nov 13, 2017
@akutz akutz force-pushed the feature/csi-spec-51e48d3 branch 2 times, most recently from 541cbb6 to b356efe Compare November 13, 2017 09:42
@vladimirvivien
Copy link

@akutz gocsi/mock returns error publish volume info required when that field is marked as not required in spec. https://github.com/container-storage-interface/spec/blob/master/csi.proto#L513

@vladimirvivien
Copy link

vladimirvivien commented Nov 13, 2017

@akutz also, the following happened when I run the mock and tries to nodepublishvolume a non-existent volume:

Edit : I actually don't know what's causing it.. i thought it was above, but no. Re-checking to make sure i m not sending bad data causing mock to crash.

Edit @akutz you are assuming volume has attributes, but it doesn't.

INFO[0016] /csi.Node/NodePublishVolume: REQ 0004: Version=minor:1 , VolumeId=vol-test-123, PublishVolumeInfo=map[device:none], TargetPath=/var/lib/kubelet/pods/fec6f36d-c892-11e7-8f0a-080027859f43/volumes/kubernetes.io~csi/mock/vol-test-123, VolumeCapability=mount:<fs_type:"ext4" > access_mode:<mode:SINGLE_NODE_WRITER > , Readonly=false
panic: assignment to entry in nil map

goroutine 34 [running]:
github.com/thecodeteam/gocsi/mock/service.(*service).NodePublishVolume(0xc42018c000, 0xadcc00, 0xc420220180, 0xc420084ff0, 0x0, 0x0, 0x0)
	/home/vladimir/DEV/go/src/github.com/thecodeteam/gocsi/mock/service/node.go:35 +0x244
github.com/thecodeteam/gocsi/csi._Node_NodePublishVolume_Handler.func1(0xadcc00, 0xc420220180, 0x869f80, 0xc420084ff0, 0xc42015e1a8, 0x1, 0xc42004f110, 0x782eb9)
	/home/vladimir/DEV/go/src/github.com/thecodeteam/gocsi/csi/csi.pb.go:2297 +0x86
github.com/thecodeteam/gocsi.(*idempotencyInterceptor).nodePublishVolume(0xc420198080, 0xadcc00, 0xc420220180, 0xc420084ff0, 0xc420148c80, 0xc420148ca0, 0x0, 0x0, 0x0, 0x0)
	/home/vladimir/DEV/go/src/github.com/thecodeteam/gocsi/interceptors_idempotency.go:515 +0x5b2
github.com/thecodeteam/gocsi.(*idempotencyInterceptor).handle(0xc420198080, 0xadcc00, 0xc420220180, 0x869f80, 0xc420084ff0, 0xc420148c80, 0xc420148ca0, 0xadcc00, 0xc420220180, 0xc420018fc0, ...)
	/home/vladimir/DEV/go/src/github.com/thecodeteam/gocsi/interceptors_idempotency.go:163 +0x161
github.com/thecodeteam/gocsi.(*idempotencyInterceptor).(github.com/thecodeteam/gocsi.handle)-fm(0xadcc00, 0xc420220180, 0x869f80, 0xc420084ff0, 0xc420148c80, 0xc420148ca0, 0x0, 0x0, 0x782501, 0xc420091360)
	/home/vladimir/DEV/go/src/github.com/thecodeteam/gocsi/interceptors_idempotency.go:95 +0x73
github.com/thecodeteam/gocsi.ChainUnaryServer.func2.1.1(0xadcc00, 0xc420220180, 0x869f80, 0xc420084ff0, 0x5, 0x0, 0x0, 0x0)
	/home/vladimir/DEV/go/src/github.com/thecodeteam/gocsi/interceptors.go:97 +0x66
github.com/thecodeteam/gocsi.(*specValidator).handleServer.func1(0xc420198040, 0xadcc00, 0xc420220180, 0x8a50e0)
	/home/vladimir/DEV/go/src/github.com/thecodeteam/gocsi/interceptors_spec_validator.go:191 +0x4c
github.com/thecodeteam/gocsi.(*specValidator).handle(0xc420198040, 0xadcc00, 0xc420220180, 0x8a50e0, 0x1b, 0x869f80, 0xc420084ff0, 0xc42004f3a0, 0xc42004f3c8, 0xc42004f3b8, ...)
	/home/vladimir/DEV/go/src/github.com/thecodeteam/gocsi/interceptors_spec_validator.go:234 +0xef
github.com/thecodeteam/gocsi.(*specValidator).handleServer(0xc420198040, 0xadcc00, 0xc420220180, 0x869f80, 0xc420084ff0, 0xc420148c80, 0xc420148cc0, 0x160, 0x148, 0x0, ...)
	/home/vladimir/DEV/go/src/github.com/thecodeteam/gocsi/interceptors_spec_validator.go:190 +0xea
github.com/thecodeteam/gocsi.(*specValidator).(github.com/thecodeteam/gocsi.handleServer)-fm(0xadcc00, 0xc420220180, 0x869f80, 0xc420084ff0, 0xc420148c80, 0xc420148cc0, 0x0, 0xc42004f4e8, 0x4c3fb7, 0xc4200c6000)
	/home/vladimir/DEV/go/src/github.com/thecodeteam/gocsi/interceptors_spec_validator.go:165 +0x73
github.com/thecodeteam/gocsi.ChainUnaryServer.func2.1.1(0xadcc00, 0xc420220180, 0x869f80, 0xc420084ff0, 0x148, 0xc4200c6000, 0x0, 0x0)
	/home/vladimir/DEV/go/src/github.com/thecodeteam/gocsi/interceptors.go:97 +0x66
github.com/thecodeteam/gocsi.(*loggingInterceptor).handleServer.func1(0xad5380, 0xc42019e000, 0xc42004f600, 0x1)
	/home/vladimir/DEV/go/src/github.com/thecodeteam/gocsi/interceptors_logger.go:80 +0x4c
github.com/thecodeteam/gocsi.(*loggingInterceptor).handle(0xc42019e020, 0xadcc00, 0xc420220180, 0x8a50e0, 0x1b, 0x869f80, 0xc420084ff0, 0xc42004f6b0, 0x46faa2, 0x0, ...)
	/home/vladimir/DEV/go/src/github.com/thecodeteam/gocsi/interceptors_logger.go:124 +0x2b3
github.com/thecodeteam/gocsi.(*loggingInterceptor).handleServer(0xc42019e020, 0xadcc00, 0xc420220180, 0x869f80, 0xc420084ff0, 0xc420148c80, 0xc420148ce0, 0x7f0cf8ff02f8, 0x40ddcb, 0xc42004f7c8, ...)
	/home/vladimir/DEV/go/src/github.com/thecodeteam/gocsi/interceptors_logger.go:79 +0xea
github.com/thecodeteam/gocsi.(*loggingInterceptor).(github.com/thecodeteam/gocsi.handleServer)-fm(0xadcc00, 0xc420220180, 0x869f80, 0xc420084ff0, 0xc420148c80, 0xc420148ce0, 0x10, 0x7f0760, 0xc42022a000, 0xc420011520)
	/home/vladimir/DEV/go/src/github.com/thecodeteam/gocsi/interceptors_logger.go:54 +0x73
github.com/thecodeteam/gocsi.ChainUnaryServer.func2.1.1(0xadcc00, 0xc420220180, 0x869f80, 0xc420084ff0, 0x4, 0x0, 0x0, 0x411b67)
	/home/vladimir/DEV/go/src/github.com/thecodeteam/gocsi/interceptors.go:97 +0x66
github.com/thecodeteam/gocsi.(*requestIDInjector).handleServer(0xc42018e038, 0xadcc00, 0xc420220180, 0x869f80, 0xc420084ff0, 0xc420148c80, 0xc420148d00, 0x7f0cf8ff02f8, 0x0, 0xc42004f8c0, ...)
	/home/vladimir/DEV/go/src/github.com/thecodeteam/gocsi/interceptors_request_id.go:84 +0x2b1
github.com/thecodeteam/gocsi.(*requestIDInjector).(github.com/thecodeteam/gocsi.handleServer)-fm(0xadcc00, 0xc420220180, 0x869f80, 0xc420084ff0, 0xc420148c80, 0xc420148d00, 0xc420148c80, 0x82a3c0, 0x1, 0xc420011510)
	/home/vladimir/DEV/go/src/github.com/thecodeteam/gocsi/interceptors_request_id.go:25 +0x73
github.com/thecodeteam/gocsi.ChainUnaryServer.func2.1.1(0xadcc00, 0xc420220180, 0x869f80, 0xc420084ff0, 0xc420148c40, 0xc42004f968, 0x4122c8, 0x20)
	/home/vladimir/DEV/go/src/github.com/thecodeteam/gocsi/interceptors.go:97 +0x66
github.com/thecodeteam/gocsi.ChainUnaryServer.func2(0xadcc00, 0xc420220180, 0x869f80, 0xc420084ff0, 0xc420148c80, 0xc420148ca0, 0x0, 0xc42004f9e0, 0x4122c8, 0x50)
	/home/vladimir/DEV/go/src/github.com/thecodeteam/gocsi/interceptors.go:104 +0xf8
github.com/thecodeteam/gocsi/csi._Node_NodePublishVolume_Handler(0x887a00, 0xc42018c000, 0xadcc00, 0xc420220180, 0xc420084fa0, 0xc42019e080, 0x0, 0x0, 0x0, 0x0)
	/home/vladimir/DEV/go/src/github.com/thecodeteam/gocsi/csi/csi.pb.go:2299 +0x16d
github.com/thecodeteam/gocsi/vendor/google.golang.org/grpc.(*Server).processUnaryRPC(0xc4201aa000, 0xadeea0, 0xc4201d4840, 0xc42022c000, 0xc420192390, 0xb17940, 0x0, 0x0, 0x0)
	/home/vladimir/DEV/go/src/github.com/thecodeteam/gocsi/vendor/google.golang.org/grpc/server.go:826 +0xab4
github.com/thecodeteam/gocsi/vendor/google.golang.org/grpc.(*Server).handleStream(0xc4201aa000, 0xadeea0, 0xc4201d4840, 0xc42022c000, 0x0)
	/home/vladimir/DEV/go/src/github.com/thecodeteam/gocsi/vendor/google.golang.org/grpc/server.go:1023 +0x1528
github.com/thecodeteam/gocsi/vendor/google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc42018e360, 0xc4201aa000, 0xadeea0, 0xc4201d4840, 0xc42022c000)
	/home/vladimir/DEV/go/src/github.com/thecodeteam/gocsi/vendor/google.golang.org/grpc/server.go:572 +0x9f
created by github.com/thecodeteam/gocsi/vendor/google.golang.org/grpc.(*Server).serveStreams.func1
	/home/vladimir/DEV/go/src/github.com/thecodeteam/gocsi/vendor/google.golang.org/grpc/server.go:570 +0xa1```

@akutz
Copy link
Member Author

akutz commented Nov 13, 2017

Thanks Vlad. I’ll take a look. Pretty sure I know what the problem is.

@akutz
Copy link
Member Author

akutz commented Nov 13, 2017

For your testing, find the Mock SP’s interceptor list and add the option to the spec validator that requires volumes to exist.

This patch introduces support for the CSI specification, revision
51e48d38. This is a very important update as it shutters the old CSI
error model in favor of the new, standard gRPC error codes.
@akutz akutz force-pushed the feature/csi-spec-51e48d3 branch 6 times, most recently from 1a8cfba to cf5b8f7 Compare November 15, 2017 16:57
This patch removes all of the previous CSI helper functions contained in
GoCSI. With the new error model the helper functions were largely
vestigial. There is one remaining/new function -- PageAllVolumes. This
function uses the ListVolumes RPC and paging to return a channel on
which all volumes may be received by issuing paged requests to the SP
until all volumes have been returned from the server.
@akutz akutz merged commit 5fe25d2 into rexray:master Nov 15, 2017
@akutz akutz deleted the feature/csi-spec-51e48d3 branch November 15, 2017 17:44
@codenrhoden codenrhoden added this to the 2017.12-1 milestone Dec 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants