mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #3380 from Mjoycarry/bugfix/snapshot_sync
Bugfix: Snapshot Sync
This commit is contained in:
@@ -713,14 +713,12 @@ func (self *SSnapshot) SyncWithCloudSnapshot(ctx context.Context, userCred mccli
|
||||
|
||||
// bugfix for now:
|
||||
disk, err := self.GetDisk()
|
||||
if err == sql.ErrNoRows {
|
||||
syncOwnerId = self.GetOwnerId()
|
||||
} else if err != nil {
|
||||
if err != nil && err != sql.ErrNoRows {
|
||||
return errors.Wrapf(err, "get disk of snapshot %s error", self.Id)
|
||||
} else {
|
||||
syncOwnerId = disk.GetOwnerId()
|
||||
}
|
||||
SyncCloudProject(userCred, self, syncOwnerId, ext, self.ManagerId)
|
||||
if err == nil {
|
||||
self.SyncCloudProjectId(userCred, disk.GetOwnerId())
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -760,9 +758,10 @@ func (manager *SSnapshotManager) newFromCloudSnapshot(ctx context.Context, userC
|
||||
|
||||
// bugfix for now:
|
||||
if localDisk != nil {
|
||||
syncOwnerId = localDisk.GetOwnerId()
|
||||
snapshot.SyncCloudProjectId(userCred, localDisk.GetOwnerId())
|
||||
} else {
|
||||
SyncCloudProject(userCred, &snapshot, syncOwnerId, extSnapshot, snapshot.ManagerId)
|
||||
}
|
||||
SyncCloudProject(userCred, &snapshot, syncOwnerId, extSnapshot, snapshot.ManagerId)
|
||||
|
||||
db.OpsLog.LogEvent(&snapshot, db.ACT_CREATE, snapshot.GetShortDesc(ctx), userCred)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user