handle empty snapshot correctly

This commit is contained in:
anthony 2011-10-17 17:24:32 -07:00
parent 4e6377e05a
commit c459604fa2
1 changed files with 2 additions and 2 deletions

View File

@ -719,7 +719,7 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
SnapshotVO snapshot = _snapshotDao.findById(snapshotId);
if (snapshot.getBackupSnapshotId() != null) {
List<SnapshotVO> snaps = _snapshotDao.listByBackupUuid(snapshot.getVolumeId(), snapshot.getBackupSnapshotId());
if (!snaps.isEmpty()) {
if ( snaps != null && snaps.size() > 1 ) {
snapshot.setBackupSnapshotId(null);
_snapshotDao.update(snapshot.getId(), snapshot);
}
@ -756,7 +756,7 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
String BackupSnapshotId = lastSnapshot.getBackupSnapshotId();
if (BackupSnapshotId != null) {
List<SnapshotVO> snaps = _snapshotDao.listByBackupUuid(lastSnapshot.getVolumeId(), BackupSnapshotId);
if (snaps != null && !snaps.isEmpty()) {
if ( snaps != null && snaps.size() > 1) {
lastSnapshot.setBackupSnapshotId(null);
_snapshotDao.update(lastSnapshot.getId(), lastSnapshot);
} else {