49 lines
No EOL
1.4 KiB
Go
49 lines
No EOL
1.4 KiB
Go
package driver
|
|
|
|
import (
|
|
"github.com/container-storage-interface/spec/lib/go/csi"
|
|
"github.com/golang/glog"
|
|
"golang.org/x/net/context"
|
|
"google.golang.org/grpc/codes"
|
|
"google.golang.org/grpc/status"
|
|
)
|
|
|
|
type IdentityServer struct {
|
|
Driver *driver
|
|
}
|
|
|
|
func (ids *IdentityServer) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error) {
|
|
glog.V(5).Infof("Using default GetPluginInfo")
|
|
|
|
if ids.Driver.name == "" {
|
|
return nil, status.Error(codes.Unavailable, "Driver name not configured")
|
|
}
|
|
|
|
if ids.Driver.version == "" {
|
|
return nil, status.Error(codes.Unavailable, "Driver is missing version")
|
|
}
|
|
|
|
return &csi.GetPluginInfoResponse{
|
|
Name: ids.Driver.name,
|
|
VendorVersion: ids.Driver.version,
|
|
}, nil
|
|
}
|
|
|
|
func (ids *IdentityServer) Probe(ctx context.Context, req *csi.ProbeRequest) (*csi.ProbeResponse, error) {
|
|
return &csi.ProbeResponse{}, nil
|
|
}
|
|
|
|
func (ids *IdentityServer) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) {
|
|
glog.V(5).Infof("Using default capabilities")
|
|
return &csi.GetPluginCapabilitiesResponse{
|
|
Capabilities: []*csi.PluginCapability{
|
|
{
|
|
Type: &csi.PluginCapability_Service_{
|
|
Service: &csi.PluginCapability_Service{
|
|
Type: csi.PluginCapability_Service_CONTROLLER_SERVICE,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}, nil
|
|
} |