|
@@ -6,11 +6,14 @@ import (
|
|
"fmt"
|
|
"fmt"
|
|
|
|
|
|
"google.golang.org/grpc"
|
|
"google.golang.org/grpc"
|
|
|
|
+ "google.golang.org/grpc/codes"
|
|
|
|
+ "google.golang.org/grpc/status"
|
|
|
|
|
|
"github.com/container-storage-interface/spec/lib/go/csi"
|
|
"github.com/container-storage-interface/spec/lib/go/csi"
|
|
"github.com/docker/docker/pkg/plugingetter"
|
|
"github.com/docker/docker/pkg/plugingetter"
|
|
"github.com/moby/swarmkit/v2/api"
|
|
"github.com/moby/swarmkit/v2/api"
|
|
"github.com/moby/swarmkit/v2/internal/csi/capability"
|
|
"github.com/moby/swarmkit/v2/internal/csi/capability"
|
|
|
|
+ "github.com/moby/swarmkit/v2/log"
|
|
)
|
|
)
|
|
|
|
|
|
// Plugin is the interface for a CSI controller plugin.
|
|
// Plugin is the interface for a CSI controller plugin.
|
|
@@ -204,6 +207,11 @@ func (p *plugin) PublishVolume(ctx context.Context, v *api.Volume, nodeID string
|
|
if !p.publisher {
|
|
if !p.publisher {
|
|
return nil, nil
|
|
return nil, nil
|
|
}
|
|
}
|
|
|
|
+ csiNodeID := p.swarmToCSI[nodeID]
|
|
|
|
+ if csiNodeID == "" {
|
|
|
|
+ log.L.Errorf("CSI node ID not found for given Swarm node ID. Plugin: %s , Swarm node ID: %s", p.name, nodeID)
|
|
|
|
+ return nil, status.Error(codes.FailedPrecondition, "CSI node ID not found for given Swarm node ID")
|
|
|
|
+ }
|
|
|
|
|
|
req := p.makeControllerPublishVolumeRequest(v, nodeID)
|
|
req := p.makeControllerPublishVolumeRequest(v, nodeID)
|
|
c, err := p.Client(ctx)
|
|
c, err := p.Client(ctx)
|