Merge pull request #15701 from ioito/hotfix/qx-vender-update-20230104

fix(region): vender update
This commit is contained in:
Zexi Li
2023-01-04 20:01:37 +08:00
committed by GitHub
8 changed files with 29 additions and 9 deletions
+1 -1
View File
@@ -81,7 +81,7 @@ 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.20230103095152-d51258a2c88d
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230104114513-eab695f13003
yunion.io/x/executor v0.0.0-20211018100936-39a2cd966656
yunion.io/x/jsonutils v1.0.1-0.20220819091305-3bab322ab4fd
yunion.io/x/log v1.0.0
+2 -2
View File
@@ -1158,8 +1158,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.20230103095152-d51258a2c88d h1:5QoHFEN4LJ5yXYWRN4L8/HOc+T13VvxivgE/WonNexI=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230103095152-d51258a2c88d/go.mod h1:yEMFtIKPyIdIfPzsw7oTcH41JXc8G5StUAQw3ZoGj5I=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230104114513-eab695f13003 h1:WuLDIwQcBRHLvFpkL9+hXOra6nADUkjvkeT+GcHbuyk=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230104114513-eab695f13003/go.mod h1:yEMFtIKPyIdIfPzsw7oTcH41JXc8G5StUAQw3ZoGj5I=
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=
+8 -2
View File
@@ -1320,7 +1320,9 @@ func (dispatcher *DBModelDispatcher) Create(ctx context.Context, query jsonutils
return nil, errors.Wrap(err, "isClassRbacAllowed")
}
if InitPendingUsagesInContext != nil {
dryRun := jsonutils.QueryBoolean(data, "dry_run", false)
if !dryRun && InitPendingUsagesInContext != nil {
ctx = InitPendingUsagesInContext(ctx)
}
@@ -1328,7 +1330,7 @@ func (dispatcher *DBModelDispatcher) Create(ctx context.Context, query jsonutils
model, err := DoCreate(manager, ctx, userCred, query, data, ownerId)
if err != nil {
if CancelPendingUsagesInContext != nil {
if !dryRun && CancelPendingUsagesInContext != nil {
e := CancelPendingUsagesInContext(ctx, userCred)
if e != nil {
err = errors.Wrapf(err, e.Error())
@@ -1341,6 +1343,10 @@ func (dispatcher *DBModelDispatcher) Create(ctx context.Context, query jsonutils
return nil, httperrors.NewGeneralError(err)
}
if dryRun {
return getItemDetails(manager, model, ctx, userCred, query)
}
func() {
lockman.LockObject(ctx, model)
defer lockman.ReleaseObject(ctx, model)
+4
View File
@@ -75,6 +75,10 @@ func (self *SGuestsecgroup) Delete(ctx context.Context, userCred mcclient.TokenC
return db.DeleteModel(ctx, userCred, self)
}
func (self *SGuestsecgroup) Detach(ctx context.Context, userCred mcclient.TokenCredential) error {
return db.DetachJoint(ctx, userCred, self)
}
func (manager *SGuestsecgroupManager) ListItemFilter(
ctx context.Context,
q *sqlchemy.SQuery,
+1 -1
View File
@@ -1439,7 +1439,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.20230103095152-d51258a2c88d
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230104114513-eab695f13003
## explicit; go 1.18
yunion.io/x/cloudmux/pkg/apis
yunion.io/x/cloudmux/pkg/apis/billing
+7 -2
View File
@@ -423,7 +423,12 @@ func (region *SRegion) CreateISecurityGroup(conf *cloudprovider.SecurityGroupCre
if err != nil {
return nil, errors.Wrapf(err, "region.GetIVpcById(%s)", conf.VpcId)
}
secgroup := &SSecurityGroup{gvpc: gvpc, Tag: strings.ToLower(conf.Name)}
return secgroup, nil
r := *secrules.MustParseSecurityRule("out:allow any")
r.Priority = 1000
rule := cloudprovider.SecurityRule{
Name: "default-rule",
SecurityRule: r,
}
return secgroup, secgroup.gvpc.client.CreateSecurityGroupRule(rule, secgroup.gvpc.SelfLink, secgroup.Tag, secgroup.ServiceAccount)
}
+3 -1
View File
@@ -14,6 +14,8 @@
package multicloud
import "yunion.io/x/cloudmux/pkg/apis"
type SHostBase struct {
SResourceBase
STagBase
@@ -40,5 +42,5 @@ func (host *SHostBase) GetOvnVersion() string {
}
func (host *SHostBase) GetCpuArchitecture() string {
return ""
return apis.OS_ARCH_X86_64
}
+3
View File
@@ -860,6 +860,9 @@ func (region *SRegion) GetIElasticcaches() ([]cloudprovider.ICloudElasticcache,
for {
part, total, err := region.GetMemcaches(nil, 100, offset)
if err != nil {
if errors.Cause(err) == cloudprovider.ErrNotSupported {
return ret, nil
}
return nil, errors.Wrapf(err, "GetMemcaches")
}
mems = append(mems, part...)