mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-10-24 23:41:52 +08:00
fix(region): make project of instance snapshot be consistent with the instance
This commit is contained in:
@@ -4335,6 +4335,17 @@ func (guest *SGuest) PerformChangeOwner(ctx context.Context, userCred mcclient.T
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
// change owner for instance snapshot
|
||||
isps, err := guest.GetInstanceSnapshots()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "unable to GetInstanceSnapshots")
|
||||
}
|
||||
for i := range isps {
|
||||
_, err := isps[i].PerformChangeOwner(ctx, userCred, query, input)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "unable to change owner for instance snapshot %s", isps[i].GetId())
|
||||
}
|
||||
}
|
||||
return guest.SVirtualResourceBase.PerformChangeOwner(ctx, userCred, query, input)
|
||||
}
|
||||
|
||||
|
||||
@@ -281,8 +281,8 @@ func (self *SInstanceSnapshot) StartCreateInstanceSnapshotTask(
|
||||
|
||||
func (manager *SInstanceSnapshotManager) fillInstanceSnapshot(userCred mcclient.TokenCredential, guest *SGuest, instanceSnapshot *SInstanceSnapshot) {
|
||||
instanceSnapshot.SetModelManager(manager, instanceSnapshot)
|
||||
instanceSnapshot.ProjectId = userCred.GetProjectId()
|
||||
instanceSnapshot.DomainId = userCred.GetProjectDomainId()
|
||||
instanceSnapshot.ProjectId = guest.ProjectId
|
||||
instanceSnapshot.DomainId = guest.DomainId
|
||||
instanceSnapshot.GuestId = guest.Id
|
||||
guestSchedInput := guest.ToSchedDesc()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user