From 6be1a4ff934e5bbcbb8367553645ea03d184097d Mon Sep 17 00:00:00 2001 From: Gaius Date: Fri, 25 Aug 2023 17:43:15 +0800 Subject: [PATCH] feat: add idc and location to ListSchedulers in manager (#2674) Signed-off-by: Gaius --- go.mod | 2 +- go.sum | 4 ++-- manager/rpcserver/manager_server_v2.go | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 2ae0e7e7ff6..b125d9efcdd 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module d7y.io/dragonfly/v2 go 1.20 require ( - d7y.io/api/v2 v2.0.23 + d7y.io/api/v2 v2.0.24 github.com/MysteriousPotato/go-lockable v1.0.0 github.com/RichardKnop/machinery v1.10.6 github.com/Showmax/go-fqdn v1.0.0 diff --git a/go.sum b/go.sum index 9f8589ab3fe..22aa6972e62 100644 --- a/go.sum +++ b/go.sum @@ -50,8 +50,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -d7y.io/api/v2 v2.0.23 h1:s0vDhh5P1jfKO/dee2DhQiUG7eFORVF2/M9O9SLRNQI= -d7y.io/api/v2 v2.0.23/go.mod h1:lwCvFjtRVsyTKsiXfh2W0Jdv+5tQGR/vFj+TknwnusY= +d7y.io/api/v2 v2.0.24 h1:rVtbsGj5065ayMTv41I3ythmazzcEQ+Db/7zsHQ4jwE= +d7y.io/api/v2 v2.0.24/go.mod h1:lwCvFjtRVsyTKsiXfh2W0Jdv+5tQGR/vFj+TknwnusY= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= dmitri.shuralyov.com/gpu/mtl v0.0.0-20201218220906-28db891af037/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= diff --git a/manager/rpcserver/manager_server_v2.go b/manager/rpcserver/manager_server_v2.go index 6ec35d7878a..df059485b0b 100644 --- a/manager/rpcserver/manager_server_v2.go +++ b/manager/rpcserver/manager_server_v2.go @@ -519,7 +519,7 @@ func (s *managerServerV2) ListSchedulers(ctx context.Context, req *managerv2.Lis tmpSchedulerClusters = append(tmpSchedulerClusters, schedulerCluster) } } - log.Debugf("list scheduler clusters %v with hostInfo %#v", getSchedulerClusterNames(tmpSchedulerClusters), req.HostInfo) + log.Debugf("list scheduler clusters %v, idc is %s, location is %s", getSchedulerClusterNames(tmpSchedulerClusters), req.GetIdc(), req.GetLocation()) // Search optimal scheduler clusters. // If searcher can not found candidate scheduler cluster, @@ -528,7 +528,8 @@ func (s *managerServerV2) ListSchedulers(ctx context.Context, req *managerv2.Lis candidateSchedulerClusters []models.SchedulerCluster err error ) - candidateSchedulerClusters, err = s.searcher.FindSchedulerClusters(ctx, tmpSchedulerClusters, req.Ip, req.Hostname, req.HostInfo, logger.CoreLogger) + candidateSchedulerClusters, err = s.searcher.FindSchedulerClusters(ctx, tmpSchedulerClusters, req.Ip, req.Hostname, + map[string]string{searcher.ConditionIDC: req.GetIdc(), searcher.ConditionLocation: req.GetLocation()}, logger.CoreLogger) if err != nil { log.Error(err) metrics.SearchSchedulerClusterFailureCount.WithLabelValues(req.Version, req.Commit).Inc()