mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 06:09:39 +08:00
fix: change owner should check required domain list
This commit is contained in:
@@ -240,3 +240,12 @@ func (globalVpc *SGlobalVpc) GetRequiredSharedDomainIds() []string {
|
||||
}
|
||||
return db.ISharableMergeShareRequireDomainIds(requires...)
|
||||
}
|
||||
|
||||
func (globalVpc *SGlobalVpc) GetChangeOwnerRequiredDomainIds() []string {
|
||||
requires := stringutils2.SSortedStrings{}
|
||||
vpcs, _ := globalVpc.GetVpcs()
|
||||
for i := range vpcs {
|
||||
requires = stringutils2.Append(requires, vpcs[i].DomainId)
|
||||
}
|
||||
return requires
|
||||
}
|
||||
|
||||
@@ -5136,6 +5136,15 @@ func (host *SHost) PerformChangeOwner(ctx context.Context, userCred mcclient.Tok
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (host *SHost) GetChangeOwnerRequiredDomainIds() []string {
|
||||
requires := stringutils2.SSortedStrings{}
|
||||
guests := host.GetGuests()
|
||||
for i := range guests {
|
||||
requires = stringutils2.Append(requires, guests[i].DomainId)
|
||||
}
|
||||
return requires
|
||||
}
|
||||
|
||||
func GetHostQuotaKeysFromCreateInput(input api.HostCreateInput) quotas.SDomainRegionalCloudResourceKeys {
|
||||
ownerId := &db.SOwnerId{DomainId: input.ProjectDomain}
|
||||
var zone *SZone
|
||||
|
||||
@@ -1483,6 +1483,15 @@ func (storage *SStorage) performChangeOwnerInternal(ctx context.Context, userCre
|
||||
return storage.SEnabledStatusInfrasResourceBase.PerformChangeOwner(ctx, userCred, query, input)
|
||||
}
|
||||
|
||||
func (storage *SStorage) GetChangeOwnerRequiredDomainIds() []string {
|
||||
requires := stringutils2.SSortedStrings{}
|
||||
disks := storage.GetDisks()
|
||||
for i := range disks {
|
||||
requires = stringutils2.Append(requires, disks[i].DomainId)
|
||||
}
|
||||
return requires
|
||||
}
|
||||
|
||||
func (storage *SStorage) PerformPublic(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, input apis.PerformPublicDomainInput) (jsonutils.JSONObject, error) {
|
||||
// not allow to perform public for locally connected storage
|
||||
if storage.IsLocal() {
|
||||
|
||||
@@ -1097,6 +1097,15 @@ func (vpc *SVpc) GetChangeOwnerCandidateDomainIds() []string {
|
||||
return db.ISharableMergeChangeOwnerCandidateDomainIds(vpc, candidates...)
|
||||
}
|
||||
|
||||
func (vpc *SVpc) GetChangeOwnerRequiredDomainIds() []string {
|
||||
requires := stringutils2.SSortedStrings{}
|
||||
wires := vpc.GetWires()
|
||||
for i := range wires {
|
||||
requires = stringutils2.Append(requires, wires[i].DomainId)
|
||||
}
|
||||
return requires
|
||||
}
|
||||
|
||||
func (vpc *SVpc) GetRequiredSharedDomainIds() []string {
|
||||
wires := vpc.GetWires()
|
||||
if len(wires) == 0 {
|
||||
|
||||
@@ -1024,6 +1024,15 @@ func (wire *SWire) GetChangeOwnerCandidateDomainIds() []string {
|
||||
return db.ISharableMergeChangeOwnerCandidateDomainIds(wire, candidates...)
|
||||
}
|
||||
|
||||
func (wire *SWire) GetChangeOwnerRequiredDomainIds() []string {
|
||||
requires := stringutils2.SSortedStrings{}
|
||||
networks, _ := wire.getNetworks(nil, rbacutils.ScopeNone)
|
||||
for i := range networks {
|
||||
requires = stringutils2.Append(requires, networks[i].DomainId)
|
||||
}
|
||||
return requires
|
||||
}
|
||||
|
||||
func (wire *SWire) GetRequiredSharedDomainIds() []string {
|
||||
networks, _ := wire.getNetworks(nil, rbacutils.ScopeNone)
|
||||
if len(networks) == 0 {
|
||||
|
||||
Reference in New Issue
Block a user