From 257698bc0a9e8266d09842e058bf66d4190fccb1 Mon Sep 17 00:00:00 2001 From: niconicodex Date: Thu, 24 Feb 2022 09:57:00 +0900 Subject: [PATCH] Merged Origin repo --- .gitlab-ci.yml | 2 +- .gitmodules | 4 - README.md | 4 +- driver/selectorDriver.go | 124 ++++----- end/mainEnd.go | 14 +- http/queryURLEncoder.go | 46 ++-- init/mainInit.go | 1 - lib/config/configParser.go | 10 +- lib/config/violinSchedulerConfig.go | 26 +- lib/scheduler/nodeScheduler.go | 374 ++++++++++++++-------------- main.go | 62 +++-- model/node.go | 1 + model/quota.go | 18 +- model/serverNode.go | 28 +-- model/subnet.go | 52 ++-- 15 files changed, 381 insertions(+), 385 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 06bb086..33693f2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -68,4 +68,4 @@ service_run: - echo "Finished" only: - master - - feature/dev \ No newline at end of file + - feature/dev diff --git a/.gitmodules b/.gitmodules index b5e7359..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +0,0 @@ -[submodule "hcloud-badge"] - path = hcloud-badge - url = ssh://git@210.207.104.150:8102/iitp-sds/hcloud-badge.git - diff --git a/README.md b/README.md index b517825..b961120 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# hcc-violin_scheduler -Hcloud Classic Server Deploy Scheduler +# hcc-violin_scheduler +Hcloud Classic Server Deploy Scheduler diff --git a/driver/selectorDriver.go b/driver/selectorDriver.go index dd2ac7c..1eb92a2 100644 --- a/driver/selectorDriver.go +++ b/driver/selectorDriver.go @@ -1,62 +1,62 @@ -package driver - -import ( - "fmt" - "hcc/violin-scheduler/data" - "hcc/violin-scheduler/lib/logger" - "hcc/violin-scheduler/lib/scheduler" - "hcc/violin-scheduler/model" - "time" -) - -// ScheduleNodes : Scheduling nodes -func ScheduleNodes(args map[string]interface{}) (interface{}, error) { - listNodeData, err := AllNodes() - nodes := listNodeData.(data.ListNodeData).Data.ListNode - var userQuota model.Quota - userQuota.ServerUUID = args["server_uuid"].(string) - userQuota.CPU = args["cpu"].(int) - userQuota.Memory = args["memory"].(int) - userQuota.NumberOfNodes = args["nr_node"].(int) - - if err != nil { - logger.Logger.Print(err) - return nil, err - } - var testlist model.ScheduledNodes - startTime := time.Now() - selectedNodeList, err := scheduler.NodeListParser(nodes, userQuota) - for _, selectedNodeUUID := range selectedNodeList { - testlist.NodeList = append(testlist.NodeList, selectedNodeUUID) - } - var returnData data.ScheduledNodeData - returnData.Data.ScheduledNode = testlist - elapsedTime := time.Since((startTime)) - logger.Logger.Println("[Create Server Scheduling Action]\nServer UUID : ", args["server_uuid"], " Scheduling Elapse Time : ", elapsedTime) - return returnData.Data.ScheduledNode, err -} - -func TestSchedule(args map[string]interface{}) (interface{}, error) { - listNodeData, err := AllNodes() - nodes := listNodeData.(data.ListNodeData).Data.ListNode - var userQuota model.Quota - userQuota.ServerUUID = args["server_uuid"].(string) - userQuota.CPU = args["cpu"].(int) - userQuota.Memory = args["memory"].(int) - userQuota.NumberOfNodes = args["nr_node"].(int) - - if err != nil { - logger.Logger.Print(err) - return nil, err - } - var testlist model.ScheduledNodes - startTime := time.Now() - selectedNodeList, err := scheduler.NodeListParser(nodes, userQuota) - for _, selectedNodeUUID := range selectedNodeList { - testlist.NodeList = append(testlist.NodeList, selectedNodeUUID) - fmt.Println("nodelist.NodeList: ", testlist.NodeList) - } - elapsedTime := time.Since((startTime)) - logger.Logger.Println("[Create Server Scheduling Action]\nServer UUID : ", args["server_uuid"], " Scheduling Elapse Time : ", elapsedTime) - return testlist.NodeList, err -} +package driver + +import ( + "fmt" + "hcc/violin-scheduler/data" + "hcc/violin-scheduler/lib/logger" + "hcc/violin-scheduler/lib/scheduler" + "hcc/violin-scheduler/model" + "time" +) + +// ScheduleNodes : Scheduling nodes +func ScheduleNodes(args map[string]interface{}) (interface{}, error) { + listNodeData, err := AllNodes() + nodes := listNodeData.(data.ListNodeData).Data.ListNode + var userQuota model.Quota + userQuota.ServerUUID = args["server_uuid"].(string) + userQuota.CPU = args["cpu"].(int) + userQuota.Memory = args["memory"].(int) + userQuota.NumberOfNodes = args["nr_node"].(int) + + if err != nil { + logger.Logger.Print(err) + return nil, err + } + var testlist model.ScheduledNodes + startTime := time.Now() + selectedNodeList, err := scheduler.NodeListParser(nodes, userQuota) + for _, selectedNodeUUID := range selectedNodeList { + testlist.NodeList = append(testlist.NodeList, selectedNodeUUID) + } + var returnData data.ScheduledNodeData + returnData.Data.ScheduledNode = testlist + elapsedTime := time.Since((startTime)) + logger.Logger.Println("[Create Server Scheduling Action]\nServer UUID : ", args["server_uuid"], " Scheduling Elapse Time : ", elapsedTime) + return returnData.Data.ScheduledNode, err +} + +func TestSchedule(args map[string]interface{}) (interface{}, error) { + listNodeData, err := AllNodes() + nodes := listNodeData.(data.ListNodeData).Data.ListNode + var userQuota model.Quota + userQuota.ServerUUID = args["server_uuid"].(string) + userQuota.CPU = args["cpu"].(int) + userQuota.Memory = args["memory"].(int) + userQuota.NumberOfNodes = args["nr_node"].(int) + + if err != nil { + logger.Logger.Print(err) + return nil, err + } + var testlist model.ScheduledNodes + startTime := time.Now() + selectedNodeList, err := scheduler.NodeListParser(nodes, userQuota) + for _, selectedNodeUUID := range selectedNodeList { + testlist.NodeList = append(testlist.NodeList, selectedNodeUUID) + fmt.Println("nodelist.NodeList: ", testlist.NodeList) + } + elapsedTime := time.Since((startTime)) + logger.Logger.Println("[Create Server Scheduling Action]\nServer UUID : ", args["server_uuid"], " Scheduling Elapse Time : ", elapsedTime) + return testlist.NodeList, err +} diff --git a/end/mainEnd.go b/end/mainEnd.go index 8f2d630..f8498e1 100644 --- a/end/mainEnd.go +++ b/end/mainEnd.go @@ -1,7 +1,7 @@ -package end - -// MainEnd : Main ending function -func MainEnd() { - // mysqlEnd() - loggerEnd() -} +package end + +// MainEnd : Main ending function +func MainEnd() { + // mysqlEnd() + loggerEnd() +} diff --git a/http/queryURLEncoder.go b/http/queryURLEncoder.go index 9b5e3c2..6184a32 100644 --- a/http/queryURLEncoder.go +++ b/http/queryURLEncoder.go @@ -1,23 +1,23 @@ -package http - -import ( - "net/url" - "strings" -) - -func compatibleRFC3986Encode(str string) string { - resultStr := str - resultStr = strings.Replace(resultStr, "+", "%20", -1) - return resultStr -} - -func queryURLEncoder(queryString string) string { - params := url.Values{ - "query_string": {queryString}, - } - - urlEncode := compatibleRFC3986Encode(params.Encode()) - urlEncode = urlEncode[len("query_string="):] - - return urlEncode -} +package http + +import ( + "net/url" + "strings" +) + +func compatibleRFC3986Encode(str string) string { + resultStr := str + resultStr = strings.Replace(resultStr, "+", "%20", -1) + return resultStr +} + +func queryURLEncoder(queryString string) string { + params := url.Values{ + "query_string": {queryString}, + } + + urlEncode := compatibleRFC3986Encode(params.Encode()) + urlEncode = urlEncode[len("query_string="):] + + return urlEncode +} diff --git a/init/mainInit.go b/init/mainInit.go index 1180e05..bec09d2 100644 --- a/init/mainInit.go +++ b/init/mainInit.go @@ -7,7 +7,6 @@ import ( // MainInit : Main initialization function func MainInit() error { - err := loggerInit() if err != nil { return err diff --git a/lib/config/configParser.go b/lib/config/configParser.go index d3ea33e..aef7d93 100644 --- a/lib/config/configParser.go +++ b/lib/config/configParser.go @@ -6,9 +6,11 @@ import ( "github.com/Terry-Mao/goconf" ) -var conf = goconf.New() -var config = schedulerConfig{} -var err error +var ( + conf = goconf.New() + config = schedulerConfig{} + err error +) func parseMysql() { config.MysqlConfig = conf.Get("mysql") @@ -43,7 +45,7 @@ func parseMysql() { } } -//Will be Deprecated +// Will be Deprecated func parseHTTP() { config.HTTPConfig = conf.Get("http") if config.HTTPConfig == nil { diff --git a/lib/config/violinSchedulerConfig.go b/lib/config/violinSchedulerConfig.go index c23afee..919c711 100644 --- a/lib/config/violinSchedulerConfig.go +++ b/lib/config/violinSchedulerConfig.go @@ -1,13 +1,13 @@ -package config - -import "github.com/Terry-Mao/goconf" - -var configLocation = "/etc/hcc/violin-scheduler/violin-scheduler.conf" - -type schedulerConfig struct { - MysqlConfig *goconf.Section - HTTPConfig *goconf.Section - RabbitMQConfig *goconf.Section - FluteConfig *goconf.Section - GrpcConfig *goconf.Section -} +package config + +import "github.com/Terry-Mao/goconf" + +var configLocation = "/etc/hcc/violin-scheduler/violin-scheduler.conf" + +type schedulerConfig struct { + MysqlConfig *goconf.Section + HTTPConfig *goconf.Section + RabbitMQConfig *goconf.Section + FluteConfig *goconf.Section + GrpcConfig *goconf.Section +} diff --git a/lib/scheduler/nodeScheduler.go b/lib/scheduler/nodeScheduler.go index ca85d8f..f60998d 100644 --- a/lib/scheduler/nodeScheduler.go +++ b/lib/scheduler/nodeScheduler.go @@ -1,187 +1,187 @@ -package scheduler - -import ( - "errors" - "hcc/violin-scheduler/lib/logger" - "hcc/violin-scheduler/model" - "sort" - "strconv" - "strings" -) - -type quotaSpec struct { - CPU int - Mem int - NumOfNodes int // End of bmc ip address -} - -type PathStatus struct { - CPU int - Mem int - Depth int - IsFind bool - NavigatePath []int -} -type nodeInfo struct { - NodeUUID string - CPU int - Mem int - NodeOrder int // End of bmc ip address -} - -type keyValue struct { - nodemap map[string]nodeInfo -} - -var checkPathStatus PathStatus - -type Weighting []*nodeInfo - -func (a Weighting) Len() int { return len(a) } -func (a Weighting) Swap(i, j int) { a[i], a[j] = a[j], a[i] } -func (a Weighting) Less(i, j int) bool { return a[i].NodeOrder < a[j].NodeOrder } - -func NodeListParser(nodes []model.Node, userquota model.Quota) ([]string, error) { - var nodecount int = 0 - var nodeT = map[int]*nodeInfo{} - // logger.Logger.Println("nodeListParser (%d): \n", len(nodes), nodes) - for index := 0; index < len(nodes); index++ { - // Later, Please Check Selected node limit equal or less than nodecount - if nodes[index].Active == 0 && nodes[index].ServerUUID == "" { - SetValue(nodeT, nodes[index].UUID, (nodes[index].CPUCores), nodes[index].Memory, nodecount, IPsplitToInt(nodes[index].BmcIP)) - nodecount++ - } - } - if userquota.NumberOfNodes == 0 { - userquota.NumberOfNodes = nodecount + 1 - } - for i, words := range nodeT { - logger.Logger.Println(i, words.NodeUUID) - } - - tmparr := make([]*nodeInfo, 0, len(nodeT)) - for _, eachNode := range nodeT { - tmparr = append(tmparr, eachNode) - } - sort.Sort(Weighting(tmparr)) - - seletedNodeList, err := SelectorInit(tmparr, userquota) - if err != nil { - logger.Logger.Println(err) - } - logger.Logger.Println("Server Scheduled : ", seletedNodeList) - return seletedNodeList, nil -} - -func IPsplitToInt(ip string) int { - tmptp := strings.Split(ip, ".") - if len(tmptp) == 4 { - intIP, err := strconv.Atoi(tmptp[3]) - if err != nil { - return 0 - } - return intIP - } - return 0 -} - -// SetValue : set value -func SetValue(nodemap map[int]*nodeInfo, UUID string, cpus int, mems int, Index int, bmcip int) { - nodemap[Index] = &nodeInfo{NodeUUID: UUID, CPU: cpus, Mem: mems, NodeOrder: bmcip} -} - -// InputTest : Test GraphQL argument -func InputTest(nodemap []*nodeInfo) ([]string, error) { - var seletedNodeList []string - logger.Logger.Println("Appending Selected nodes") - for a, b := range nodemap { - seletedNodeList = append(seletedNodeList, b.NodeUUID) - logger.Logger.Println(a, *b) - } - return seletedNodeList, nil -} - -// AllNodeClustering : All nodes clustering -func AllNodeClustering(numberOfNodes int, ServerUUID string) { - -} - -func printMap(args map[int]*nodeInfo) { - for key, value := range args { - logger.Logger.Println("Key: [", key, "] Value: [", *value, "]") - } -} - -func SelectorInit(nodemap []*nodeInfo, userquota model.Quota) ([]string, error) { - - tmpmap := BuildSliceInit(len(nodemap)) - - checkPathStatus.CPU = userquota.CPU - checkPathStatus.Mem = userquota.Memory - checkPathStatus.Depth = userquota.NumberOfNodes - checkPathStatus.IsFind = false - SearchPath(nodemap, tmpmap, 0, 0, 0) - var nodeUUIDs []string - - if checkPathStatus.IsFind { - for index := 0; index < len(checkPathStatus.NavigatePath); index++ { - nodeUUIDs = append(nodeUUIDs, nodemap[checkPathStatus.NavigatePath[index]].NodeUUID) - } - } else { - - return nodeUUIDs, errors.New("Not Satisfing Node") - } - ResetGlobalVal() - return nodeUUIDs, nil -} -func BuildSliceInit(size int) *[]int { - dp := make([]int, size) - for i := 0; i < len(dp); i++ { - dp[i] = 0 - } - return &dp -} - -func IsoptimizedPath(cpu int, mem int, depth int) bool { - if (cpu == checkPathStatus.CPU && mem == checkPathStatus.Mem && checkPathStatus.IsFind == false) || (checkPathStatus.CPU == 0 && checkPathStatus.Mem == 0 && checkPathStatus.Depth == depth) { - checkPathStatus.IsFind = true - return true - } - return false -} -func IsvaildQuota(cpu int, mem int, depth int) bool { - if (cpu <= checkPathStatus.CPU && mem <= checkPathStatus.Mem && depth <= checkPathStatus.Depth) || (checkPathStatus.CPU == 0 && checkPathStatus.Mem == 0 && depth <= checkPathStatus.Depth) { - return true - } - return false -} - -// SearchPath : visit Abailable nodes and Check out that The node is Satisfy with quota -func SearchPath(nodemap []*nodeInfo, path *[]int, cpu int, mem int, depth int) { - if !checkPathStatus.IsFind { - for index := 0; index < len(nodemap); index++ { - if (*path)[index] != 1 && IsvaildQuota(cpu+nodemap[index].CPU, mem+nodemap[index].Mem, depth+1) { - (*path)[index] = 1 - if IsoptimizedPath(cpu+nodemap[index].CPU, mem+nodemap[index].Mem, depth+1) { - for triumphNumber := 0; triumphNumber < len(*path); triumphNumber++ { - if (*path)[triumphNumber] == 1 { - checkPathStatus.NavigatePath = append(checkPathStatus.NavigatePath, triumphNumber) - } - } - break - } - SearchPath(nodemap, path, cpu+nodemap[index].CPU, mem+nodemap[index].Mem, depth+1) - (*path)[index] = 0 - - } - } - } - -} -func ResetGlobalVal() { - checkPathStatus.CPU = 0 - checkPathStatus.Mem = 0 - checkPathStatus.Depth = 0 - checkPathStatus.IsFind = false - checkPathStatus.NavigatePath = checkPathStatus.NavigatePath[:0] -} +package scheduler + +import ( + "errors" + "hcc/violin-scheduler/lib/logger" + "hcc/violin-scheduler/model" + "sort" + "strconv" + "strings" +) + +type quotaSpec struct { + CPU int + Mem int + NumOfNodes int // End of bmc ip address +} + +type PathStatus struct { + CPU int + Mem int + Depth int + IsFind bool + NavigatePath []int +} + +type nodeInfo struct { + NodeUUID string + CPU int + Mem int + NodeOrder int // End of bmc ip address +} + +type keyValue struct { + nodemap map[string]nodeInfo +} + +var checkPathStatus PathStatus + +type Weighting []*nodeInfo + +func (a Weighting) Len() int { return len(a) } +func (a Weighting) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a Weighting) Less(i, j int) bool { return a[i].NodeOrder < a[j].NodeOrder } + +func NodeListParser(nodes []model.Node, userquota model.Quota) ([]string, error) { + var nodecount int = 0 + nodeT := map[int]*nodeInfo{} + // logger.Logger.Println("nodeListParser (%d): \n", len(nodes), nodes) + for index := 0; index < len(nodes); index++ { + // Later, Please Check Selected node limit equal or less than nodecount + if nodes[index].Active == 0 && nodes[index].ServerUUID == "" { + SetValue(nodeT, nodes[index].UUID, (nodes[index].CPUCores), nodes[index].Memory, nodecount, IPsplitToInt(nodes[index].BmcIP)) + nodecount++ + } + } + if userquota.NumberOfNodes == 0 { + userquota.NumberOfNodes = nodecount + 1 + } + for i, words := range nodeT { + logger.Logger.Println(i, words.NodeUUID) + } + + tmparr := make([]*nodeInfo, 0, len(nodeT)) + for _, eachNode := range nodeT { + tmparr = append(tmparr, eachNode) + } + sort.Sort(Weighting(tmparr)) + + seletedNodeList, err := SelectorInit(tmparr, userquota) + if err != nil { + logger.Logger.Println(err) + } + logger.Logger.Println("Server Scheduled : ", seletedNodeList) + return seletedNodeList, nil +} + +func IPsplitToInt(ip string) int { + tmptp := strings.Split(ip, ".") + if len(tmptp) == 4 { + intIP, err := strconv.Atoi(tmptp[3]) + if err != nil { + return 0 + } + return intIP + } + return 0 +} + +// SetValue : set value +func SetValue(nodemap map[int]*nodeInfo, UUID string, cpus int, mems int, Index int, bmcip int) { + nodemap[Index] = &nodeInfo{NodeUUID: UUID, CPU: cpus, Mem: mems, NodeOrder: bmcip} +} + +// InputTest : Test GraphQL argument +func InputTest(nodemap []*nodeInfo) ([]string, error) { + var seletedNodeList []string + logger.Logger.Println("Appending Selected nodes") + for a, b := range nodemap { + seletedNodeList = append(seletedNodeList, b.NodeUUID) + logger.Logger.Println(a, *b) + } + return seletedNodeList, nil +} + +// AllNodeClustering : All nodes clustering +func AllNodeClustering(numberOfNodes int, ServerUUID string) { +} + +func printMap(args map[int]*nodeInfo) { + for key, value := range args { + logger.Logger.Println("Key: [", key, "] Value: [", *value, "]") + } +} + +func SelectorInit(nodemap []*nodeInfo, userquota model.Quota) ([]string, error) { + tmpmap := BuildSliceInit(len(nodemap)) + + checkPathStatus.CPU = userquota.CPU + checkPathStatus.Mem = userquota.Memory + checkPathStatus.Depth = userquota.NumberOfNodes + checkPathStatus.IsFind = false + SearchPath(nodemap, tmpmap, 0, 0, 0) + var nodeUUIDs []string + + if checkPathStatus.IsFind { + for index := 0; index < len(checkPathStatus.NavigatePath); index++ { + nodeUUIDs = append(nodeUUIDs, nodemap[checkPathStatus.NavigatePath[index]].NodeUUID) + } + } else { + return nodeUUIDs, errors.New("Not Satisfing Node") + } + ResetGlobalVal() + return nodeUUIDs, nil +} + +func BuildSliceInit(size int) *[]int { + dp := make([]int, size) + for i := 0; i < len(dp); i++ { + dp[i] = 0 + } + return &dp +} + +func IsoptimizedPath(cpu int, mem int, depth int) bool { + if (cpu == checkPathStatus.CPU && mem == checkPathStatus.Mem && checkPathStatus.IsFind == false) || (checkPathStatus.CPU == 0 && checkPathStatus.Mem == 0 && checkPathStatus.Depth == depth) { + checkPathStatus.IsFind = true + return true + } + return false +} + +func IsvaildQuota(cpu int, mem int, depth int) bool { + if (cpu <= checkPathStatus.CPU && mem <= checkPathStatus.Mem && depth <= checkPathStatus.Depth) || (checkPathStatus.CPU == 0 && checkPathStatus.Mem == 0 && depth <= checkPathStatus.Depth) { + return true + } + return false +} + +// SearchPath : visit Abailable nodes and Check out that The node is Satisfy with quota +func SearchPath(nodemap []*nodeInfo, path *[]int, cpu int, mem int, depth int) { + if !checkPathStatus.IsFind { + for index := 0; index < len(nodemap); index++ { + if (*path)[index] != 1 && IsvaildQuota(cpu+nodemap[index].CPU, mem+nodemap[index].Mem, depth+1) { + (*path)[index] = 1 + if IsoptimizedPath(cpu+nodemap[index].CPU, mem+nodemap[index].Mem, depth+1) { + for triumphNumber := 0; triumphNumber < len(*path); triumphNumber++ { + if (*path)[triumphNumber] == 1 { + checkPathStatus.NavigatePath = append(checkPathStatus.NavigatePath, triumphNumber) + } + } + break + } + SearchPath(nodemap, path, cpu+nodemap[index].CPU, mem+nodemap[index].Mem, depth+1) + (*path)[index] = 0 + + } + } + } +} + +func ResetGlobalVal() { + checkPathStatus.CPU = 0 + checkPathStatus.Mem = 0 + checkPathStatus.Depth = 0 + checkPathStatus.IsFind = false + checkPathStatus.NavigatePath = checkPathStatus.NavigatePath[:0] +} diff --git a/main.go b/main.go index 4604967..dff1c0e 100644 --- a/main.go +++ b/main.go @@ -1,32 +1,30 @@ -package main - -import ( - "hcc/violin-scheduler/action/grpc/server" - schedulerEnd "hcc/violin-scheduler/end" - schedulerInit "hcc/violin-scheduler/init" - - "fmt" - "os" - "os/signal" - "syscall" -) - -func init() { - err := schedulerInit.MainInit() - if err != nil { - panic(err) - } -} - -func main() { - sigChan := make(chan os.Signal) - signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM) - go func() { - <-sigChan - schedulerEnd.MainEnd() - fmt.Println("Exiting violin module...") - os.Exit(0) - }() - server.Init() - -} +package main + +import ( + "fmt" + "hcc/violin-scheduler/action/grpc/server" + schedulerEnd "hcc/violin-scheduler/end" + schedulerInit "hcc/violin-scheduler/init" + "os" + "os/signal" + "syscall" +) + +func init() { + err := schedulerInit.MainInit() + if err != nil { + panic(err) + } +} + +func main() { + sigChan := make(chan os.Signal) + signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM) + go func() { + <-sigChan + schedulerEnd.MainEnd() + fmt.Println("Exiting violin module...") + os.Exit(0) + }() + server.Init() +} diff --git a/model/node.go b/model/node.go index e895a56..db3b377 100644 --- a/model/node.go +++ b/model/node.go @@ -27,6 +27,7 @@ type Nodes struct { type NodeNum struct { Number int `json:"number"` } + type ScheduledNodes struct { NodeList []string `json:"node_uuid"` } diff --git a/model/quota.go b/model/quota.go index 8150b64..2822a5d 100644 --- a/model/quota.go +++ b/model/quota.go @@ -1,9 +1,9 @@ -package model - -//Quota : asd -type Quota struct { - ServerUUID string - CPU int - Memory int - NumberOfNodes int -} +package model + +// Quota : asd +type Quota struct { + ServerUUID string + CPU int + Memory int + NumberOfNodes int +} diff --git a/model/serverNode.go b/model/serverNode.go index 37cd54c..43ac87b 100644 --- a/model/serverNode.go +++ b/model/serverNode.go @@ -1,14 +1,14 @@ -package model - -import "time" - -type ServerNode struct { - UUID string `json:"uuid"` - ServerUUID string `json:"server_uuid"` - NodeUUID string `json:"node_uuid"` - CreatedAt time.Time `json:"created_at"` -} - -type ServerNodes struct { - Server []Server `json:"server_node"` -} +package model + +import "time" + +type ServerNode struct { + UUID string `json:"uuid"` + ServerUUID string `json:"server_uuid"` + NodeUUID string `json:"node_uuid"` + CreatedAt time.Time `json:"created_at"` +} + +type ServerNodes struct { + Server []Server `json:"server_node"` +} diff --git a/model/subnet.go b/model/subnet.go index d98a101..d264b15 100644 --- a/model/subnet.go +++ b/model/subnet.go @@ -1,26 +1,26 @@ -package model - -import "time" - -type Subnet struct { - UUID string `json:"uuid"` - NetworkIP string `json:"network_ip"` - Netmask string `json:"netmask"` - Gateway string `json:"gateway"` - NextServer string `json:"next_server"` - NameServer string `json:"name_server"` - DomainName string `json:"domain_name"` - ServerUUID string `json:"server_uuid"` - LeaderNodeUUID string `json:"leader_node_uuid"` - OS string `json:"os"` - SubnetName string `json:"subnet_name"` - CreatedAt time.Time `json:"created_at"` -} - -type Subnets struct { - Subnets []Subnet `json:"subnet"` -} - -type SubnetNum struct { - Number int `json:"number"` -} +package model + +import "time" + +type Subnet struct { + UUID string `json:"uuid"` + NetworkIP string `json:"network_ip"` + Netmask string `json:"netmask"` + Gateway string `json:"gateway"` + NextServer string `json:"next_server"` + NameServer string `json:"name_server"` + DomainName string `json:"domain_name"` + ServerUUID string `json:"server_uuid"` + LeaderNodeUUID string `json:"leader_node_uuid"` + OS string `json:"os"` + SubnetName string `json:"subnet_name"` + CreatedAt time.Time `json:"created_at"` +} + +type Subnets struct { + Subnets []Subnet `json:"subnet"` +} + +type SubnetNum struct { + Number int `json:"number"` +}