CSI node plugin fix for unstaging volumes
- What I did
While running a CSI volume plugin that supports staging, I created a new swarm service that initiated an attempt to unpublish a cluster volume. The node agent calls NodeUnpublishVolume which returns no errors then NodeUnstageVolume which also returns no errors. However, there was no call to the underlying plugin driver for NodeUnstageVolume.
- How I did it Fixed the unpublish check to only return in the failing condition that the volume was not unpublished.
- How to test it Create a cluster volume using CSI volume plugin then trigger a publish and unpublish by creating a swarm service and restarting the service.
- Description for the changelog
Similarly, this early return in NodeUnpublishVolume skips the log which would be helpful in debugging:
https://github.com/moby/swarmkit/blob/ea1a7cec35cb05dce3cff2de3f4ee28cbca6ca79/agent/csi/plugin/plugin.go#L366-L373
@beornf New test case for this would nice as CSI logic is still quite new which bugs like this exist. You can find examples from my PRs #3116 and #3123