mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 02:50:30 +00:00
Fix golint issue
pkg/rbd/rbd.go:67:65⚠️ exported func NewNodeServer
returns unexported type *rbd.nodeServer, which can be
annoying to use (golint)
Signed-off-by: Madhu Rajanna <mrajanna@redhat.com>
This commit is contained in:
parent
4c564207c6
commit
284c5801c3
@ -28,7 +28,7 @@ import (
|
|||||||
"github.com/ceph/ceph-csi/pkg/util"
|
"github.com/ceph/ceph-csi/pkg/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
type controllerServer struct {
|
type ControllerServer struct {
|
||||||
*csicommon.DefaultControllerServer
|
*csicommon.DefaultControllerServer
|
||||||
MetadataStore util.CachePersister
|
MetadataStore util.CachePersister
|
||||||
}
|
}
|
||||||
@ -38,7 +38,7 @@ type controllerCacheEntry struct {
|
|||||||
VolumeID volumeID
|
VolumeID volumeID
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) {
|
func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) {
|
||||||
if err := cs.validateCreateVolumeRequest(req); err != nil {
|
if err := cs.validateCreateVolumeRequest(req); err != nil {
|
||||||
glog.Errorf("CreateVolumeRequest validation failed: %v", err)
|
glog.Errorf("CreateVolumeRequest validation failed: %v", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -102,7 +102,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *controllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {
|
func (cs *ControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {
|
||||||
if err := cs.validateDeleteVolumeRequest(req); err != nil {
|
if err := cs.validateDeleteVolumeRequest(req); err != nil {
|
||||||
glog.Errorf("DeleteVolumeRequest validation failed: %v", err)
|
glog.Errorf("DeleteVolumeRequest validation failed: %v", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -159,7 +159,7 @@ func (cs *controllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
|
|||||||
return &csi.DeleteVolumeResponse{}, nil
|
return &csi.DeleteVolumeResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *controllerServer) ValidateVolumeCapabilities(
|
func (cs *ControllerServer) ValidateVolumeCapabilities(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
req *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error) {
|
req *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error) {
|
||||||
// Cephfs doesn't support Block volume
|
// Cephfs doesn't support Block volume
|
||||||
|
@ -30,42 +30,42 @@ const (
|
|||||||
Version = "1.0.0"
|
Version = "1.0.0"
|
||||||
)
|
)
|
||||||
|
|
||||||
type driver struct {
|
type Driver struct {
|
||||||
cd *csicommon.CSIDriver
|
cd *csicommon.CSIDriver
|
||||||
|
|
||||||
is *identityServer
|
is *IdentityServer
|
||||||
ns *nodeServer
|
ns *NodeServer
|
||||||
cs *controllerServer
|
cs *ControllerServer
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
DefaultVolumeMounter string
|
DefaultVolumeMounter string
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewDriver() *driver {
|
func NewDriver() *Driver {
|
||||||
return &driver{}
|
return &Driver{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewIdentityServer(d *csicommon.CSIDriver) *identityServer {
|
func NewIdentityServer(d *csicommon.CSIDriver) *IdentityServer {
|
||||||
return &identityServer{
|
return &IdentityServer{
|
||||||
DefaultIdentityServer: csicommon.NewDefaultIdentityServer(d),
|
DefaultIdentityServer: csicommon.NewDefaultIdentityServer(d),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewControllerServer(d *csicommon.CSIDriver, cachePersister util.CachePersister) *controllerServer {
|
func NewControllerServer(d *csicommon.CSIDriver, cachePersister util.CachePersister) *ControllerServer {
|
||||||
return &controllerServer{
|
return &ControllerServer{
|
||||||
DefaultControllerServer: csicommon.NewDefaultControllerServer(d),
|
DefaultControllerServer: csicommon.NewDefaultControllerServer(d),
|
||||||
MetadataStore: cachePersister,
|
MetadataStore: cachePersister,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewNodeServer(d *csicommon.CSIDriver) *nodeServer {
|
func NewNodeServer(d *csicommon.CSIDriver) *NodeServer {
|
||||||
return &nodeServer{
|
return &NodeServer{
|
||||||
DefaultNodeServer: csicommon.NewDefaultNodeServer(d),
|
DefaultNodeServer: csicommon.NewDefaultNodeServer(d),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fs *driver) Run(driverName, nodeID, endpoint, volumeMounter string, cachePersister util.CachePersister) {
|
func (fs *Driver) Run(driverName, nodeID, endpoint, volumeMounter string, cachePersister util.CachePersister) {
|
||||||
glog.Infof("Driver: %v version: %v", driverName, Version)
|
glog.Infof("Driver: %v version: %v", driverName, Version)
|
||||||
|
|
||||||
// Configuration
|
// Configuration
|
||||||
|
@ -23,11 +23,11 @@ import (
|
|||||||
"github.com/kubernetes-csi/drivers/pkg/csi-common"
|
"github.com/kubernetes-csi/drivers/pkg/csi-common"
|
||||||
)
|
)
|
||||||
|
|
||||||
type identityServer struct {
|
type IdentityServer struct {
|
||||||
*csicommon.DefaultIdentityServer
|
*csicommon.DefaultIdentityServer
|
||||||
}
|
}
|
||||||
|
|
||||||
func (is *identityServer) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) {
|
func (is *IdentityServer) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) {
|
||||||
return &csi.GetPluginCapabilitiesResponse{
|
return &csi.GetPluginCapabilitiesResponse{
|
||||||
Capabilities: []*csi.PluginCapability{
|
Capabilities: []*csi.PluginCapability{
|
||||||
{
|
{
|
||||||
|
@ -29,7 +29,7 @@ import (
|
|||||||
"github.com/kubernetes-csi/drivers/pkg/csi-common"
|
"github.com/kubernetes-csi/drivers/pkg/csi-common"
|
||||||
)
|
)
|
||||||
|
|
||||||
type nodeServer struct {
|
type NodeServer struct {
|
||||||
*csicommon.DefaultNodeServer
|
*csicommon.DefaultNodeServer
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ func getCredentialsForVolume(volOptions *volumeOptions, volID volumeID, req *csi
|
|||||||
return userCr, nil
|
return userCr, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ns *nodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error) {
|
func (ns *NodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error) {
|
||||||
if err := validateNodeStageVolumeRequest(req); err != nil {
|
if err := validateNodeStageVolumeRequest(req); err != nil {
|
||||||
return nil, status.Error(codes.InvalidArgument, err.Error())
|
return nil, status.Error(codes.InvalidArgument, err.Error())
|
||||||
}
|
}
|
||||||
@ -149,7 +149,7 @@ func (ns *nodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVol
|
|||||||
return &csi.NodeStageVolumeResponse{}, nil
|
return &csi.NodeStageVolumeResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) {
|
func (ns *NodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) {
|
||||||
if err := validateNodePublishVolumeRequest(req); err != nil {
|
if err := validateNodePublishVolumeRequest(req); err != nil {
|
||||||
return nil, status.Error(codes.InvalidArgument, err.Error())
|
return nil, status.Error(codes.InvalidArgument, err.Error())
|
||||||
}
|
}
|
||||||
@ -190,7 +190,7 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
|
|||||||
return &csi.NodePublishVolumeResponse{}, nil
|
return &csi.NodePublishVolumeResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ns *nodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) {
|
func (ns *NodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) {
|
||||||
if err := validateNodeUnpublishVolumeRequest(req); err != nil {
|
if err := validateNodeUnpublishVolumeRequest(req); err != nil {
|
||||||
return nil, status.Error(codes.InvalidArgument, err.Error())
|
return nil, status.Error(codes.InvalidArgument, err.Error())
|
||||||
}
|
}
|
||||||
@ -209,7 +209,7 @@ func (ns *nodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpu
|
|||||||
return &csi.NodeUnpublishVolumeResponse{}, nil
|
return &csi.NodeUnpublishVolumeResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ns *nodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) {
|
func (ns *NodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) {
|
||||||
if err := validateNodeUnstageVolumeRequest(req); err != nil {
|
if err := validateNodeUnstageVolumeRequest(req); err != nil {
|
||||||
return nil, status.Error(codes.InvalidArgument, err.Error())
|
return nil, status.Error(codes.InvalidArgument, err.Error())
|
||||||
}
|
}
|
||||||
@ -228,7 +228,7 @@ func (ns *nodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstag
|
|||||||
return &csi.NodeUnstageVolumeResponse{}, nil
|
return &csi.NodeUnstageVolumeResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ns *nodeServer) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) {
|
func (ns *NodeServer) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) {
|
||||||
return &csi.NodeGetCapabilitiesResponse{
|
return &csi.NodeGetCapabilitiesResponse{
|
||||||
Capabilities: []*csi.NodeServiceCapability{
|
Capabilities: []*csi.NodeServiceCapability{
|
||||||
{
|
{
|
||||||
|
@ -103,7 +103,7 @@ func storeCephCredentials(volID volumeID, cr *credentials) error {
|
|||||||
// Controller service request validation
|
// Controller service request validation
|
||||||
//
|
//
|
||||||
|
|
||||||
func (cs *controllerServer) validateCreateVolumeRequest(req *csi.CreateVolumeRequest) error {
|
func (cs *ControllerServer) validateCreateVolumeRequest(req *csi.CreateVolumeRequest) error {
|
||||||
if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME); err != nil {
|
if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME); err != nil {
|
||||||
return fmt.Errorf("invalid CreateVolumeRequest: %v", err)
|
return fmt.Errorf("invalid CreateVolumeRequest: %v", err)
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ func (cs *controllerServer) validateCreateVolumeRequest(req *csi.CreateVolumeReq
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *controllerServer) validateDeleteVolumeRequest(req *csi.DeleteVolumeRequest) error {
|
func (cs *ControllerServer) validateDeleteVolumeRequest(req *csi.DeleteVolumeRequest) error {
|
||||||
if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME); err != nil {
|
if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME); err != nil {
|
||||||
return fmt.Errorf("invalid DeleteVolumeRequest: %v", err)
|
return fmt.Errorf("invalid DeleteVolumeRequest: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ const (
|
|||||||
oneGB = 1073741824
|
oneGB = 1073741824
|
||||||
)
|
)
|
||||||
|
|
||||||
type controllerServer struct {
|
type ControllerServer struct {
|
||||||
*csicommon.DefaultControllerServer
|
*csicommon.DefaultControllerServer
|
||||||
MetadataStore util.CachePersister
|
MetadataStore util.CachePersister
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ var (
|
|||||||
rbdSnapshots = map[string]*rbdSnapshot{}
|
rbdSnapshots = map[string]*rbdSnapshot{}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (cs *controllerServer) LoadExDataFromMetadataStore() error {
|
func (cs *ControllerServer) LoadExDataFromMetadataStore() error {
|
||||||
vol := &rbdVolume{}
|
vol := &rbdVolume{}
|
||||||
cs.MetadataStore.ForAll("csi-rbd-vol-", vol, func(identifier string) error {
|
cs.MetadataStore.ForAll("csi-rbd-vol-", vol, func(identifier string) error {
|
||||||
rbdVolumes[identifier] = vol
|
rbdVolumes[identifier] = vol
|
||||||
@ -65,7 +65,7 @@ func (cs *controllerServer) LoadExDataFromMetadataStore() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *controllerServer) validateVolumeReq(req *csi.CreateVolumeRequest) error {
|
func (cs *ControllerServer) validateVolumeReq(req *csi.CreateVolumeRequest) error {
|
||||||
if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME); err != nil {
|
if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME); err != nil {
|
||||||
glog.V(3).Infof("invalid create volume req: %v", req)
|
glog.V(3).Infof("invalid create volume req: %v", req)
|
||||||
return err
|
return err
|
||||||
@ -80,7 +80,7 @@ func (cs *controllerServer) validateVolumeReq(req *csi.CreateVolumeRequest) erro
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) {
|
func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) {
|
||||||
|
|
||||||
if err := cs.validateVolumeReq(req); err != nil {
|
if err := cs.validateVolumeReq(req); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -169,7 +169,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *controllerServer) checkSnapshot(req *csi.CreateVolumeRequest, rbdVol *rbdVolume) error {
|
func (cs *ControllerServer) checkSnapshot(req *csi.CreateVolumeRequest, rbdVol *rbdVolume) error {
|
||||||
snapshot := req.VolumeContentSource.GetSnapshot()
|
snapshot := req.VolumeContentSource.GetSnapshot()
|
||||||
if snapshot == nil {
|
if snapshot == nil {
|
||||||
return status.Error(codes.InvalidArgument, "Volume Snapshot cannot be empty")
|
return status.Error(codes.InvalidArgument, "Volume Snapshot cannot be empty")
|
||||||
@ -193,7 +193,7 @@ func (cs *controllerServer) checkSnapshot(req *csi.CreateVolumeRequest, rbdVol *
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *controllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {
|
func (cs *ControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {
|
||||||
if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME); err != nil {
|
if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME); err != nil {
|
||||||
glog.Warningf("invalid delete volume req: %v", req)
|
glog.Warningf("invalid delete volume req: %v", req)
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -227,7 +227,7 @@ func (cs *controllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
|
|||||||
return &csi.DeleteVolumeResponse{}, nil
|
return &csi.DeleteVolumeResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *controllerServer) ValidateVolumeCapabilities(ctx context.Context, req *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error) {
|
func (cs *ControllerServer) ValidateVolumeCapabilities(ctx context.Context, req *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error) {
|
||||||
for _, cap := range req.VolumeCapabilities {
|
for _, cap := range req.VolumeCapabilities {
|
||||||
if cap.GetAccessMode().GetMode() != csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER {
|
if cap.GetAccessMode().GetMode() != csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER {
|
||||||
return &csi.ValidateVolumeCapabilitiesResponse{Message: ""}, nil
|
return &csi.ValidateVolumeCapabilitiesResponse{Message: ""}, nil
|
||||||
@ -240,15 +240,15 @@ func (cs *controllerServer) ValidateVolumeCapabilities(ctx context.Context, req
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *controllerServer) ControllerUnpublishVolume(ctx context.Context, req *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error) {
|
func (cs *ControllerServer) ControllerUnpublishVolume(ctx context.Context, req *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error) {
|
||||||
return &csi.ControllerUnpublishVolumeResponse{}, nil
|
return &csi.ControllerUnpublishVolumeResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *controllerServer) ControllerPublishVolume(ctx context.Context, req *csi.ControllerPublishVolumeRequest) (*csi.ControllerPublishVolumeResponse, error) {
|
func (cs *ControllerServer) ControllerPublishVolume(ctx context.Context, req *csi.ControllerPublishVolumeRequest) (*csi.ControllerPublishVolumeResponse, error) {
|
||||||
return &csi.ControllerPublishVolumeResponse{}, nil
|
return &csi.ControllerPublishVolumeResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *controllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error) {
|
func (cs *ControllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error) {
|
||||||
if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_SNAPSHOT); err != nil {
|
if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_SNAPSHOT); err != nil {
|
||||||
glog.Warningf("invalid create snapshot req: %v", req)
|
glog.Warningf("invalid create snapshot req: %v", req)
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -370,7 +370,7 @@ func (cs *controllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *controllerServer) DeleteSnapshot(ctx context.Context, req *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error) {
|
func (cs *ControllerServer) DeleteSnapshot(ctx context.Context, req *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error) {
|
||||||
if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_SNAPSHOT); err != nil {
|
if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_SNAPSHOT); err != nil {
|
||||||
glog.Warningf("invalid delete snapshot req: %v", req)
|
glog.Warningf("invalid delete snapshot req: %v", req)
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -409,7 +409,7 @@ func (cs *controllerServer) DeleteSnapshot(ctx context.Context, req *csi.DeleteS
|
|||||||
return &csi.DeleteSnapshotResponse{}, nil
|
return &csi.DeleteSnapshotResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *controllerServer) ListSnapshots(ctx context.Context, req *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error) {
|
func (cs *ControllerServer) ListSnapshots(ctx context.Context, req *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error) {
|
||||||
if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_LIST_SNAPSHOTS); err != nil {
|
if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_LIST_SNAPSHOTS); err != nil {
|
||||||
glog.Warningf("invalid list snapshot req: %v", req)
|
glog.Warningf("invalid list snapshot req: %v", req)
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -23,11 +23,11 @@ import (
|
|||||||
"github.com/kubernetes-csi/drivers/pkg/csi-common"
|
"github.com/kubernetes-csi/drivers/pkg/csi-common"
|
||||||
)
|
)
|
||||||
|
|
||||||
type identityServer struct {
|
type IdentityServer struct {
|
||||||
*csicommon.DefaultIdentityServer
|
*csicommon.DefaultIdentityServer
|
||||||
}
|
}
|
||||||
|
|
||||||
func (is *identityServer) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) {
|
func (is *IdentityServer) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) {
|
||||||
return &csi.GetPluginCapabilitiesResponse{
|
return &csi.GetPluginCapabilitiesResponse{
|
||||||
Capabilities: []*csi.PluginCapability{
|
Capabilities: []*csi.PluginCapability{
|
||||||
{
|
{
|
||||||
|
@ -35,12 +35,12 @@ import (
|
|||||||
"github.com/kubernetes-csi/drivers/pkg/csi-common"
|
"github.com/kubernetes-csi/drivers/pkg/csi-common"
|
||||||
)
|
)
|
||||||
|
|
||||||
type nodeServer struct {
|
type NodeServer struct {
|
||||||
*csicommon.DefaultNodeServer
|
*csicommon.DefaultNodeServer
|
||||||
mounter mount.Interface
|
mounter mount.Interface
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) {
|
func (ns *NodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) {
|
||||||
targetPath := req.GetTargetPath()
|
targetPath := req.GetTargetPath()
|
||||||
targetPathMutex.LockKey(targetPath)
|
targetPathMutex.LockKey(targetPath)
|
||||||
defer targetPathMutex.UnlockKey(targetPath)
|
defer targetPathMutex.UnlockKey(targetPath)
|
||||||
@ -132,7 +132,7 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
|
|||||||
return &csi.NodePublishVolumeResponse{}, nil
|
return &csi.NodePublishVolumeResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ns *nodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) {
|
func (ns *NodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) {
|
||||||
targetPath := req.GetTargetPath()
|
targetPath := req.GetTargetPath()
|
||||||
targetPathMutex.LockKey(targetPath)
|
targetPathMutex.LockKey(targetPath)
|
||||||
defer targetPathMutex.UnlockKey(targetPath)
|
defer targetPathMutex.UnlockKey(targetPath)
|
||||||
@ -202,7 +202,7 @@ func (ns *nodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpu
|
|||||||
return &csi.NodeUnpublishVolumeResponse{}, nil
|
return &csi.NodeUnpublishVolumeResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ns *nodeServer) NodeStageVolume(
|
func (ns *NodeServer) NodeStageVolume(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
req *csi.NodeStageVolumeRequest) (
|
req *csi.NodeStageVolumeRequest) (
|
||||||
*csi.NodeStageVolumeResponse, error) {
|
*csi.NodeStageVolumeResponse, error) {
|
||||||
@ -210,7 +210,7 @@ func (ns *nodeServer) NodeStageVolume(
|
|||||||
return nil, status.Error(codes.Unimplemented, "")
|
return nil, status.Error(codes.Unimplemented, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ns *nodeServer) NodeUnstageVolume(
|
func (ns *NodeServer) NodeUnstageVolume(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
req *csi.NodeUnstageVolumeRequest) (
|
req *csi.NodeUnstageVolumeRequest) (
|
||||||
*csi.NodeUnstageVolumeResponse, error) {
|
*csi.NodeUnstageVolumeResponse, error) {
|
||||||
|
@ -35,36 +35,36 @@ const (
|
|||||||
rbdDefaultUserID = rbdDefaultAdminID
|
rbdDefaultUserID = rbdDefaultAdminID
|
||||||
)
|
)
|
||||||
|
|
||||||
type driver struct {
|
type Driver struct {
|
||||||
cd *csicommon.CSIDriver
|
cd *csicommon.CSIDriver
|
||||||
|
|
||||||
ids *identityServer
|
ids *IdentityServer
|
||||||
ns *nodeServer
|
ns *NodeServer
|
||||||
cs *controllerServer
|
cs *ControllerServer
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetDriver() *driver {
|
func GetDriver() *Driver {
|
||||||
return &driver{}
|
return &Driver{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewIdentityServer(d *csicommon.CSIDriver) *identityServer {
|
func NewIdentityServer(d *csicommon.CSIDriver) *IdentityServer {
|
||||||
return &identityServer{
|
return &IdentityServer{
|
||||||
DefaultIdentityServer: csicommon.NewDefaultIdentityServer(d),
|
DefaultIdentityServer: csicommon.NewDefaultIdentityServer(d),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewControllerServer(d *csicommon.CSIDriver, cachePersister util.CachePersister) *controllerServer {
|
func NewControllerServer(d *csicommon.CSIDriver, cachePersister util.CachePersister) *ControllerServer {
|
||||||
return &controllerServer{
|
return &ControllerServer{
|
||||||
DefaultControllerServer: csicommon.NewDefaultControllerServer(d),
|
DefaultControllerServer: csicommon.NewDefaultControllerServer(d),
|
||||||
MetadataStore: cachePersister,
|
MetadataStore: cachePersister,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewNodeServer(d *csicommon.CSIDriver, containerized bool) (*nodeServer, error) {
|
func NewNodeServer(d *csicommon.CSIDriver, containerized bool) (*NodeServer, error) {
|
||||||
mounter := mount.New("")
|
mounter := mount.New("")
|
||||||
if containerized {
|
if containerized {
|
||||||
ne, err := nsenter.NewNsenter(nsenter.DefaultHostRootFsPath, exec.New())
|
ne, err := nsenter.NewNsenter(nsenter.DefaultHostRootFsPath, exec.New())
|
||||||
@ -73,13 +73,13 @@ func NewNodeServer(d *csicommon.CSIDriver, containerized bool) (*nodeServer, err
|
|||||||
}
|
}
|
||||||
mounter = mount.NewNsenterMounter("", ne)
|
mounter = mount.NewNsenterMounter("", ne)
|
||||||
}
|
}
|
||||||
return &nodeServer{
|
return &NodeServer{
|
||||||
DefaultNodeServer: csicommon.NewDefaultNodeServer(d),
|
DefaultNodeServer: csicommon.NewDefaultNodeServer(d),
|
||||||
mounter: mounter,
|
mounter: mounter,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *driver) Run(driverName, nodeID, endpoint string, containerized bool, cachePersister util.CachePersister) {
|
func (r *Driver) Run(driverName, nodeID, endpoint string, containerized bool, cachePersister util.CachePersister) {
|
||||||
var err error
|
var err error
|
||||||
glog.Infof("Driver: %v version: %v", driverName, version)
|
glog.Infof("Driver: %v version: %v", driverName, version)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user