fix(region): set security group domain id (#21093)

This commit is contained in:
屈轩
2024-08-26 17:27:06 +08:00
committed by GitHub
parent dbf7b5f67d
commit 6f5f7e96f7
2 changed files with 5 additions and 2 deletions
+3 -1
View File
@@ -27,6 +27,7 @@ import (
"yunion.io/x/pkg/util/secrules"
"yunion.io/x/sqlchemy"
"yunion.io/x/onecloud/pkg/apis"
billing_api "yunion.io/x/onecloud/pkg/apis/billing"
api "yunion.io/x/onecloud/pkg/apis/compute"
"yunion.io/x/onecloud/pkg/cloudcommon/db"
@@ -339,7 +340,8 @@ func (self *SGoogleRegionDriver) CreateDefaultSecurityGroup(
newGroup.Name = fmt.Sprintf("default-auto-%d", time.Now().Unix())
newGroup.Description = "auto generage"
newGroup.ManagerId = vpc.ManagerId
newGroup.DomainId = ownerId.GetDomainId()
newGroup.DomainId = ownerId.GetProjectDomainId()
newGroup.ProjectSrc = string(apis.OWNER_SOURCE_LOCAL)
newGroup.GlobalvpcId = vpc.GlobalvpcId
newGroup.ProjectId = ownerId.GetProjectId()
err := models.SecurityGroupManager.TableSpec().Insert(ctx, newGroup)
+2 -1
View File
@@ -3457,8 +3457,9 @@ func (self *SManagedVirtualizationRegionDriver) CreateDefaultSecurityGroup(
newGroup.VpcId = vpc.Id
newGroup.ManagerId = vpc.ManagerId
newGroup.CloudregionId = vpc.CloudregionId
newGroup.DomainId = ownerId.GetDomainId()
newGroup.DomainId = ownerId.GetProjectDomainId()
newGroup.ProjectId = ownerId.GetProjectId()
newGroup.ProjectSrc = string(apis.OWNER_SOURCE_LOCAL)
err := models.SecurityGroupManager.TableSpec().Insert(ctx, newGroup)
if err != nil {
return nil, errors.Wrapf(err, "insert")