1. use equals to compare String

2. if this is empty snapshot, return last one, not throw exception
This commit is contained in:
anthony 2011-05-05 17:24:15 -07:00
parent f48b2b1dad
commit 1ed587088c
2 changed files with 4 additions and 5 deletions

View File

@ -1095,7 +1095,7 @@ def backupSnapshot(session, args):
# There has been no change since the last snapshot so no need to backup
util.SMlog("There has been no change since the last snapshot with backup: " + prevBaseCopyUuid)
# Set the uuid of the current backup to that of last backup
txt = "1#" + prevBaseCopyUuid
txt = "1#" + prevBackupUuid
return txt
# Check existence of snapshot on primary storage

View File

@ -368,7 +368,7 @@ public class SnapshotManagerImpl implements SnapshotManager {
// Update the snapshot in the database
if ((answer != null) && answer.getResult()) {
// The snapshot was successfully created
if (preSnapshotPath != null && preSnapshotPath == answer.getSnapshotPath()) {
if (preSnapshotPath != null && preSnapshotPath.equals(answer.getSnapshotPath())) {
if( preSnapshotVO.getRemoved() != null ) {
String backupPath = preSnapshotVO.getBackupSnapshotId();
@ -376,11 +376,10 @@ public class SnapshotManagerImpl implements SnapshotManager {
createdSnapshot = updateDBOnCreateDuplicate(id, answer.getSnapshotPath(), backupPath);
} else {
// empty snapshot
s_logger.debug("CreateSnapshot: this is empty snapshot, remove it ");
s_logger.debug("CreateSnapshot: this is empty snapshot, use the last one ");
// delete from the snapshots table
_snapshotDao.delete(id);
throw new CloudRuntimeException(
" There is no change since last snapshot, please use last snapshot " + preSnapshotPath);
createdSnapshot = preSnapshotVO;
}
} else {