mirror of
https://github.com/TECHNOFAB11/zfs-localpv.git
synced 2025-12-11 22:10:11 +01:00
refact(pkg): Removes unused import, variables and functions. (#321)
Signed-off-by: Rahul Grover <rahulgrover99@gmail.com>
This commit is contained in:
parent
0e6a02ea74
commit
a8376796b7
7 changed files with 10 additions and 36 deletions
|
|
@ -382,7 +382,7 @@ func (ns *node) NodeGetVolumeStats(
|
|||
return nil, status.Error(codes.InvalidArgument, "path is not provided")
|
||||
}
|
||||
|
||||
if mount.IsMountPath(path) == false {
|
||||
if !mount.IsMountPath(path) {
|
||||
return nil, status.Error(codes.NotFound, "path is not a mount path")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ func NewController(d *CSIDriver) csi.ControllerServer {
|
|||
// SupportedVolumeCapabilityAccessModes contains the list of supported access
|
||||
// modes for the volume
|
||||
var SupportedVolumeCapabilityAccessModes = []*csi.VolumeCapability_AccessMode{
|
||||
&csi.VolumeCapability_AccessMode{
|
||||
{
|
||||
Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER,
|
||||
},
|
||||
}
|
||||
|
|
@ -102,7 +102,7 @@ func getRoundedCapacity(size int64) int64 {
|
|||
}
|
||||
|
||||
func waitForVolDestroy(volname string) error {
|
||||
for true {
|
||||
for {
|
||||
_, err := zfs.GetZFSVolume(volname)
|
||||
if err != nil {
|
||||
if k8serror.IsNotFound(err) {
|
||||
|
|
@ -114,11 +114,10 @@ func waitForVolDestroy(volname string) error {
|
|||
time.Sleep(time.Second)
|
||||
klog.Infof("waiting for volume to be destroyed %s", volname)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func waitForReadySnapshot(snapname string) error {
|
||||
for true {
|
||||
for {
|
||||
snap, err := zfs.GetZFSSnapshot(snapname)
|
||||
if err != nil {
|
||||
return status.Errorf(codes.Internal,
|
||||
|
|
@ -131,7 +130,6 @@ func waitForReadySnapshot(snapname string) error {
|
|||
}
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// CreateZFSVolume create new zfs volume from csi volume request
|
||||
|
|
@ -802,18 +800,6 @@ func (cs *controller) ListVolumes(
|
|||
return nil, status.Error(codes.Unimplemented, "")
|
||||
}
|
||||
|
||||
// validateCapabilities validates if provided capabilities
|
||||
// are supported by this driver
|
||||
func validateCapabilities(caps []*csi.VolumeCapability) bool {
|
||||
|
||||
for _, cap := range caps {
|
||||
if !IsSupportedVolumeCapabilityAccessMode(cap.AccessMode.Mode) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (cs *controller) validateDeleteVolumeReq(req *csi.DeleteVolumeRequest) error {
|
||||
volumeID := req.GetVolumeId()
|
||||
if volumeID == "" {
|
||||
|
|
|
|||
|
|
@ -22,13 +22,6 @@ import (
|
|||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
// volume can only be published once as
|
||||
// read/write on a single node, at any
|
||||
// given time
|
||||
var supportedAccessMode = &csi.VolumeCapability_AccessMode{
|
||||
Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER,
|
||||
}
|
||||
|
||||
// CSIDriver defines a common data structure
|
||||
// for drivers
|
||||
// TODO check if this can be renamed to Base
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ func parseEndpoint(ep string) (string, string, error) {
|
|||
return s[0], s[1], nil
|
||||
}
|
||||
}
|
||||
return "", "", fmt.Errorf("Invalid endpoint: %v", ep)
|
||||
return "", "", fmt.Errorf("invalid endpoint: %v", ep)
|
||||
}
|
||||
|
||||
//filters if the logd are informative or pollutant
|
||||
|
|
@ -68,13 +68,13 @@ func isInfotrmativeLog(info string) bool {
|
|||
func logGRPC(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
|
||||
|
||||
log := isInfotrmativeLog(info.FullMethod)
|
||||
if log == true {
|
||||
if log {
|
||||
klog.Infof("GRPC call: %s requests %s", info.FullMethod, protosanitizer.StripSecrets(req))
|
||||
}
|
||||
|
||||
resp, err := handler(ctx, req)
|
||||
|
||||
if log == true {
|
||||
if log {
|
||||
if err != nil {
|
||||
klog.Errorf("GRPC error: %v", err)
|
||||
} else {
|
||||
|
|
@ -127,7 +127,6 @@ func (s *nonBlockingGRPCServer) Start() {
|
|||
|
||||
go s.serve(s.endpoint, s.idntyServer, s.ctrlServer, s.agentServer)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// Wait for the service to stop
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue