mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 06:09:39 +08:00
Merge pull request #63 in YUNIONIO/onecloud from ~LIZEXI/onecloud:feature/lzx-scheduler-container-net to release/2.0.0
* commit '7cad0d54f39b6bfa87474f80e5136f21e1f8d954': scheduler: network container server_type
This commit is contained in:
@@ -45,7 +45,7 @@ func init() {
|
||||
ID string `help:"ID or Name of zone to update"`
|
||||
Name string `help:"Name of zone"`
|
||||
Desc string `metavar:"<DESCRIPTION>" help:"Description"`
|
||||
ServerType string `help:"server type," choices:"baremetal|guest"`
|
||||
ServerType string `help:"server type," choices:"baremetal|guest|container"`
|
||||
StartIp string `help:"Start ip"`
|
||||
EndIp string `help:"end ip"`
|
||||
NetMask int64 `help:"Netmask"`
|
||||
@@ -178,7 +178,7 @@ func init() {
|
||||
Gateway string `help:"Default gateway"`
|
||||
VlanId int64 `help:"Vlan ID" default:"1"`
|
||||
AllocPolicy string `help:"Address allocation policy" choices:"none|stepdown|stepup|random"`
|
||||
ServerType string `help:"Server type" choices:"baremetal|guest"`
|
||||
ServerType string `help:"Server type" choices:"baremetal|guest|container"`
|
||||
Desc string `help:"Description" metavar:"DESCRIPTION"`
|
||||
}
|
||||
R(&NetworkCreateOptions{}, "network-create", "Create a virtual network", func(s *mcclient.ClientSession, args *NetworkCreateOptions) error {
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"yunion.io/x/onecloud/pkg/scheduler/core"
|
||||
networks "yunion.io/x/onecloud/pkg/scheduler/db/models"
|
||||
"yunion.io/x/pkg/utils"
|
||||
"yunion.io/yunioncloud/pkg/util/sets"
|
||||
)
|
||||
|
||||
// NetworkPredicate will filter the current network information with
|
||||
@@ -51,9 +52,9 @@ func (p *NetworkPredicate) Execute(u *core.Unit, c core.Candidater) (bool, []cor
|
||||
return len(d.HostID) > 0
|
||||
}
|
||||
|
||||
// ServerType's value is 'guest' or ''(support all type) will return true.
|
||||
// ServerType's value is 'guest', 'container' or ''(support all type) will return true.
|
||||
isMatchServerType := func(network *networks.NetworkSchedResult) bool {
|
||||
return network.ServerType == "guest" || network.ServerType == ""
|
||||
return sets.NewString("guest", "", "container").Has(network.ServerType)
|
||||
}
|
||||
|
||||
counterOfNetwork := func(u *core.Unit, n *networks.NetworkSchedResult, r int) core.Counter {
|
||||
|
||||
Reference in New Issue
Block a user