mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #1745 from wanyaoqi/bugfix/wyq/fix-deploy-network-routes
bugfix:fix deploy network with routes
This commit is contained in:
@@ -18,8 +18,6 @@ import (
|
||||
"net"
|
||||
|
||||
"yunion.io/x/pkg/util/netutils"
|
||||
|
||||
deployapi "yunion.io/x/onecloud/pkg/hostman/hostdeployer/apis"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -32,23 +30,25 @@ var (
|
||||
)
|
||||
|
||||
type SNic struct {
|
||||
Type string `json:"nic_type"`
|
||||
Domain string `json:"domain"`
|
||||
Wire string `json:"wire"`
|
||||
IpAddr string `json:"ip_addr"`
|
||||
WireId string `json:"wire_id"`
|
||||
NetId string `json:"net_id"`
|
||||
Rate int64 `json:"rate"`
|
||||
Mtu int64 `json:"mtu"`
|
||||
Mac string `json:"mac"`
|
||||
Dns string `json:"dns"`
|
||||
MaskLen int8 `json:"masklen"`
|
||||
Net string `json:"net"`
|
||||
Gateway string `json:"gateway"`
|
||||
LinkUp bool `json:"link_up"`
|
||||
Routes []*deployapi.Routes `json:"routes,omitempty"`
|
||||
Type string `json:"nic_type"`
|
||||
Domain string `json:"domain"`
|
||||
Wire string `json:"wire"`
|
||||
IpAddr string `json:"ip_addr"`
|
||||
WireId string `json:"wire_id"`
|
||||
NetId string `json:"net_id"`
|
||||
Rate int64 `json:"rate"`
|
||||
Mtu int64 `json:"mtu"`
|
||||
Mac string `json:"mac"`
|
||||
Dns string `json:"dns"`
|
||||
MaskLen int8 `json:"masklen"`
|
||||
Net string `json:"net"`
|
||||
Gateway string `json:"gateway"`
|
||||
LinkUp bool `json:"link_up"`
|
||||
Routes []SRoute `json:"routes,omitempty"`
|
||||
}
|
||||
|
||||
type SRoute []string
|
||||
|
||||
func (n SNic) GetNetMask() string {
|
||||
return netutils.Masklen2Mask(n.MaskLen).String()
|
||||
}
|
||||
@@ -58,7 +58,30 @@ func (n SNic) GetMac() net.HardwareAddr {
|
||||
}
|
||||
|
||||
type SServerNic struct {
|
||||
*deployapi.Nic
|
||||
Name string `json:"name"`
|
||||
Index int `json:"index"`
|
||||
Bridge string `json:"bridge"`
|
||||
Domain string `json:"domain"`
|
||||
Ip string `json:"ip"`
|
||||
Vlan int `json:"vlan"`
|
||||
Driver string `json:"driver"`
|
||||
Masklen int `json:"masklen"`
|
||||
Virtual bool `json:"virtual"`
|
||||
Manual bool `json:"manual"`
|
||||
WireId string `json:"wire_id"`
|
||||
NetId string `json:"net_id"`
|
||||
Mac string `json:"mac"`
|
||||
BandWidth int `json:"bw"`
|
||||
Dns string `json:"dns"`
|
||||
Net string `json:"net"`
|
||||
Interface string `json:"interface"`
|
||||
Gateway string `json:"gateway"`
|
||||
Ifname string `json:"ifname"`
|
||||
Routes []SRoute `json:"routes,omitempty"`
|
||||
NicType string `json:"nic_type,omitempty"`
|
||||
LinkUp bool `json:"link_up,omitempty"`
|
||||
Mtu int64 `json:"mtu,omitempty"`
|
||||
TeamWith string `json:"team_with,omitempty"`
|
||||
|
||||
TeamingMaster *SServerNic `json:"-"`
|
||||
TeamingSlaves []*SServerNic `json:"-"`
|
||||
|
||||
Reference in New Issue
Block a user