mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
fix(region): 支持1/2类似的gpu数量
This commit is contained in:
@@ -83,14 +83,14 @@ require (
|
||||
k8s.io/client-go v0.19.3
|
||||
k8s.io/cluster-bootstrap v0.19.3
|
||||
moul.io/http2curl/v2 v2.3.0
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230606113005-d4149341e049
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230615122416-b42c36313681
|
||||
yunion.io/x/executor v0.0.0-20211018100936-39a2cd966656
|
||||
yunion.io/x/jsonutils v1.0.1-0.20230613121553-0f3b41e2ef19
|
||||
yunion.io/x/log v1.0.1-0.20230411060016-feb3f46ab361
|
||||
yunion.io/x/ovsdb v0.0.0-20230306173834-f164f413a900
|
||||
yunion.io/x/pkg v1.0.1-0.20230613081559-f38e2cb344b4
|
||||
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e
|
||||
yunion.io/x/sqlchemy v1.1.2-0.20230518004216-245cb3766e38
|
||||
yunion.io/x/sqlchemy v1.1.2-0.20230615091740-63854d9b514e
|
||||
yunion.io/x/structarg v0.0.0-20220312084958-9c6c79c7d1c6
|
||||
)
|
||||
|
||||
|
||||
@@ -1173,8 +1173,8 @@ sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
|
||||
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230606113005-d4149341e049 h1:e29eTgcjTEFz0ey0Jr3hR1b/qqgVTxorsXuNuXcbTYM=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230606113005-d4149341e049/go.mod h1:crMeQeaNaZefTXfXbQkoj5SStggqkSNVABHtYBFjM3Y=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230615122416-b42c36313681 h1:kVR8utQcEJwcRv/s8KNtYQLZq7FSrV0rM0VKv1/U0io=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230615122416-b42c36313681/go.mod h1:crMeQeaNaZefTXfXbQkoj5SStggqkSNVABHtYBFjM3Y=
|
||||
yunion.io/x/executor v0.0.0-20211018100936-39a2cd966656 h1:0zlZD5uhZoIHgLVAWCz2aHaYk2ZrNsACCYD7R6EIBII=
|
||||
yunion.io/x/executor v0.0.0-20211018100936-39a2cd966656/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
|
||||
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
|
||||
@@ -1192,7 +1192,7 @@ yunion.io/x/pkg v1.0.1-0.20230613081559-f38e2cb344b4 h1:YpXY+evpJMNovHgEpgp4H9bB
|
||||
yunion.io/x/pkg v1.0.1-0.20230613081559-f38e2cb344b4/go.mod h1:ksCJVQ+DwKrJ5QBEoU8pzrDFfDaZVAFH/iJ6yQCYxJk=
|
||||
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e h1:v+EzIadodSwkdZ/7bremd7J8J50Cise/HCylsOJngmo=
|
||||
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e/go.mod h1:0iFKpOs1y4lbCxeOmq3Xx/0AcQoewVPwj62eRluioEo=
|
||||
yunion.io/x/sqlchemy v1.1.2-0.20230518004216-245cb3766e38 h1:cRAYmZsSIeoh+WsihZH7Cee/qst/A8KL53JUtW7pxcA=
|
||||
yunion.io/x/sqlchemy v1.1.2-0.20230518004216-245cb3766e38/go.mod h1:uuPVZEyEq3sWd5vf9VjGSy6lZzof22X87OEHw9sddJQ=
|
||||
yunion.io/x/sqlchemy v1.1.2-0.20230615091740-63854d9b514e h1:iiM9Y1poJL24XY2q0ZgFR7yPBoKTNcOktdh2jka4ka4=
|
||||
yunion.io/x/sqlchemy v1.1.2-0.20230615091740-63854d9b514e/go.mod h1:uuPVZEyEq3sWd5vf9VjGSy6lZzof22X87OEHw9sddJQ=
|
||||
yunion.io/x/structarg v0.0.0-20220312084958-9c6c79c7d1c6 h1:WuWXhY3DvhdRTzWCJ/kwt3Ss6KIq7+KqJwb+esvNGwU=
|
||||
yunion.io/x/structarg v0.0.0-20220312084958-9c6c79c7d1c6/go.mod h1:EP6NSv2C0zzqBDTKumv8hPWLb3XvgMZDHQRfyuOrQng=
|
||||
|
||||
@@ -106,7 +106,7 @@ type SServerSku struct {
|
||||
|
||||
GpuAttachable tristate.TriState `default:"true" list:"user" create:"admin_optional" update:"admin"`
|
||||
GpuSpec string `width:"128" charset:"ascii" nullable:"true" list:"user" create:"admin_optional" update:"admin"`
|
||||
GpuCount int `nullable:"true" list:"user" create:"admin_optional" update:"admin"`
|
||||
GpuCount string `nullable:"true" list:"user" create:"admin_optional" update:"admin"`
|
||||
GpuMaxCount int `nullable:"true" list:"user" create:"admin_optional" update:"admin"`
|
||||
|
||||
Provider string `width:"64" charset:"ascii" nullable:"true" list:"user" default:"OneCloud" create:"admin_optional"`
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
package cloudpods
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/cloudmux/pkg/cloudprovider"
|
||||
"yunion.io/x/cloudmux/pkg/multicloud"
|
||||
|
||||
@@ -130,8 +132,8 @@ func (self *SServerSku) GetGpuSpec() string {
|
||||
return self.GpuSpec
|
||||
}
|
||||
|
||||
func (self *SServerSku) GetGpuCount() int {
|
||||
return self.GpuCount
|
||||
func (self *SServerSku) GetGpuCount() string {
|
||||
return fmt.Sprintf("%d", self.GpuCount)
|
||||
}
|
||||
|
||||
func (self *SServerSku) GetGpuMaxCount() int {
|
||||
|
||||
Vendored
+2
-2
@@ -1440,7 +1440,7 @@ sigs.k8s.io/structured-merge-diff/v4/value
|
||||
# sigs.k8s.io/yaml v1.2.0
|
||||
## explicit; go 1.12
|
||||
sigs.k8s.io/yaml
|
||||
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230606113005-d4149341e049
|
||||
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230615122416-b42c36313681
|
||||
## explicit; go 1.18
|
||||
yunion.io/x/cloudmux/pkg/apis
|
||||
yunion.io/x/cloudmux/pkg/apis/billing
|
||||
@@ -1586,7 +1586,7 @@ yunion.io/x/pkg/utils
|
||||
# yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e
|
||||
## explicit; go 1.12
|
||||
yunion.io/x/s3cli
|
||||
# yunion.io/x/sqlchemy v1.1.2-0.20230518004216-245cb3766e38
|
||||
# yunion.io/x/sqlchemy v1.1.2-0.20230615091740-63854d9b514e
|
||||
## explicit; go 1.17
|
||||
yunion.io/x/sqlchemy
|
||||
yunion.io/x/sqlchemy/backends
|
||||
|
||||
+1
-1
@@ -857,7 +857,7 @@ type ICloudSku interface {
|
||||
|
||||
GetGpuAttachable() bool
|
||||
GetGpuSpec() string
|
||||
GetGpuCount() int
|
||||
GetGpuCount() string
|
||||
GetGpuMaxCount() int
|
||||
|
||||
Delete() error
|
||||
|
||||
+1
@@ -233,6 +233,7 @@ func doRequest(client *sdk.Client, domain, apiVersion, apiName string, params ma
|
||||
"TLS handshake timeout",
|
||||
"Client.Timeout exceeded while awaiting headers",
|
||||
"connection reset by peer",
|
||||
"context deadline exceeded",
|
||||
"server misbehaving",
|
||||
"try later",
|
||||
"Another operation is being performed", // Another operation is being performed on the DB instance or the DB instance is faulty(赋予RDS账号权限)
|
||||
|
||||
+1
-1
@@ -257,7 +257,7 @@ func (self *SApsaraClient) getDefaultClient(regionId string) (*sdk.Client, error
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "ParseQuery(%s)", req.URL.RawQuery)
|
||||
}
|
||||
action := params.Get("Action")
|
||||
action := params.Get("OpenApiAction")
|
||||
service := strings.ToLower(params.Get("Product"))
|
||||
respCheck := func(resp *http.Response) {
|
||||
if self.cpcfg.UpdatePermission != nil {
|
||||
|
||||
+4
-4
@@ -33,7 +33,7 @@ type SInstanceType struct {
|
||||
CpuCoreCount int
|
||||
MemorySize float32
|
||||
EniQuantity int // 实例规格支持网卡数量
|
||||
GPUAmount int
|
||||
GPUAmount string
|
||||
GPUSpec string
|
||||
InstanceTypeFamily string
|
||||
InstanceFamilyLevel string
|
||||
@@ -182,11 +182,11 @@ func (self *SInstanceType) GetGpuAttachable() bool {
|
||||
}
|
||||
|
||||
func (self *SInstanceType) GetGpuSpec() string {
|
||||
return ""
|
||||
return self.GPUSpec
|
||||
}
|
||||
|
||||
func (self *SInstanceType) GetGpuCount() int {
|
||||
return 0
|
||||
func (self *SInstanceType) GetGpuCount() string {
|
||||
return self.GPUAmount
|
||||
}
|
||||
|
||||
func (self *SInstanceType) GetGpuMaxCount() int {
|
||||
|
||||
+1
-1
@@ -468,7 +468,7 @@ func (self *SRegion) GetMatchInstanceTypes(cpu int, memMB int, gpu int, zoneId s
|
||||
}
|
||||
ret := make([]SInstanceType, 0)
|
||||
for _, t := range self.instanceTypes {
|
||||
if t.CpuCoreCount == cpu && memMB == t.memoryMB() && gpu == t.GPUAmount {
|
||||
if t.CpuCoreCount == cpu && memMB == t.memoryMB() && fmt.Sprintf("%d", gpu) == t.GPUAmount {
|
||||
if available == nil || utils.IsInStringArray(t.InstanceTypeId, available) {
|
||||
ret = append(ret, t)
|
||||
}
|
||||
|
||||
+2
-2
@@ -173,8 +173,8 @@ func (insType *SInstanceType) GetGpuSpec() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (insType *SInstanceType) GetGpuCount() int {
|
||||
return 0
|
||||
func (insType *SInstanceType) GetGpuCount() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (insType *SInstanceType) GetGpuMaxCount() int {
|
||||
|
||||
+3
-4
@@ -264,12 +264,11 @@ func (self *SInstanceType) GetGpuSpec() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (self *SInstanceType) GetGpuCount() int {
|
||||
func (self *SInstanceType) GetGpuCount() string {
|
||||
if self.OSExtraSpecs.EcsPerformancetype == "gpu" {
|
||||
return 1
|
||||
return "1"
|
||||
}
|
||||
|
||||
return 0
|
||||
return ""
|
||||
}
|
||||
|
||||
func (self *SInstanceType) GetGpuMaxCount() int {
|
||||
|
||||
+2
-2
@@ -276,8 +276,8 @@ func (flavor *SFlavor) GetGpuSpec() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (flavor *SFlavor) GetGpuCount() int {
|
||||
return 0
|
||||
func (flavor *SFlavor) GetGpuCount() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (flavor *SFlavor) GetGpuMaxCount() int {
|
||||
|
||||
+2
-2
@@ -238,8 +238,8 @@ func (offering *SInstanceOffering) GetGpuSpec() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (offering *SInstanceOffering) GetGpuCount() int {
|
||||
return 0
|
||||
func (offering *SInstanceOffering) GetGpuCount() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (offering *SInstanceOffering) GetGpuMaxCount() int {
|
||||
|
||||
+1
-1
@@ -95,7 +95,7 @@ func (ts *STableSpec) AddIndex(unique bool, cols ...string) bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
idx := STableIndex{columns: cols, isUnique: unique, ts: ts}
|
||||
idx := NewTableIndex(ts, cols, unique)
|
||||
ts._indexes = append(ts._indexes, idx)
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user