Merge pull request #2224 from swordqiu/automated-cherry-pick-of-#2222-upstream-release-2.11

Automated cherry pick of #2222: fix: when turning off non-default-domain-projects, network public scope should swtich to system scope
This commit is contained in:
yunion-ci-robot
2019-08-12 21:57:02 +08:00
committed by GitHub
+6 -1
View File
@@ -34,6 +34,7 @@ import (
"yunion.io/x/sqlchemy"
api "yunion.io/x/onecloud/pkg/apis/compute"
"yunion.io/x/onecloud/pkg/cloudcommon/consts"
"yunion.io/x/onecloud/pkg/cloudcommon/db"
"yunion.io/x/onecloud/pkg/cloudcommon/db/lockman"
"yunion.io/x/onecloud/pkg/cloudcommon/db/taskman"
@@ -678,7 +679,11 @@ func (manager *SNetworkManager) newFromCloudNetwork(ctx context.Context, userCre
net.GuestGateway = extNet.GetGateway()
net.ServerType = extNet.GetServerType()
net.IsPublic = extNet.GetIsPublic()
net.PublicScope = string(extNet.GetPublicScope())
extScope := extNet.GetPublicScope()
if extScope == rbacutils.ScopeDomain && !consts.GetNonDefaultDomainProjects() {
extScope = rbacutils.ScopeSystem
}
net.PublicScope = string(extScope)
net.AllocTimoutSeconds = extNet.GetAllocTimeoutSeconds()