mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/yunionio/cloudpods.git
synced 2026-09-20 08:03:53 +08:00
Merge pull request #15704 from ioito/automated-cherry-pick-of-#15701-upstream-release-3.9
Automated cherry pick of #15701: fix(region): vender update
This commit is contained in:
@@ -1309,7 +1309,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)
|
||||
}
|
||||
|
||||
@@ -1317,7 +1319,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())
|
||||
@@ -1330,6 +1332,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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
package multicloud
|
||||
|
||||
import "yunion.io/x/onecloud/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
|
||||
}
|
||||
|
||||
@@ -1078,6 +1078,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...)
|
||||
|
||||
Reference in New Issue
Block a user