mirror of
https://github.com/kubernetes-csi/csi-driver-nvmf.git
synced 2025-04-27 19:05:26 +00:00
1. upgrade go version from v1.14 to v.1.19 2. upgrade csi_spec from v1.5.0 to v1.7.0 3. upgrade golang.org/x/net from v0.4.0 to v0.5.0 4. upgrade google.golang.org/grpc from v1.49.0 to v1.51.0 5. upgrade klog from v1.0 to v2.80.1 6. upgrade k8s.io/utils from 2022 to 2023 7. remove logrus Signed-off-by: Meinhard Zhou <zhouenhua@bytedance.com>
95 lines
4.1 KiB
Go
95 lines
4.1 KiB
Go
/*
|
|
Copyright 2021 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 nvmf
|
|
|
|
import (
|
|
"github.com/container-storage-interface/spec/lib/go/csi"
|
|
"golang.org/x/net/context"
|
|
"google.golang.org/grpc/codes"
|
|
"google.golang.org/grpc/status"
|
|
"k8s.io/klog/v2"
|
|
)
|
|
|
|
type ControllerServer struct {
|
|
Driver *driver
|
|
}
|
|
|
|
// create controller server
|
|
func NewControllerServer(d *driver) *ControllerServer {
|
|
return &ControllerServer{
|
|
Driver: d,
|
|
}
|
|
}
|
|
|
|
// You should realize your volume provider here, such as requesting the Cloud to create an NVMf block and
|
|
// returning specific information to you
|
|
func (c *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "CreateVolume should implement by yourself. ")
|
|
}
|
|
|
|
func (c *ControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "DeleteVolume should implement by yourself. ")
|
|
}
|
|
|
|
func (c *ControllerServer) ControllerExpandVolume(ctx context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "ControllerExpandVolume should implement by yourself")
|
|
}
|
|
|
|
func (c *ControllerServer) ControllerGetVolume(ctx context.Context, request *csi.ControllerGetVolumeRequest) (*csi.ControllerGetVolumeResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "ControllerGetVolume not implement")
|
|
}
|
|
|
|
func (c *ControllerServer) ControllerPublishVolume(ctx context.Context, req *csi.ControllerPublishVolumeRequest) (*csi.ControllerPublishVolumeResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "ControllerPublishVolume not implement")
|
|
}
|
|
|
|
func (c *ControllerServer) ControllerUnpublishVolume(ctx context.Context, request *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "ControllerUnpublishVolume not implement")
|
|
}
|
|
|
|
func (c *ControllerServer) ValidateVolumeCapabilities(ctx context.Context, request *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "ValidateVolumeCapabilities not implement")
|
|
}
|
|
|
|
func (c *ControllerServer) ListVolumes(ctx context.Context, request *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "ListVolumes not implement")
|
|
}
|
|
|
|
func (c *ControllerServer) GetCapacity(ctx context.Context, request *csi.GetCapacityRequest) (*csi.GetCapacityResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "GetCapacity not implement")
|
|
}
|
|
|
|
func (c *ControllerServer) ControllerGetCapabilities(ctx context.Context, request *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error) {
|
|
klog.Infof("Using default ControllerGetCapabilities")
|
|
|
|
return &csi.ControllerGetCapabilitiesResponse{
|
|
Capabilities: c.Driver.cscap,
|
|
}, nil
|
|
}
|
|
|
|
func (c *ControllerServer) CreateSnapshot(ctx context.Context, request *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "CreateSnapshot not implement")
|
|
}
|
|
|
|
func (c *ControllerServer) DeleteSnapshot(ctx context.Context, request *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "DeleteSnapshot not implement")
|
|
}
|
|
|
|
func (c *ControllerServer) ListSnapshots(ctx context.Context, request *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "ListSnapshots not implement")
|
|
}
|