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")
|
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")
|
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
|
// SupportedVolumeCapabilityAccessModes contains the list of supported access
|
||||||
// modes for the volume
|
// modes for the volume
|
||||||
var SupportedVolumeCapabilityAccessModes = []*csi.VolumeCapability_AccessMode{
|
var SupportedVolumeCapabilityAccessModes = []*csi.VolumeCapability_AccessMode{
|
||||||
&csi.VolumeCapability_AccessMode{
|
{
|
||||||
Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER,
|
Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -102,7 +102,7 @@ func getRoundedCapacity(size int64) int64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
func waitForVolDestroy(volname string) error {
|
func waitForVolDestroy(volname string) error {
|
||||||
for true {
|
for {
|
||||||
_, err := zfs.GetZFSVolume(volname)
|
_, err := zfs.GetZFSVolume(volname)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if k8serror.IsNotFound(err) {
|
if k8serror.IsNotFound(err) {
|
||||||
|
|
@ -114,11 +114,10 @@ func waitForVolDestroy(volname string) error {
|
||||||
time.Sleep(time.Second)
|
time.Sleep(time.Second)
|
||||||
klog.Infof("waiting for volume to be destroyed %s", volname)
|
klog.Infof("waiting for volume to be destroyed %s", volname)
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func waitForReadySnapshot(snapname string) error {
|
func waitForReadySnapshot(snapname string) error {
|
||||||
for true {
|
for {
|
||||||
snap, err := zfs.GetZFSSnapshot(snapname)
|
snap, err := zfs.GetZFSSnapshot(snapname)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return status.Errorf(codes.Internal,
|
return status.Errorf(codes.Internal,
|
||||||
|
|
@ -131,7 +130,6 @@ func waitForReadySnapshot(snapname string) error {
|
||||||
}
|
}
|
||||||
time.Sleep(time.Second)
|
time.Sleep(time.Second)
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateZFSVolume create new zfs volume from csi volume request
|
// CreateZFSVolume create new zfs volume from csi volume request
|
||||||
|
|
@ -802,18 +800,6 @@ func (cs *controller) ListVolumes(
|
||||||
return nil, status.Error(codes.Unimplemented, "")
|
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 {
|
func (cs *controller) validateDeleteVolumeReq(req *csi.DeleteVolumeRequest) error {
|
||||||
volumeID := req.GetVolumeId()
|
volumeID := req.GetVolumeId()
|
||||||
if volumeID == "" {
|
if volumeID == "" {
|
||||||
|
|
|
||||||
|
|
@ -22,13 +22,6 @@ import (
|
||||||
"k8s.io/klog"
|
"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
|
// CSIDriver defines a common data structure
|
||||||
// for drivers
|
// for drivers
|
||||||
// TODO check if this can be renamed to Base
|
// 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 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
|
//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) {
|
func logGRPC(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
|
||||||
|
|
||||||
log := isInfotrmativeLog(info.FullMethod)
|
log := isInfotrmativeLog(info.FullMethod)
|
||||||
if log == true {
|
if log {
|
||||||
klog.Infof("GRPC call: %s requests %s", info.FullMethod, protosanitizer.StripSecrets(req))
|
klog.Infof("GRPC call: %s requests %s", info.FullMethod, protosanitizer.StripSecrets(req))
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := handler(ctx, req)
|
resp, err := handler(ctx, req)
|
||||||
|
|
||||||
if log == true {
|
if log {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf("GRPC error: %v", err)
|
klog.Errorf("GRPC error: %v", err)
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -127,7 +127,6 @@ func (s *nonBlockingGRPCServer) Start() {
|
||||||
|
|
||||||
go s.serve(s.endpoint, s.idntyServer, s.ctrlServer, s.agentServer)
|
go s.serve(s.endpoint, s.idntyServer, s.ctrlServer, s.agentServer)
|
||||||
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for the service to stop
|
// Wait for the service to stop
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ import (
|
||||||
"github.com/openebs/zfs-localpv/pkg/builder/snapbuilder"
|
"github.com/openebs/zfs-localpv/pkg/builder/snapbuilder"
|
||||||
"github.com/openebs/zfs-localpv/pkg/builder/volbuilder"
|
"github.com/openebs/zfs-localpv/pkg/builder/volbuilder"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -225,7 +224,7 @@ func DeleteVolume(volumeID string) (err error) {
|
||||||
|
|
||||||
// GetVolList fetches the current Published Volume list
|
// GetVolList fetches the current Published Volume list
|
||||||
func GetVolList(volumeID string) (*apis.ZFSVolumeList, error) {
|
func GetVolList(volumeID string) (*apis.ZFSVolumeList, error) {
|
||||||
listOptions := v1.ListOptions{
|
listOptions := metav1.ListOptions{
|
||||||
LabelSelector: ZFSNodeKey + "=" + NodeID,
|
LabelSelector: ZFSNodeKey + "=" + NodeID,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -457,8 +457,7 @@ func CreateClone(vol *apis.ZFSVolume) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := getVolume(volume); err != nil {
|
if err := getVolume(volume); err != nil {
|
||||||
var args []string
|
args := buildCloneCreateArgs(vol)
|
||||||
args = buildCloneCreateArgs(vol)
|
|
||||||
cmd := exec.Command(ZFSVolCmd, args...)
|
cmd := exec.Command(ZFSVolCmd, args...)
|
||||||
out, err := cmd.CombinedOutput()
|
out, err := cmd.CombinedOutput()
|
||||||
|
|
||||||
|
|
@ -749,7 +748,7 @@ func ResizeZFSVolume(vol *apis.ZFSVolume, mountpath string, resizefs bool) error
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if resizefs == true {
|
if resizefs {
|
||||||
// resize the filesystem so that applications can use the expanded space
|
// resize the filesystem so that applications can use the expanded space
|
||||||
err = handleVolResize(vol, mountpath)
|
err = handleVolResize(vol, mountpath)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,6 @@ var (
|
||||||
PVCClient *pvc.Kubeclient
|
PVCClient *pvc.Kubeclient
|
||||||
DeployClient *deploy.Kubeclient
|
DeployClient *deploy.Kubeclient
|
||||||
PodClient *pod.KubeClient
|
PodClient *pod.KubeClient
|
||||||
nsName = "zfspv-provision"
|
|
||||||
scName = "zfspv-sc"
|
scName = "zfspv-sc"
|
||||||
ZFSProvisioner = "zfs.csi.openebs.io"
|
ZFSProvisioner = "zfs.csi.openebs.io"
|
||||||
pvcName = "zfspv-pvc"
|
pvcName = "zfspv-pvc"
|
||||||
|
|
@ -56,7 +55,6 @@ var (
|
||||||
clonePvcName = "zfspv-pvc-clone"
|
clonePvcName = "zfspv-pvc-clone"
|
||||||
cloneAppName = "busybox-zfspv-clone"
|
cloneAppName = "busybox-zfspv-clone"
|
||||||
|
|
||||||
nsObj *corev1.Namespace
|
|
||||||
scObj *storagev1.StorageClass
|
scObj *storagev1.StorageClass
|
||||||
deployObj *appsv1.Deployment
|
deployObj *appsv1.Deployment
|
||||||
pvcObj *corev1.PersistentVolumeClaim
|
pvcObj *corev1.PersistentVolumeClaim
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue