Finalisation de la migration d'une VM
This commit is contained in:
parent
f0a191c9a4
commit
c69ec9d70c
@ -6,7 +6,9 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"go.uber.org/zap"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
"libvirt.org/go/libvirt"
|
"libvirt.org/go/libvirt"
|
||||||
@ -20,6 +22,7 @@ import (
|
|||||||
type Domain struct {
|
type Domain struct {
|
||||||
Config *config.Config
|
Config *config.Config
|
||||||
Store *raft.Store
|
Store *raft.Store
|
||||||
|
Logger *zap.Logger
|
||||||
proto.UnimplementedDomainServer
|
proto.UnimplementedDomainServer
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +46,7 @@ func (d *Domain) connectNode(NodeId string) (*libvirt.Connect, error) {
|
|||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Domain) connectDomain(ctx context.Context, domainID string) (*libvirt.Connect, error) {
|
func (d *Domain) connectDomain(ctx context.Context, domainID string) (string, *libvirt.Connect, error) {
|
||||||
dom, _ := d.Get(ctx, &proto.DomainListRequest{
|
dom, _ := d.Get(ctx, &proto.DomainListRequest{
|
||||||
DomainId: domainID,
|
DomainId: domainID,
|
||||||
})
|
})
|
||||||
@ -52,7 +55,9 @@ func (d *Domain) connectDomain(ctx context.Context, domainID string) (*libvirt.C
|
|||||||
cluster, _ := d.Store.Get("/etc/libvirt/cluster")
|
cluster, _ := d.Store.Get("/etc/libvirt/cluster")
|
||||||
json.Unmarshal(cluster, &jCluster)
|
json.Unmarshal(cluster, &jCluster)
|
||||||
|
|
||||||
return d.connectNode(dom.NodeId)
|
c, err := d.connectNode(dom.NodeId)
|
||||||
|
|
||||||
|
return dom.NodeId, c, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Domain) List(ctx context.Context, in *proto.DomainListAllRequest) (*proto.DomainListAllResponse, error) {
|
func (d *Domain) List(ctx context.Context, in *proto.DomainListAllRequest) (*proto.DomainListAllResponse, error) {
|
||||||
@ -111,10 +116,9 @@ func (d *Domain) Get(ctx context.Context, in *proto.DomainListRequest) (*proto.D
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (d *Domain) Migrate(in *proto.DomainMigrateRequest, stream proto.Domain_MigrateServer) error {
|
func (d *Domain) Migrate(in *proto.DomainMigrateRequest, stream proto.Domain_MigrateServer) error {
|
||||||
libvirt.EventRegisterDefaultImpl()
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
c, err := d.connectDomain(ctx, in.DomainId)
|
nodeID, c, err := d.connectDomain(ctx, in.DomainId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return status.Errorf(codes.Internal, "Connexion error to libvirt")
|
return status.Errorf(codes.Internal, "Connexion error to libvirt")
|
||||||
}
|
}
|
||||||
@ -129,53 +133,76 @@ func (d *Domain) Migrate(in *proto.DomainMigrateRequest, stream proto.Domain_Mig
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return status.Errorf(codes.Internal, "Connexion error to libvirt %v", err)
|
return status.Errorf(codes.Internal, "Connexion error to libvirt %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := s.GetTopNode(1)
|
res, err := s.GetTopNode(1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return status.Errorf(codes.Internal, "Connexion error to libvirt %v", err)
|
return status.Errorf(codes.Internal, "Connexion error to libvirt %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
eventCallback := func(cc *libvirt.Connect, dd *libvirt.Domain, ee *libvirt.DomainEventMigrationIteration) {
|
|
||||||
// Créer et envoyer le message de progression de la migration
|
|
||||||
stream.Send(&proto.DomainMigrateResponse{
|
|
||||||
Percentage: int32(ee.Iteration),
|
|
||||||
})
|
|
||||||
|
|
||||||
t, _ := dd.QemuMonitorCommand("{\"execute\": \"query-migrate\"}", libvirt.DOMAIN_QEMU_MONITOR_COMMAND_DEFAULT)
|
|
||||||
fmt.Printf("%v\n", t)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Enregistrer l'événement de migration
|
|
||||||
c.DomainEventMigrationIterationRegister(dom, eventCallback)
|
|
||||||
|
|
||||||
ctx1, cancel := context.WithCancel(context.Background())
|
ctx1, cancel := context.WithCancel(context.Background())
|
||||||
|
ch := make(chan []byte)
|
||||||
|
|
||||||
|
migrate := func(cancel context.CancelFunc) {
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
migrate := func() error {
|
|
||||||
c_new, err := d.connectNode(res[0].NodeID)
|
c_new, err := d.connectNode(res[0].NodeID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cancel()
|
d.Logger.Sugar().Infof("Connexion error to libvirt %v", err.Error())
|
||||||
return status.Errorf(codes.Internal, "Connexion error to libvirt %v", err)
|
return
|
||||||
}
|
}
|
||||||
defer c_new.Close()
|
defer c_new.Close()
|
||||||
|
|
||||||
_, err = dom.Migrate(c_new, libvirt.MIGRATE_LIVE|libvirt.MIGRATE_PERSIST_DEST|libvirt.MIGRATE_UNDEFINE_SOURCE, "", "", 0)
|
new_dom, err := dom.Migrate(c_new, libvirt.MIGRATE_LIVE|libvirt.MIGRATE_PERSIST_DEST|libvirt.MIGRATE_UNDEFINE_SOURCE, "", "", 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cancel()
|
d.Logger.Sugar().Infof("Migration error %v", err.Error())
|
||||||
return status.Errorf(codes.Internal, "Migration error %v", err)
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
cancel()
|
newDomConfig, _ := new_dom.GetXMLDesc(libvirt.DOMAIN_XML_INACTIVE)
|
||||||
|
newDomState, _, _ := new_dom.GetState()
|
||||||
|
|
||||||
return nil
|
new, _ := json.Marshal(raft.DomainStore{
|
||||||
|
Config: newDomConfig,
|
||||||
|
State: int(newDomState),
|
||||||
|
Migrate: false,
|
||||||
|
})
|
||||||
|
|
||||||
|
ch <- new
|
||||||
}
|
}
|
||||||
|
|
||||||
go migrate()
|
go migrate(cancel)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
|
case result := <-ch:
|
||||||
|
d.Store.Set(fmt.Sprintf("/etc/libvirt/qemu/%s/%s", res[0].NodeID, in.DomainId), result)
|
||||||
|
d.Store.Delete(fmt.Sprintf("/etc/libvirt/qemu/%s/%s", nodeID, in.DomainId))
|
||||||
case <-ctx1.Done():
|
case <-ctx1.Done():
|
||||||
return nil
|
return nil
|
||||||
default:
|
default:
|
||||||
libvirt.EventRunDefaultImpl()
|
var queryMigrate struct {
|
||||||
|
Return struct {
|
||||||
|
RAM struct {
|
||||||
|
Total float64 `json:"total"`
|
||||||
|
Remaining float64 `json:"remaining"`
|
||||||
|
} `json:"ram"`
|
||||||
|
} `json:"return"`
|
||||||
|
}
|
||||||
|
|
||||||
|
t, _ := dom.QemuMonitorCommand("{\"execute\": \"query-migrate\"}", libvirt.DOMAIN_QEMU_MONITOR_COMMAND_DEFAULT)
|
||||||
|
if err := json.Unmarshal([]byte(t), &queryMigrate); err == nil {
|
||||||
|
progress := (1 - (queryMigrate.Return.RAM.Remaining / queryMigrate.Return.RAM.Total)) * 100
|
||||||
|
|
||||||
|
if progress > 0 {
|
||||||
|
stream.Send(&proto.DomainMigrateResponse{
|
||||||
|
Percentage: float32(progress),
|
||||||
|
})
|
||||||
|
|
||||||
|
d.Logger.Sugar().Infof("%s Progression: %.2f%%\n", nodeID, progress)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
time.Sleep(500 * time.Millisecond)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,8 @@ package domain
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"deevirt.fr/compute/pkg/api/proto"
|
"deevirt.fr/compute/pkg/api/proto"
|
||||||
"deevirt.fr/compute/pkg/api/raft"
|
|
||||||
"libvirt.org/go/libvirt"
|
"libvirt.org/go/libvirt"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -23,7 +20,7 @@ type Events struct {
|
|||||||
type EventsDetail map[string]string
|
type EventsDetail map[string]string
|
||||||
|
|
||||||
func (d *Domain) Event(ctx context.Context, req *proto.DomainEventRequest) (*proto.DomainEventResponse, error) {
|
func (d *Domain) Event(ctx context.Context, req *proto.DomainEventRequest) (*proto.DomainEventResponse, error) {
|
||||||
var events Events
|
/*var events Events
|
||||||
|
|
||||||
err := json.Unmarshal(req.Event, &events)
|
err := json.Unmarshal(req.Event, &events)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -697,8 +697,7 @@ type DomainMigrateResponse struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Percentage int32 `protobuf:"varint,1,opt,name=percentage,proto3" json:"percentage,omitempty"`
|
Percentage float32 `protobuf:"fixed32,1,opt,name=percentage,proto3" json:"percentage,omitempty"`
|
||||||
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DomainMigrateResponse) Reset() {
|
func (x *DomainMigrateResponse) Reset() {
|
||||||
@ -733,20 +732,13 @@ func (*DomainMigrateResponse) Descriptor() ([]byte, []int) {
|
|||||||
return file_proto_domain_proto_rawDescGZIP(), []int{13}
|
return file_proto_domain_proto_rawDescGZIP(), []int{13}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DomainMigrateResponse) GetPercentage() int32 {
|
func (x *DomainMigrateResponse) GetPercentage() float32 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Percentage
|
return x.Percentage
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DomainMigrateResponse) GetMessage() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Message
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type DomainPowerRequest struct {
|
type DomainPowerRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
@ -979,80 +971,78 @@ var file_proto_domain_proto_rawDesc = []byte{
|
|||||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x33, 0x0a, 0x14, 0x44, 0x6f, 0x6d, 0x61,
|
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x33, 0x0a, 0x14, 0x44, 0x6f, 0x6d, 0x61,
|
||||||
0x69, 0x6e, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
0x69, 0x6e, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||||
0x12, 0x1b, 0x0a, 0x09, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20,
|
0x12, 0x1b, 0x0a, 0x09, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20,
|
||||||
0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x22, 0x51, 0x0a,
|
0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x22, 0x37, 0x0a,
|
||||||
0x15, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65,
|
0x15, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65,
|
||||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e,
|
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e,
|
||||||
0x74, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x70, 0x65, 0x72, 0x63,
|
0x74, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x70, 0x65, 0x72, 0x63,
|
||||||
0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
|
0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x22, 0x57, 0x0a, 0x12, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e,
|
||||||
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
|
0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x13, 0x0a, 0x05,
|
||||||
0x22, 0x57, 0x0a, 0x12, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52,
|
0x76, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x76, 0x6d, 0x49,
|
||||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x13, 0x0a, 0x05, 0x76, 0x6d, 0x5f, 0x69, 0x64, 0x18,
|
0x64, 0x12, 0x2c, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||||
0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x76, 0x6d, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x06, 0x61,
|
0x0e, 0x32, 0x14, 0x2e, 0x64, 0x65, 0x65, 0x76, 0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61,
|
||||||
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x64, 0x65,
|
0x69, 0x6e, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22,
|
||||||
0x65, 0x76, 0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x50, 0x6f, 0x77, 0x65,
|
0x15, 0x0a, 0x13, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65,
|
||||||
0x72, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x15, 0x0a, 0x13, 0x44, 0x6f, 0x6d,
|
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3a, 0x0a, 0x23, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e,
|
||||||
0x61, 0x69, 0x6e, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x43,
|
||||||
0x22, 0x3a, 0x0a, 0x23, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
|
0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x13, 0x0a,
|
||||||
0x73, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x43, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65,
|
0x05, 0x76, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x76, 0x6d,
|
||||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x13, 0x0a, 0x05, 0x76, 0x6d, 0x5f, 0x69, 0x64,
|
0x49, 0x64, 0x22, 0x38, 0x0a, 0x24, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x44, 0x65, 0x76, 0x69,
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x76, 0x6d, 0x49, 0x64, 0x22, 0x38, 0x0a, 0x24,
|
0x63, 0x65, 0x73, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x43, 0x6f, 0x6e, 0x73, 0x6f,
|
||||||
0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x47, 0x72, 0x61,
|
0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72,
|
||||||
0x70, 0x68, 0x69, 0x63, 0x73, 0x43, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70,
|
0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x69, 0x2a, 0x70, 0x0a, 0x0b,
|
||||||
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x69, 0x18, 0x01, 0x20, 0x01, 0x28,
|
0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x0d, 0x0a, 0x09, 0x55,
|
||||||
0x09, 0x52, 0x03, 0x75, 0x72, 0x69, 0x2a, 0x70, 0x0a, 0x0b, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e,
|
0x4e, 0x44, 0x45, 0x46, 0x49, 0x4e, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x54,
|
||||||
0x50, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x4e, 0x44, 0x45, 0x46, 0x49, 0x4e,
|
0x41, 0x52, 0x54, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x52, 0x45, 0x42, 0x4f, 0x4f, 0x54, 0x10,
|
||||||
0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x54, 0x41, 0x52, 0x54, 0x10, 0x01, 0x12,
|
0x02, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x48, 0x55, 0x54, 0x44, 0x4f, 0x57, 0x4e, 0x10, 0x03, 0x12,
|
||||||
0x0a, 0x0a, 0x06, 0x52, 0x45, 0x42, 0x4f, 0x4f, 0x54, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x53,
|
0x09, 0x0a, 0x05, 0x50, 0x41, 0x55, 0x53, 0x45, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x52, 0x45,
|
||||||
0x48, 0x55, 0x54, 0x44, 0x4f, 0x57, 0x4e, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x50, 0x41, 0x55,
|
0x53, 0x55, 0x4d, 0x45, 0x10, 0x05, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x45, 0x53, 0x45, 0x54, 0x10,
|
||||||
0x53, 0x45, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x52, 0x45, 0x53, 0x55, 0x4d, 0x45, 0x10, 0x05,
|
0x06, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x45, 0x53, 0x54, 0x52, 0x4f, 0x59, 0x10, 0x07, 0x32, 0xc8,
|
||||||
0x12, 0x09, 0x0a, 0x05, 0x52, 0x45, 0x53, 0x45, 0x54, 0x10, 0x06, 0x12, 0x0b, 0x0a, 0x07, 0x44,
|
0x04, 0x0a, 0x06, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x47, 0x0a, 0x04, 0x4c, 0x69, 0x73,
|
||||||
0x45, 0x53, 0x54, 0x52, 0x4f, 0x59, 0x10, 0x07, 0x32, 0xc8, 0x04, 0x0a, 0x06, 0x44, 0x6f, 0x6d,
|
0x74, 0x12, 0x1d, 0x2e, 0x64, 0x65, 0x65, 0x76, 0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61,
|
||||||
0x61, 0x69, 0x6e, 0x12, 0x47, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1d, 0x2e, 0x64, 0x65,
|
0x69, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||||
0x65, 0x76, 0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x4c, 0x69, 0x73, 0x74,
|
0x1a, 0x1e, 0x2e, 0x64, 0x65, 0x65, 0x76, 0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69,
|
||||||
0x41, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x64, 0x65, 0x65,
|
0x6e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||||
0x76, 0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x41,
|
0x22, 0x00, 0x12, 0x40, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1a, 0x2e, 0x64, 0x65, 0x65, 0x76,
|
||||||
0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x03,
|
0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65,
|
||||||
0x47, 0x65, 0x74, 0x12, 0x1a, 0x2e, 0x64, 0x65, 0x65, 0x76, 0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f,
|
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x64, 0x65, 0x65, 0x76, 0x69, 0x72, 0x74, 0x2e,
|
||||||
0x6d, 0x61, 0x69, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||||
0x1b, 0x2e, 0x64, 0x65, 0x65, 0x76, 0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e,
|
0x73, 0x65, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x1c,
|
||||||
0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x47,
|
0x2e, 0x64, 0x65, 0x65, 0x76, 0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x43,
|
||||||
0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x1c, 0x2e, 0x64, 0x65, 0x65, 0x76, 0x69,
|
0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x64,
|
||||||
0x72, 0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52,
|
0x65, 0x65, 0x76, 0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x43, 0x72, 0x65,
|
||||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x64, 0x65, 0x65, 0x76, 0x69, 0x72, 0x74,
|
0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x47, 0x0a,
|
||||||
0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73,
|
0x06, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x1c, 0x2e, 0x64, 0x65, 0x65, 0x76, 0x69, 0x72,
|
||||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74,
|
0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65,
|
||||||
0x65, 0x12, 0x1c, 0x2e, 0x64, 0x65, 0x65, 0x76, 0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61,
|
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x64, 0x65, 0x65, 0x76, 0x69, 0x72, 0x74, 0x2e,
|
||||||
0x69, 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70,
|
||||||
0x1d, 0x2e, 0x64, 0x65, 0x65, 0x76, 0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e,
|
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65,
|
||||||
0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00,
|
0x12, 0x1c, 0x2e, 0x64, 0x65, 0x65, 0x76, 0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69,
|
||||||
0x12, 0x47, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1c, 0x2e, 0x64, 0x65, 0x65,
|
0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d,
|
||||||
0x76, 0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74,
|
0x2e, 0x64, 0x65, 0x65, 0x76, 0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x44,
|
||||||
0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x64, 0x65, 0x65, 0x76, 0x69,
|
0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12,
|
||||||
0x72, 0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52,
|
0x4c, 0x0a, 0x07, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x12, 0x1d, 0x2e, 0x64, 0x65, 0x65,
|
||||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4c, 0x0a, 0x07, 0x4d, 0x69, 0x67,
|
0x76, 0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x4d, 0x69, 0x67, 0x72, 0x61,
|
||||||
0x72, 0x61, 0x74, 0x65, 0x12, 0x1d, 0x2e, 0x64, 0x65, 0x65, 0x76, 0x69, 0x72, 0x74, 0x2e, 0x44,
|
0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x64, 0x65, 0x65, 0x76,
|
||||||
0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75,
|
0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74,
|
||||||
0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x64, 0x65, 0x65, 0x76, 0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f,
|
0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x44, 0x0a,
|
||||||
0x6d, 0x61, 0x69, 0x6e, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
0x05, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x1b, 0x2e, 0x64, 0x65, 0x65, 0x76, 0x69, 0x72, 0x74,
|
||||||
0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x44, 0x0a, 0x05, 0x50, 0x6f, 0x77, 0x65, 0x72,
|
0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75,
|
||||||
0x12, 0x1b, 0x2e, 0x64, 0x65, 0x65, 0x76, 0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69,
|
|
||||||
0x6e, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e,
|
|
||||||
0x64, 0x65, 0x65, 0x76, 0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x50, 0x6f,
|
|
||||||
0x77, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x44, 0x0a,
|
|
||||||
0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x2e, 0x64, 0x65, 0x65, 0x76, 0x69, 0x72, 0x74,
|
|
||||||
0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75,
|
|
||||||
0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x64, 0x65, 0x65, 0x76, 0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f,
|
0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x64, 0x65, 0x65, 0x76, 0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f,
|
||||||
0x6d, 0x61, 0x69, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
0x6d, 0x61, 0x69, 0x6e, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||||
0x65, 0x22, 0x00, 0x32, 0x81, 0x01, 0x0a, 0x15, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x44, 0x65,
|
0x65, 0x22, 0x00, 0x12, 0x44, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x2e, 0x64,
|
||||||
0x76, 0x69, 0x63, 0x65, 0x73, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x12, 0x68, 0x0a,
|
0x65, 0x65, 0x76, 0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x45, 0x76, 0x65,
|
||||||
0x07, 0x43, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x12, 0x2c, 0x2e, 0x64, 0x65, 0x65, 0x76, 0x69,
|
0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x64, 0x65, 0x65, 0x76,
|
||||||
0x72, 0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73,
|
0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52,
|
||||||
0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x43, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x52,
|
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x32, 0x81, 0x01, 0x0a, 0x15, 0x44, 0x6f,
|
||||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x64, 0x65, 0x65, 0x76, 0x69, 0x72, 0x74,
|
0x6d, 0x61, 0x69, 0x6e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x47, 0x72, 0x61, 0x70, 0x68,
|
||||||
0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x47, 0x72,
|
0x69, 0x63, 0x73, 0x12, 0x68, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x12, 0x2c,
|
||||||
0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x43, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x73,
|
0x2e, 0x64, 0x65, 0x65, 0x76, 0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x44,
|
||||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x70, 0x72, 0x6f,
|
0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x43, 0x6f,
|
||||||
0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x64,
|
||||||
|
0x65, 0x65, 0x76, 0x69, 0x72, 0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x44, 0x65, 0x76,
|
||||||
|
0x69, 0x63, 0x65, 0x73, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x43, 0x6f, 0x6e, 0x73,
|
||||||
|
0x6f, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x09, 0x5a,
|
||||||
|
0x07, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -76,8 +76,7 @@ message DomainMigrateRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message DomainMigrateResponse {
|
message DomainMigrateResponse {
|
||||||
int32 percentage = 1;
|
float percentage = 1;
|
||||||
string message = 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum DomainPower {
|
enum DomainPower {
|
||||||
|
@ -8,6 +8,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"go.uber.org/zap"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/credentials"
|
"google.golang.org/grpc/credentials"
|
||||||
"google.golang.org/grpc/reflection"
|
"google.golang.org/grpc/reflection"
|
||||||
@ -47,7 +48,7 @@ func createGRPCServer(conf *config.Config) *grpc.Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Server() {
|
func Server() {
|
||||||
//ctx := context.Background()
|
logger, _ := zap.NewProduction()
|
||||||
|
|
||||||
// Récupération de la configuration deevirt
|
// Récupération de la configuration deevirt
|
||||||
conf, err := config.New()
|
conf, err := config.New()
|
||||||
@ -75,6 +76,7 @@ func Server() {
|
|||||||
pb.RegisterDomainServer(s, &domain.Domain{
|
pb.RegisterDomainServer(s, &domain.Domain{
|
||||||
Config: conf,
|
Config: conf,
|
||||||
Store: r,
|
Store: r,
|
||||||
|
Logger: logger,
|
||||||
})
|
})
|
||||||
tm.Register(s)
|
tm.Register(s)
|
||||||
//leaderhealth.Setup(r, s, []string{"Example"})
|
//leaderhealth.Setup(r, s, []string{"Example"})
|
||||||
|
@ -23,7 +23,7 @@ func (s *Scheduler) GetAlertCluster() ([]AlertsCluster, error) {
|
|||||||
for _, res := range res.(model.Vector) {
|
for _, res := range res.(model.Vector) {
|
||||||
data = append(data, AlertsCluster{
|
data = append(data, AlertsCluster{
|
||||||
Severity: string(res.Metric["Severity"]),
|
Severity: string(res.Metric["Severity"]),
|
||||||
Score: uint8(res.Value),
|
Score: int(res.Value),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ func (s *Scheduler) GetAlertNodes() ([]AlertsNode, error) {
|
|||||||
data = append(data, AlertsNode{
|
data = append(data, AlertsNode{
|
||||||
NodeID: string(res.Metric["NodeID"]),
|
NodeID: string(res.Metric["NodeID"]),
|
||||||
Severity: string(res.Metric["Severity"]),
|
Severity: string(res.Metric["Severity"]),
|
||||||
Score: uint8(res.Value),
|
Score: int(res.Value),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,18 +22,18 @@ type Scheduler struct {
|
|||||||
|
|
||||||
type TopNode struct {
|
type TopNode struct {
|
||||||
NodeID string
|
NodeID string
|
||||||
Score uint8
|
Score int
|
||||||
}
|
}
|
||||||
|
|
||||||
type AlertsCluster struct {
|
type AlertsCluster struct {
|
||||||
Severity string
|
Severity string
|
||||||
Score uint8
|
Score int
|
||||||
}
|
}
|
||||||
|
|
||||||
type AlertsNode struct {
|
type AlertsNode struct {
|
||||||
NodeID string
|
NodeID string
|
||||||
Severity string
|
Severity string
|
||||||
Score uint8
|
Score int
|
||||||
}
|
}
|
||||||
|
|
||||||
func New() (*Scheduler, error) {
|
func New() (*Scheduler, error) {
|
||||||
@ -82,8 +82,8 @@ func (s *Scheduler) GetTopNode(number int) ([]TopNode, error) {
|
|||||||
data := []TopNode{}
|
data := []TopNode{}
|
||||||
for _, res := range res.(model.Vector) {
|
for _, res := range res.(model.Vector) {
|
||||||
data = append(data, TopNode{
|
data = append(data, TopNode{
|
||||||
NodeID: string(res.Metric["NodeID"]),
|
NodeID: string(res.Metric["node_id"]),
|
||||||
Score: uint8(res.Value),
|
Score: int(res.Value),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user