From 7dc0431cb87483078badf349a3f2bf2babc9af3b Mon Sep 17 00:00:00 2001 From: Danielle Lancashire Date: Wed, 29 Jan 2020 12:32:31 +0100 Subject: [PATCH] csi: Expose grpc.CallOptions for NodeStageVolume --- plugins/csi/client.go | 4 ++-- plugins/csi/fake/client.go | 3 ++- plugins/csi/plugin.go | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/csi/client.go b/plugins/csi/client.go index 0766c8e9a..30d17ee8d 100644 --- a/plugins/csi/client.go +++ b/plugins/csi/client.go @@ -299,7 +299,7 @@ func (c *client) NodeGetInfo(ctx context.Context) (*NodeGetInfoResponse, error) return result, nil } -func (c *client) NodeStageVolume(ctx context.Context, volumeID string, publishContext map[string]string, stagingTargetPath string, capabilities *VolumeCapability) error { +func (c *client) NodeStageVolume(ctx context.Context, volumeID string, publishContext map[string]string, stagingTargetPath string, capabilities *VolumeCapability, opts ...grpc.CallOption) error { if c == nil { return fmt.Errorf("Client not initialized") } @@ -325,7 +325,7 @@ func (c *client) NodeStageVolume(ctx context.Context, volumeID string, publishCo // NodeStageVolume's response contains no extra data. If err == nil, we were // successful. - _, err := c.nodeClient.NodeStageVolume(ctx, req) + _, err := c.nodeClient.NodeStageVolume(ctx, req, opts...) return err } diff --git a/plugins/csi/fake/client.go b/plugins/csi/fake/client.go index c8e0cfd55..06c4c6f08 100644 --- a/plugins/csi/fake/client.go +++ b/plugins/csi/fake/client.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/nomad/plugins/base" "github.com/hashicorp/nomad/plugins/csi" "github.com/hashicorp/nomad/plugins/shared/hclspec" + "google.golang.org/grpc" ) var _ csi.CSIPlugin = &Client{} @@ -161,7 +162,7 @@ func (c *Client) NodeGetInfo(ctx context.Context) (*csi.NodeGetInfoResponse, err // NodeStageVolume is used when a plugin has the STAGE_UNSTAGE volume capability // to prepare a volume for usage on a host. If err == nil, the response should // be assumed to be successful. -func (c *Client) NodeStageVolume(ctx context.Context, volumeID string, publishContext map[string]string, stagingTargetPath string, capabilities *csi.VolumeCapability) error { +func (c *Client) NodeStageVolume(ctx context.Context, volumeID string, publishContext map[string]string, stagingTargetPath string, capabilities *csi.VolumeCapability, opts ...grpc.CallOption) error { c.Mu.Lock() defer c.Mu.Unlock() diff --git a/plugins/csi/plugin.go b/plugins/csi/plugin.go index 172aa01d7..d41a71b3c 100644 --- a/plugins/csi/plugin.go +++ b/plugins/csi/plugin.go @@ -7,6 +7,7 @@ import ( csipbv1 "github.com/container-storage-interface/spec/lib/go/csi" "github.com/hashicorp/nomad/plugins/base" + "google.golang.org/grpc" ) // CSIPlugin implements a lightweight abstraction layer around a CSI Plugin. @@ -46,7 +47,7 @@ type CSIPlugin interface { // NodeStageVolume is used when a plugin has the STAGE_UNSTAGE volume capability // to prepare a volume for usage on a host. If err == nil, the response should // be assumed to be successful. - NodeStageVolume(ctx context.Context, volumeID string, publishContext map[string]string, stagingTargetPath string, capabilities *VolumeCapability) error + NodeStageVolume(ctx context.Context, volumeID string, publishContext map[string]string, stagingTargetPath string, capabilities *VolumeCapability, opts ...grpc.CallOption) error // NodeUnstageVolume is used when a plugin has the STAGE_UNSTAGE volume capability // to undo the work performed by NodeStageVolume. If a volume has been staged,