mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
update vendor
This commit is contained in:
@@ -37,6 +37,7 @@ require (
|
||||
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
|
||||
github.com/c-bata/go-prompt v0.2.1
|
||||
github.com/ceph/go-ceph v0.0.0-20181217221554-e32f9f0f2e94
|
||||
github.com/cheggaaa/pb/v3 v3.0.8
|
||||
github.com/coredns/coredns v1.3.0
|
||||
github.com/coreos/go-systemd v0.0.0-20190620071333-e64a0ec8b42a // indirect
|
||||
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f // indirect
|
||||
@@ -149,8 +150,8 @@ require (
|
||||
k8s.io/apimachinery v0.19.3
|
||||
k8s.io/client-go v0.19.3
|
||||
k8s.io/cluster-bootstrap v0.19.3
|
||||
yunion.io/x/executor v0.0.0-20210310041834-3fcd1574f68e
|
||||
yunion.io/x/jsonutils v0.0.0-20210709075951-798a67800349
|
||||
yunion.io/x/executor v0.0.0-20211018100936-39a2cd966656
|
||||
yunion.io/x/jsonutils v0.0.0-20211105163012-d846c05a3c9a
|
||||
yunion.io/x/log v0.0.0-20201210064738-43181789dc74
|
||||
yunion.io/x/ovsdb v0.0.0-20200526071744-27bf0940cbc7
|
||||
yunion.io/x/pkg v0.0.0-20210918114143-ce839f862c5f
|
||||
@@ -158,5 +159,3 @@ require (
|
||||
yunion.io/x/sqlchemy v0.0.0-20210918113031-c1c107f37ada
|
||||
yunion.io/x/structarg v0.0.0-20200720093445-9f850fa222ce
|
||||
)
|
||||
|
||||
replace github.com/ceph/go-ceph v0.0.0-20181217221554-e32f9f0f2e94 => github.com/yunionio/go-ceph v0.0.0-20190912101231-6f05a06b3859
|
||||
|
||||
@@ -912,8 +912,8 @@ sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
|
||||
yunion.io/x/executor v0.0.0-20210310041834-3fcd1574f68e h1:uGmKmmHm4zeLXhc/MEbAFtEDtGtyEYhC0OaBRGFi+fQ=
|
||||
yunion.io/x/executor v0.0.0-20210310041834-3fcd1574f68e/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
|
||||
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
|
||||
yunion.io/x/jsonutils v0.0.0-20210709075951-798a67800349 h1:ESeezAb9LM2Dcy28DDrD2nI+h22qEf4MyAPXwuDO4uM=
|
||||
yunion.io/x/jsonutils v0.0.0-20210709075951-798a67800349/go.mod h1:p0nyMqGA/apTxxyLIU/o1k4V7Vujl2O6ey30L594sYE=
|
||||
yunion.io/x/jsonutils v0.0.0-20211105163012-d846c05a3c9a h1:X/ucfLNcYsCfc4GFEX7R7GNWiDPr3vopLdnE4PuU46U=
|
||||
yunion.io/x/jsonutils v0.0.0-20211105163012-d846c05a3c9a/go.mod h1:p0nyMqGA/apTxxyLIU/o1k4V7Vujl2O6ey30L594sYE=
|
||||
yunion.io/x/log v0.0.0-20190514041436-04ce53b17c6b/go.mod h1:+gauLs73omeJAPlsXcevLsJLKixV+sR/E7WSYTSx1fE=
|
||||
yunion.io/x/log v0.0.0-20190629062853-9f6483a7103d/go.mod h1:LC6f/4FozL0iaAbnFt2eDX9jlsyo3WiOUPm03d7+U4U=
|
||||
yunion.io/x/log v0.0.0-20201210064738-43181789dc74 h1:7D+sQ/XaUTUEm+NCrKXOhXBKlzEd0RyS2qZ4vBGjx2o=
|
||||
|
||||
+24
-1
@@ -19,6 +19,7 @@ import (
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"yunion.io/x/pkg/util/netutils"
|
||||
@@ -77,13 +78,35 @@ func GetNicDHCPConfig(
|
||||
routes = append(routes, []string{route[0], route[1]})
|
||||
}
|
||||
|
||||
parseIPs := func(ips string) []net.IP {
|
||||
ret := make([]net.IP, 0)
|
||||
iplist := strings.Split(ips, ",")
|
||||
for _, ip := range iplist {
|
||||
ret = append(ret, net.ParseIP(ip))
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
parseDomains := func(domains string) []net.IP {
|
||||
ret := make([]net.IP, 0)
|
||||
domainlist := strings.Split(domains, ",")
|
||||
for _, domain := range domainlist {
|
||||
addrs, _ := net.LookupHost(domain)
|
||||
for _, addr := range addrs {
|
||||
ret = append(ret, net.ParseIP(addr))
|
||||
}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
conf := &dhcp.ResponseConfig{
|
||||
ServerIP: net.ParseIP(serverIP),
|
||||
ClientIP: net.ParseIP(ipAddr.String()),
|
||||
Gateway: net.ParseIP(n.Gateway),
|
||||
SubnetMask: subnetMask,
|
||||
BroadcastAddr: net.ParseIP(ipAddr.BroadcastAddr(n.MaskLen).String()),
|
||||
DNSServer: net.ParseIP(n.Dns),
|
||||
DNSServers: parseIPs(n.Dns),
|
||||
NTPServers: parseDomains(n.Ntp),
|
||||
Domain: n.Domain,
|
||||
OsName: "Linux",
|
||||
Hostname: hostName,
|
||||
|
||||
@@ -207,8 +207,6 @@ func ValueToError(out reflect.Value) error {
|
||||
func mergeInputOutputData(data *jsonutils.JSONDict, resVal reflect.Value) *jsonutils.JSONDict {
|
||||
retJson := ValueToJSONDict(resVal)
|
||||
// preserve the input info not returned by caller
|
||||
log.Debugf("retJson: %s", retJson)
|
||||
log.Debugf("data: %s", data)
|
||||
output := data.Copy()
|
||||
jsonMap, _ := retJson.GetMap()
|
||||
for k, v := range jsonMap {
|
||||
@@ -238,7 +236,6 @@ func mergeInputOutputData(data *jsonutils.JSONDict, resVal reflect.Value) *jsonu
|
||||
}
|
||||
}
|
||||
}
|
||||
log.Debugf("output: %s", output)
|
||||
return output
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ func Test_valueToJSONObject(t *testing.T) {
|
||||
{
|
||||
name: "struct2json",
|
||||
args: &api.ServerRebuildRootInput{Image: "image"},
|
||||
want: jsonutils.Marshal(api.ServerRebuildRootInput{Image: "image"}),
|
||||
want: jsonutils.MarshalAll(api.ServerRebuildRootInput{Image: "image"}),
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
|
||||
@@ -31,6 +31,7 @@ type SNic struct {
|
||||
Mtu int64 `json:"mtu"`
|
||||
Mac string `json:"mac"`
|
||||
Dns string `json:"dns"`
|
||||
Ntp string `json:"ntp"`
|
||||
MaskLen int8 `json:"masklen"`
|
||||
Net string `json:"net"`
|
||||
Gateway string `json:"gateway"`
|
||||
@@ -96,6 +97,7 @@ func (n SServerNic) ToNic() SNic {
|
||||
NetId: n.NetId,
|
||||
Mac: n.Mac,
|
||||
Dns: n.Dns,
|
||||
Ntp: n.Ntp,
|
||||
MaskLen: int8(n.Masklen),
|
||||
Net: n.Net,
|
||||
Gateway: n.Gateway,
|
||||
|
||||
@@ -384,9 +384,11 @@ func (self *SNetwork) getFreeIP(addrTable map[string]bool, recentUsedAddrTable m
|
||||
return candidate, nil
|
||||
}
|
||||
}
|
||||
// If network's alloc_policy is not none, then use network's alloc_policy
|
||||
if len(self.AllocPolicy) > 0 && api.IPAllocationDirection(self.AllocPolicy) != api.IPAllocationNone {
|
||||
allocDir = api.IPAllocationDirection(self.AllocPolicy)
|
||||
}
|
||||
// if alloc_dir is not speicified, and network's alloc_policy is not either, use default
|
||||
if len(allocDir) == 0 {
|
||||
allocDir = api.IPAllocationDirection(options.Options.DefaultIPAllocationDirection)
|
||||
}
|
||||
@@ -1586,13 +1588,20 @@ func (manager *SNetworkManager) ValidateCreateData(ctx context.Context, userCred
|
||||
if ipStr == "" {
|
||||
continue
|
||||
}
|
||||
if key == "guest_dhcp" || key == "guest_dns" || key == "guest_ntp" {
|
||||
if key == "guest_dhcp" || key == "guest_dns" {
|
||||
ipList := strings.Split(ipStr, ",")
|
||||
for _, ipstr := range ipList {
|
||||
if !regutils.MatchIPAddr(ipstr) {
|
||||
return input, httperrors.NewInputParameterError("%s: Invalid IP address %s", key, ipstr)
|
||||
}
|
||||
}
|
||||
} else if key == "guest_ntp" {
|
||||
ipList := strings.Split(ipStr, ",")
|
||||
for _, ipstr := range ipList {
|
||||
if !regutils.MatchDomainName(ipstr) && !regutils.MatchIPAddr(ipstr) {
|
||||
return input, httperrors.NewInputParameterError("%s: Invalid domain name or IP address %s", key, ipstr)
|
||||
}
|
||||
}
|
||||
} else if !regutils.MatchIPAddr(ipStr) {
|
||||
return input, httperrors.NewInputParameterError("%s: Invalid IP address %s", key, ipStr)
|
||||
}
|
||||
@@ -1784,13 +1793,20 @@ func (self *SNetwork) validateUpdateData(ctx context.Context, userCred mcclient.
|
||||
if ipStr == "" {
|
||||
continue
|
||||
}
|
||||
if key == "guest_dhcp" || key == "guest_dns" || key == "guest_ntp" {
|
||||
if key == "guest_dhcp" || key == "guest_dns" {
|
||||
ipList := strings.Split(ipStr, ",")
|
||||
for _, ipstr := range ipList {
|
||||
if !regutils.MatchIPAddr(ipstr) {
|
||||
return input, httperrors.NewInputParameterError("%s: Invalid IP address %s", key, ipstr)
|
||||
}
|
||||
}
|
||||
} else if key == "guest_ntp" {
|
||||
ipList := strings.Split(ipStr, ",")
|
||||
for _, ipstr := range ipList {
|
||||
if !regutils.MatchDomainName(ipstr) && !regutils.MatchIPAddr(ipstr) {
|
||||
return input, httperrors.NewInputParameterError("%s: Invalid domain name or IP address %s", key, ipstr)
|
||||
}
|
||||
}
|
||||
} else if !regutils.MatchIPAddr(ipStr) {
|
||||
return input, httperrors.NewInputParameterError("%s: Invalid IP address %s", key, ipStr)
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1168,7 +1168,7 @@ sigs.k8s.io/yaml
|
||||
yunion.io/x/executor/apis
|
||||
yunion.io/x/executor/client
|
||||
yunion.io/x/executor/server
|
||||
# yunion.io/x/jsonutils v0.0.0-20210709075951-798a67800349
|
||||
# yunion.io/x/jsonutils v0.0.0-20211105163012-d846c05a3c9a
|
||||
yunion.io/x/jsonutils
|
||||
# yunion.io/x/log v0.0.0-20201210064738-43181789dc74
|
||||
yunion.io/x/log
|
||||
|
||||
Reference in New Issue
Block a user