[WIP] More work implementing create/delete volume and publish/unpublish volume
This commit is contained in:
@@ -18,6 +18,7 @@ package csi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"k8s.io/klog"
|
||||
|
||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||
"google.golang.org/grpc/codes"
|
||||
@@ -53,16 +54,20 @@ func newNodeService(nodeID string) nodeService {
|
||||
|
||||
// NodeStageVolume is called by the CO when a workload that wants to use the specified volume is placed (scheduled) on a node.
|
||||
func (n *nodeService) NodeStageVolume(ctx context.Context, request *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "")
|
||||
klog.Infof("node.NodeStageVolume: Staging volume %s -> %s", request.GetVolumeId(), request.GetStagingTargetPath())
|
||||
return nil, status.Error(codes.Unimplemented, "node.NodeStageVolume")
|
||||
}
|
||||
|
||||
// NodeUnstageVolume is called by the CO when a workload that was using the specified volume is being moved to a different node.
|
||||
func (n *nodeService) NodeUnstageVolume(ctx context.Context, request *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "")
|
||||
klog.Infof("node.NodeUnstageVolume: Staging volume %s -> %s", request.GetVolumeId(), request.GetStagingTargetPath())
|
||||
return nil, status.Error(codes.Unimplemented, "node.NodeUnstageVolume")
|
||||
}
|
||||
|
||||
// NodePublishVolume mounts the volume on the node.
|
||||
func (n *nodeService) NodePublishVolume(ctx context.Context, request *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) {
|
||||
klog.Infof("node.NodePublishVolume: Publishing volume %s -> %s", request.GetVolumeId(), request.GetTargetPath())
|
||||
|
||||
volumeID := request.GetVolumeId()
|
||||
if len(volumeID) == 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "Volume id not provided")
|
||||
@@ -101,11 +106,14 @@ func (n *nodeService) NodePublishVolume(ctx context.Context, request *csi.NodePu
|
||||
|
||||
// TODO modify your volume mount logic here
|
||||
|
||||
return &csi.NodePublishVolumeResponse{}, nil
|
||||
return nil, status.Error(codes.Unimplemented, "node.NodePublishVolume")
|
||||
// return &csi.NodePublishVolumeResponse{}, nil
|
||||
}
|
||||
|
||||
// NodeUnpublishVolume unmount the volume from the target path
|
||||
func (n *nodeService) NodeUnpublishVolume(ctx context.Context, request *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) {
|
||||
klog.Infof("node.NodeUnpublishVolume: Unpublishing volume %s -> %s", request.GetVolumeId(), request.GetTargetPath())
|
||||
|
||||
target := request.GetTargetPath()
|
||||
if len(target) == 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "Target path not provided")
|
||||
@@ -113,26 +121,31 @@ func (n *nodeService) NodeUnpublishVolume(ctx context.Context, request *csi.Node
|
||||
|
||||
// TODO modify your volume umount logic here
|
||||
|
||||
return &csi.NodeUnpublishVolumeResponse{}, nil
|
||||
return nil, status.Error(codes.Unimplemented, "node.NodeUnpublishVolume")
|
||||
// return &csi.NodeUnpublishVolumeResponse{}, nil
|
||||
}
|
||||
|
||||
// NodeGetVolumeStats get the volume stats
|
||||
func (n *nodeService) NodeGetVolumeStats(ctx context.Context, request *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "")
|
||||
klog.Infof("node.NodeGetVolumeStats: For volume %s -> %s", request.GetVolumeId(), request.GetVolumePath())
|
||||
return nil, status.Error(codes.Unimplemented, "node.NodeGetVolumeStats")
|
||||
}
|
||||
|
||||
// NodeExpandVolume expand the volume
|
||||
func (n *nodeService) NodeExpandVolume(ctx context.Context, request *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "")
|
||||
klog.Infof("node.NodeExpandVolume: %s -> %s (min bytes: %d)", request.GetVolumeId(), request.GetVolumePath(), request.GetCapacityRange().GetRequiredBytes())
|
||||
return nil, status.Error(codes.Unimplemented, "node.NodeExpandVolume")
|
||||
}
|
||||
|
||||
// NodeGetCapabilities get the node capabilities
|
||||
func (n *nodeService) NodeGetCapabilities(ctx context.Context, request *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) {
|
||||
klog.Infof("node.NodeGetCapabilities: Called")
|
||||
return &csi.NodeGetCapabilitiesResponse{}, nil
|
||||
}
|
||||
|
||||
// NodeGetInfo get the node info
|
||||
func (n *nodeService) NodeGetInfo(ctx context.Context, request *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) {
|
||||
klog.Infof("node.NodeGetInfo: Called")
|
||||
return &csi.NodeGetInfoResponse{NodeId: n.nodeID}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user