Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions manager/csi/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ func (p *plugin) DeleteVolume(ctx context.Context, v *api.Volume) error {
// the Node with the given swarmkit ID. It returns a map, which is the
// PublishContext for this Volume on this Node.
func (p *plugin) PublishVolume(ctx context.Context, v *api.Volume, nodeID string) (map[string]string, error) {
c, err := p.Client(ctx)
if err != nil {
return nil, err
}

if !p.publisher {
return nil, nil
}
Comment on lines +211 to 218
Expand All @@ -218,10 +223,6 @@ func (p *plugin) PublishVolume(ctx context.Context, v *api.Volume, nodeID string
}

req := p.makeControllerPublishVolumeRequest(v, nodeID)
c, err := p.Client(ctx)
if err != nil {
return nil, err
}
resp, err := c.ControllerPublishVolume(ctx, req)

if err != nil {
Expand All @@ -234,15 +235,16 @@ func (p *plugin) PublishVolume(ctx context.Context, v *api.Volume, nodeID string
// Volume from the Node with the given swarmkit ID. It returns an error if the
// unpublish does not succeed
func (p *plugin) UnpublishVolume(ctx context.Context, v *api.Volume, nodeID string) error {
c, err := p.Client(ctx)
if err != nil {
return err
}

if !p.publisher {
return nil
}

req := p.makeControllerUnpublishVolumeRequest(v, nodeID)
c, err := p.Client(ctx)
if err != nil {
return err
}

// response of the RPC intentionally left blank
_, err = c.ControllerUnpublishVolume(ctx, req)
Expand Down
Loading