ceph-csi/pkg/csi-common/nodeserver-default.go

72 lines
2.3 KiB
Go
Raw Normal View History

2018-01-09 18:57:14 +00:00
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package csicommon
import (
2018-11-26 18:23:56 +00:00
"github.com/container-storage-interface/spec/lib/go/csi"
2018-01-09 18:57:14 +00:00
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"k8s.io/klog"
2018-01-09 18:57:14 +00:00
)
// DefaultNodeServer stores driver object
2018-01-09 18:57:14 +00:00
type DefaultNodeServer struct {
Driver *CSIDriver
}
// NodeStageVolume returns unimplemented response
func (ns *DefaultNodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error) {
2018-01-09 18:57:14 +00:00
return nil, status.Error(codes.Unimplemented, "")
}
// NodeUnstageVolume returns unimplemented response
func (ns *DefaultNodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) {
2018-01-09 18:57:14 +00:00
return nil, status.Error(codes.Unimplemented, "")
}
// NodeGetInfo returns node ID
2018-07-18 14:47:22 +00:00
func (ns *DefaultNodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) {
klog.V(5).Infof("Using default NodeGetInfo")
2018-07-18 14:47:22 +00:00
return &csi.NodeGetInfoResponse{
NodeId: ns.Driver.nodeID,
}, nil
}
// NodeGetCapabilities returns RPC unknow capability
2018-01-09 18:57:14 +00:00
func (ns *DefaultNodeServer) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) {
klog.V(5).Infof("Using default NodeGetCapabilities")
2018-01-09 18:57:14 +00:00
2018-02-15 13:50:31 +00:00
return &csi.NodeGetCapabilitiesResponse{
Capabilities: []*csi.NodeServiceCapability{
{
Type: &csi.NodeServiceCapability_Rpc{
Rpc: &csi.NodeServiceCapability_RPC{
Type: csi.NodeServiceCapability_RPC_UNKNOWN,
},
},
},
},
}, nil
2018-01-09 18:57:14 +00:00
}
2018-11-26 18:23:56 +00:00
// NodeGetVolumeStats returns volume stats
2018-11-26 18:23:56 +00:00
func (ns *DefaultNodeServer) NodeGetVolumeStats(ctx context.Context, in *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error) {
return nil, status.Error(codes.Unimplemented, "")
}