refactor(zfspv): renamed watcher to mgmt package

as it does the management task also corrected few logs
and renamed zvol to zfs(as we support zvol and dataset both)

Signed-off-by: Pawan <pawan@mayadata.io>
This commit is contained in:
Pawan 2019-11-26 14:57:06 +05:30 committed by Kiran Mova
parent e953af99cf
commit 523e862159
7 changed files with 27 additions and 27 deletions

View file

@ -19,9 +19,9 @@ package driver
import (
"github.com/Sirupsen/logrus"
"github.com/container-storage-interface/spec/lib/go/csi"
ctrl "github.com/openebs/zfs-localpv/cmd/controller"
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/core/v1alpha1"
"github.com/openebs/zfs-localpv/pkg/builder"
"github.com/openebs/zfs-localpv/pkg/mgmt"
zfs "github.com/openebs/zfs-localpv/pkg/zfs"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
@ -42,9 +42,9 @@ func NewNode(d *CSIDriver) csi.NodeServer {
var ControllerMutex = sync.RWMutex{}
// start the zfsvolume watcher
go func() {
err := ctrl.Start(&ControllerMutex)
err := mgmt.Start(&ControllerMutex)
if err != nil {
logrus.Errorf("Failed to start cstorvolume claim controller: %s", err.Error())
logrus.Fatalf("Failed to start ZFS volume management controller: %s", err.Error())
}
}()

View file

@ -24,7 +24,7 @@ import (
"github.com/openebs/zfs-localpv/pkg/builder"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
zvol "github.com/openebs/zfs-localpv/pkg/zfs"
zfs "github.com/openebs/zfs-localpv/pkg/zfs"
)
// scheduling algorithm constants
@ -41,7 +41,7 @@ func volumeWeightedScheduler(topo *csi.TopologyRequirement, pool string) string
var selected string
zvlist, err := builder.NewKubeclient().
WithNamespace(zvol.OpenEBSNamespace).
WithNamespace(zfs.OpenEBSNamespace).
List(metav1.ListOptions{})
if err != nil {
@ -63,7 +63,7 @@ func volumeWeightedScheduler(topo *csi.TopologyRequirement, pool string) string
// schedule it on the node which has less
// number of volume for the given pool
for _, prf := range topo.Preferred {
node := prf.Segments[zvol.ZFSTopologyKey]
node := prf.Segments[zfs.ZFSTopologyKey]
if volmap[node] < numVol {
selected = node
numVol = volmap[node]
@ -83,7 +83,7 @@ func scheduler(topo *csi.TopologyRequirement, schld string, pool string) string
}
// if there is a single node, schedule it on that
if len(topo.Preferred) == 1 {
return topo.Preferred[0].Segments[zvol.ZFSTopologyKey]
return topo.Preferred[0].Segments[zfs.ZFSTopologyKey]
}
switch schld {