mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(region): natgateway api upgrade (#20623)
This commit is contained in:
@@ -89,14 +89,14 @@ require (
|
||||
k8s.io/cluster-bootstrap v0.19.3
|
||||
k8s.io/cri-api v0.22.17
|
||||
moul.io/http2curl/v2 v2.3.0
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240618114910-410b4aaefa2a
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240624063926-5714231aad47
|
||||
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32
|
||||
yunion.io/x/jsonutils v1.0.1-0.20240203102553-4096f103b401
|
||||
yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91
|
||||
yunion.io/x/ovsdb v0.0.0-20230306173834-f164f413a900
|
||||
yunion.io/x/pkg v1.10.1-0.20240601050854-9e3452bf4d47
|
||||
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e
|
||||
yunion.io/x/sqlchemy v1.1.3-0.20240530085133-5058648977dd
|
||||
yunion.io/x/sqlchemy v1.1.3-0.20240624023332-82a08f917568
|
||||
yunion.io/x/structarg v0.0.0-20231017124457-df4d5009457c
|
||||
)
|
||||
|
||||
|
||||
@@ -1215,8 +1215,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.20240618114910-410b4aaefa2a h1:qchRdYDa005uvg0Az9uzNzDfLhRadxMKO3Bu9tZm5sc=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240618114910-410b4aaefa2a/go.mod h1:quoJjGTJ2PjAY0+3YeN5JuN136whECKmfkJQwIsXKjM=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240624063926-5714231aad47 h1:XnJCIPBQSPQNHY3BYRIILWfYBIZYkx6nxFvAxZEi1qY=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240624063926-5714231aad47/go.mod h1:quoJjGTJ2PjAY0+3YeN5JuN136whECKmfkJQwIsXKjM=
|
||||
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32 h1:v7POYkQwo1XzOxBoIoRVr/k0V9Y5JyjpshlIFa9raug=
|
||||
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
|
||||
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
|
||||
@@ -1234,7 +1234,7 @@ yunion.io/x/pkg v1.10.1-0.20240601050854-9e3452bf4d47 h1:uh8OUgdycVKVORSoWNj2w9g
|
||||
yunion.io/x/pkg v1.10.1-0.20240601050854-9e3452bf4d47/go.mod h1:+3nFKJt+O4xWboiDAv2EqvMM0rmm3tPJaOuQSHFkcY8=
|
||||
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.3-0.20240530085133-5058648977dd h1:5y2pHZ4+cDIuh5MTI853yulkgdADRLWKeyYaaFGArcQ=
|
||||
yunion.io/x/sqlchemy v1.1.3-0.20240530085133-5058648977dd/go.mod h1:5W8ghvJ4TNt/r2yDjjD3i4QsZgIiJX45dhRQBGWPHsQ=
|
||||
yunion.io/x/sqlchemy v1.1.3-0.20240624023332-82a08f917568 h1:Ytz3G6z3/U+yzkM3KM/am1ndPWHB0nDlOLi9OJWduPc=
|
||||
yunion.io/x/sqlchemy v1.1.3-0.20240624023332-82a08f917568/go.mod h1:5W8ghvJ4TNt/r2yDjjD3i4QsZgIiJX45dhRQBGWPHsQ=
|
||||
yunion.io/x/structarg v0.0.0-20231017124457-df4d5009457c h1:QuLab2kSRECZRxo4Lo2KcYn6XjQFDGaZ1+x0pYDVVwQ=
|
||||
yunion.io/x/structarg v0.0.0-20231017124457-df4d5009457c/go.mod h1:EP6NSv2C0zzqBDTKumv8hPWLb3XvgMZDHQRfyuOrQng=
|
||||
|
||||
Vendored
+2
-2
@@ -1489,7 +1489,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.20240618114910-410b4aaefa2a
|
||||
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240624063926-5714231aad47
|
||||
## explicit; go 1.18
|
||||
yunion.io/x/cloudmux/pkg/apis
|
||||
yunion.io/x/cloudmux/pkg/apis/billing
|
||||
@@ -1641,7 +1641,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.3-0.20240530085133-5058648977dd
|
||||
# yunion.io/x/sqlchemy v1.1.3-0.20240624023332-82a08f917568
|
||||
## explicit; go 1.17
|
||||
yunion.io/x/sqlchemy
|
||||
yunion.io/x/sqlchemy/backends
|
||||
|
||||
+16
-6
@@ -32,18 +32,28 @@ type SNatGateway struct {
|
||||
NatName string `json:"natName"`
|
||||
ProductionStatus string `json:"productionStatus"`
|
||||
State string `json:"state"`
|
||||
UnVpcId string `json:"unVpcId"`
|
||||
VpcId string `json:"vpcId"`
|
||||
VpcName string `json:"vpcName"`
|
||||
VpcId string
|
||||
Zone string `json:"zone"`
|
||||
NatGatewayName string
|
||||
NatGatewayId string
|
||||
|
||||
Bandwidth string `json:"bandwidth"`
|
||||
CreateTime time.Time `json:"createTime"`
|
||||
EipCount string `json:"eipCount"`
|
||||
MaxConcurrent float32 `json:"maxConcurrent"`
|
||||
|
||||
PublicIpAddressSet []struct {
|
||||
AddressId string
|
||||
}
|
||||
}
|
||||
|
||||
func (nat *SNatGateway) GetName() string {
|
||||
if len(nat.NatGatewayId) > 0 {
|
||||
return nat.NatGatewayId
|
||||
}
|
||||
if len(nat.NatGatewayName) > 0 {
|
||||
return nat.NatName
|
||||
}
|
||||
if len(nat.NatName) > 0 {
|
||||
return nat.NatName
|
||||
}
|
||||
@@ -51,11 +61,11 @@ func (nat *SNatGateway) GetName() string {
|
||||
}
|
||||
|
||||
func (nat *SNatGateway) GetId() string {
|
||||
return nat.NatId
|
||||
return nat.NatId + nat.NatGatewayId
|
||||
}
|
||||
|
||||
func (nat *SNatGateway) GetGlobalId() string {
|
||||
return nat.NatId
|
||||
return nat.NatId + nat.NatGatewayId
|
||||
}
|
||||
|
||||
func (self *SNatGateway) GetINetworkId() string {
|
||||
@@ -96,7 +106,7 @@ func (nat *SNatGateway) GetNatSpec() string {
|
||||
func (nat *SNatGateway) GetIEips() ([]cloudprovider.ICloudEIP, error) {
|
||||
eips := []SEipAddress{}
|
||||
for {
|
||||
part, total, err := nat.vpc.region.GetEips("", nat.NatId, len(eips), 50)
|
||||
part, total, err := nat.vpc.region.GetEips("", nat.GetId(), len(eips), 50)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
+25
@@ -18,6 +18,7 @@ import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"sort"
|
||||
"sync"
|
||||
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
@@ -106,6 +107,9 @@ type STableSpec struct {
|
||||
sDBReferer
|
||||
|
||||
IsLinked bool
|
||||
|
||||
syncedIndex bool
|
||||
syncIndexLock *sync.Mutex
|
||||
}
|
||||
|
||||
// STable is an instance of table for query, system will automatically give a alias to this table
|
||||
@@ -138,6 +142,9 @@ func NewTableSpecFromStructWithDBName(s interface{}, name string, dbName DBName)
|
||||
sDBReferer: sDBReferer{
|
||||
dbName: dbName,
|
||||
},
|
||||
|
||||
syncedIndex: false,
|
||||
syncIndexLock: &sync.Mutex{},
|
||||
}
|
||||
return table
|
||||
}
|
||||
@@ -151,6 +158,9 @@ func NewTableSpecFromISpecWithDBName(spec ITableSpec, name string, dbName DBName
|
||||
},
|
||||
extraOptions: extraOpts,
|
||||
IsLinked: true,
|
||||
|
||||
syncedIndex: false,
|
||||
syncIndexLock: &sync.Mutex{},
|
||||
}
|
||||
return table
|
||||
}
|
||||
@@ -171,6 +181,13 @@ func (ts *STableSpec) SyncColumnIndexes() error {
|
||||
return errors.Wrap(errors.ErrNotFound, "table not exists")
|
||||
}
|
||||
|
||||
ts.syncIndexLock.Lock()
|
||||
defer ts.syncIndexLock.Unlock()
|
||||
|
||||
if ts.syncedIndex {
|
||||
return nil
|
||||
}
|
||||
|
||||
cols, err := ts.Database().backend.FetchTableColumnSpecs(ts)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "FetchTableColumnSpecs")
|
||||
@@ -212,6 +229,8 @@ func (ts *STableSpec) SyncColumnIndexes() error {
|
||||
return compareColumnIndex(ts._columns[i], ts._columns[j]) < 0
|
||||
})
|
||||
|
||||
ts.syncedIndex = true
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -251,6 +270,9 @@ func (ts *STableSpec) CloneWithSyncColumnOrder(name string, autoIncOffset int64,
|
||||
_columns: newCols,
|
||||
_contraints: ts._contraints,
|
||||
sDBReferer: ts.sDBReferer,
|
||||
|
||||
syncedIndex: false,
|
||||
syncIndexLock: &sync.Mutex{},
|
||||
}
|
||||
newIndexes := make([]STableIndex, len(ts._indexes))
|
||||
for i := range ts._indexes {
|
||||
@@ -262,6 +284,9 @@ func (ts *STableSpec) CloneWithSyncColumnOrder(name string, autoIncOffset int64,
|
||||
|
||||
// Columns implementation of STableSpec for ITableSpec
|
||||
func (ts *STableSpec) Columns() []IColumnSpec {
|
||||
ts.syncIndexLock.Lock()
|
||||
defer ts.syncIndexLock.Unlock()
|
||||
|
||||
if ts._columns == nil {
|
||||
val := reflect.Indirect(reflect.New(ts.structType))
|
||||
ts.struct2TableSpec(val)
|
||||
|
||||
Reference in New Issue
Block a user