Skip to content

Commit 9002067

Browse files
Edison SuEdison Su
authored andcommitted
bug 13771: don't send pre snapshot if it's migrated
status 13771: resolved fixed Reviewed-by: anthony
1 parent b068b7a commit 9002067

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
181181
private ResourceManager _resourceMgr;
182182
@Inject
183183
private DomainManager _domainMgr;
184+
@Inject
185+
private VolumeDao _volumeDao;
184186
String _name;
185187
private int _totalRetries;
186188
private int _pauseInterval;
@@ -282,7 +284,7 @@ public SnapshotVO createSnapshotOnPrimary(VolumeVO volume, Long policyId, Long s
282284

283285
String preSnapshotPath = null;
284286
SnapshotVO preSnapshotVO = null;
285-
if (preId != 0) {
287+
if (preId != 0 && !(volume.getLastPoolId() != null && !volume.getLastPoolId().equals(volume.getPoolId()))) {
286288
preSnapshotVO = _snapshotDao.findByIdIncludingRemoved(preId);
287289
if (preSnapshotVO != null && preSnapshotVO.getBackupSnapshotId() != null) {
288290
preSnapshotPath = preSnapshotVO.getPath();
@@ -337,6 +339,7 @@ public SnapshotVO createSnapshotOnPrimary(VolumeVO volume, Long policyId, Long s
337339
if (volume.getLastPoolId() != null && !volume.getLastPoolId().equals(volume.getPoolId())) {
338340
preSnapshotId = 0;
339341
volume.setLastPoolId(volume.getPoolId());
342+
_volumeDao.update(volume.getId(), volume);
340343
}
341344
snapshot = updateDBOnCreate(snapshotId, answer.getSnapshotPath(), preSnapshotId);
342345
}

0 commit comments

Comments
 (0)