chore(refactor): refactor scheduler for ZFS-LocalPV

Signed-off-by: Pawan <pawan@mayadata.io>
This commit is contained in:
Pawan 2020-12-04 18:00:08 +05:30 committed by Kiran Mova
parent 30a7f2317e
commit e1e8aa5839
3 changed files with 91 additions and 54 deletions

View file

@ -33,6 +33,7 @@ import (
errors "github.com/openebs/zfs-localpv/pkg/common/errors"
"github.com/openebs/zfs-localpv/pkg/common/helpers"
csipayload "github.com/openebs/zfs-localpv/pkg/response"
schd "github.com/openebs/zfs-localpv/pkg/scheduler"
analytics "github.com/openebs/zfs-localpv/pkg/usage"
zfs "github.com/openebs/zfs-localpv/pkg/zfs"
)
@ -126,7 +127,13 @@ func CreateZFSVolume(req *csi.CreateVolumeRequest) (string, error) {
vtype := zfs.GetVolumeType(fstype)
selected := scheduler(req.AccessibilityRequirements, schld, pool)
nmap, err := getNodeMap(schld, pool)
if err != nil {
return "", status.Errorf(codes.Internal, "get node map failed : %s", err.Error())
}
// run the scheduler
selected := schd.Scheduler(req, nmap)
if len(selected) == 0 {
return "", status.Error(codes.Internal, "scheduler failed")