feat(zfspv): move to klog (#166)

Signed-off-by: vaniisgh <vanisingh@live.co.uk>
This commit is contained in:
vaniisgh 2020-06-29 12:18:33 +05:30 committed by GitHub
parent 54f2b0b9fd
commit d0d1664d43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 124 additions and 2991 deletions

View file

@ -17,7 +17,8 @@ limitations under the License.
package driver
import (
"github.com/Sirupsen/logrus"
"sync"
"github.com/container-storage-interface/spec/lib/go/csi"
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
"github.com/openebs/zfs-localpv/pkg/builder/volbuilder"
@ -30,8 +31,8 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/klog"
"sigs.k8s.io/controller-runtime/pkg/runtime/signals"
"sync"
)
// node is the server implementation
@ -52,7 +53,7 @@ func NewNode(d *CSIDriver) csi.NodeServer {
go func() {
err := volume.Start(&ControllerMutex, stopCh)
if err != nil {
logrus.Fatalf("Failed to start ZFS volume management controller: %s", err.Error())
klog.Fatalf("Failed to start ZFS volume management controller: %s", err.Error())
}
}()
@ -60,7 +61,7 @@ func NewNode(d *CSIDriver) csi.NodeServer {
go func() {
err := snapshot.Start(&ControllerMutex, stopCh)
if err != nil {
logrus.Fatalf("Failed to start ZFS volume snapshot management controller: %s", err.Error())
klog.Fatalf("Failed to start ZFS volume snapshot management controller: %s", err.Error())
}
}()
@ -166,7 +167,7 @@ func (ns *node) NodeUnpublishVolume(
"unable to umount the volume %s err : %s",
volumeID, err.Error())
}
logrus.Infof("hostpath: volume %s path: %s has been unmounted.",
klog.Infof("hostpath: volume %s path: %s has been unmounted.",
volumeID, targetPath)
return &csi.NodeUnpublishVolumeResponse{}, nil
@ -182,7 +183,7 @@ func (ns *node) NodeGetInfo(
node, err := k8sapi.GetNode(ns.driver.config.NodeID)
if err != nil {
logrus.Errorf("failed to get the node %s", ns.driver.config.NodeID)
klog.Errorf("failed to get the node %s", ns.driver.config.NodeID)
return nil, err
}
/*

View file

@ -22,11 +22,11 @@ import (
"strings"
"time"
"github.com/Sirupsen/logrus"
"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"
"github.com/openebs/zfs-localpv/pkg/builder/snapbuilder"
"github.com/openebs/zfs-localpv/pkg/builder/volbuilder"
@ -107,7 +107,7 @@ func CreateZFSVolume(req *csi.CreateVolumeRequest) (string, error) {
return "", status.Error(codes.Internal, "scheduler failed")
}
logrus.Infof("scheduled the volume %s/%s on node %s", pool, volName, selected)
klog.Infof("scheduled the volume %s/%s on node %s", pool, volName, selected)
volObj, err := volbuilder.NewBuilder().
WithName(volName).
@ -245,7 +245,7 @@ func (cs *controller) DeleteVolume(
ctx context.Context,
req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {
logrus.Infof("received request to delete volume {%s}", req.VolumeId)
klog.Infof("received request to delete volume {%s}", req.VolumeId)
var (
err error
@ -377,7 +377,7 @@ func (cs *controller) CreateSnapshot(
req *csi.CreateSnapshotRequest,
) (*csi.CreateSnapshotResponse, error) {
logrus.Infof("CreateSnapshot volume %s@%s", req.SourceVolumeId, req.Name)
klog.Infof("CreateSnapshot volume %s@%s", req.SourceVolumeId, req.Name)
snapTimeStamp := time.Now().Unix()
state, err := zfs.GetZFSSnapshotStatus(req.Name)
@ -446,7 +446,7 @@ func (cs *controller) DeleteSnapshot(
req *csi.DeleteSnapshotRequest,
) (*csi.DeleteSnapshotResponse, error) {
logrus.Infof("DeleteSnapshot request for %s", req.SnapshotId)
klog.Infof("DeleteSnapshot request for %s", req.SnapshotId)
// snapshodID is formed as <volname>@<snapname>
// parsing them here

View file

@ -17,9 +17,9 @@ limitations under the License.
package driver
import (
"github.com/Sirupsen/logrus"
"github.com/container-storage-interface/spec/lib/go/csi"
config "github.com/openebs/zfs-localpv/pkg/config"
"k8s.io/klog"
)
// volume can only be published once as
@ -52,7 +52,7 @@ func GetVolumeCapabilityAccessModes() []*csi.VolumeCapability_AccessMode {
var vcams []*csi.VolumeCapability_AccessMode
for _, vcam := range supported {
logrus.Infof("enabling volume access mode: %s", vcam.String())
klog.Infof("enabling volume access mode: %s", vcam.String())
vcams = append(vcams, newVolumeCapabilityAccessMode(vcam))
}
return vcams

View file

@ -17,13 +17,13 @@ limitations under the License.
package driver
import (
"github.com/Sirupsen/logrus"
"math"
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/openebs/zfs-localpv/pkg/builder/volbuilder"
k8sapi "github.com/openebs/zfs-localpv/pkg/client/k8s/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/klog"
zfs "github.com/openebs/zfs-localpv/pkg/zfs"
)
@ -107,16 +107,16 @@ func scheduler(topo *csi.TopologyRequirement, schld string, pool string) string
if topo == nil ||
len(topo.Preferred) == 0 {
logrus.Errorf("scheduler: topology information not provided")
klog.Errorf("scheduler: topology information not provided")
return ""
}
nodelist, err := GetNodeList(topo)
if err != nil {
logrus.Errorf("scheduler: can not get the nodelist err : %v", err.Error())
klog.Errorf("scheduler: can not get the nodelist err : %v", err.Error())
return ""
} else if len(nodelist) == 0 {
logrus.Errorf("scheduler: nodelist is empty")
klog.Errorf("scheduler: nodelist is empty")
return ""
}