bug 7386: fixing the recurrent snapshots

status 7386: resolved fixed
This commit is contained in:
abhishek 2010-12-29 16:22:53 -08:00
parent ed35b54224
commit 2d6875f711
3 changed files with 12 additions and 2 deletions

View File

@ -120,13 +120,18 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
@Override
public void create(){
long id = _snapshotService.getNextInSequence(this);
Long id = _snapshotService.getNextInSequence(this);
this.setEntityId(id);
}
@Override
public void execute(){
try {
if (this.getEntityId() == null) {
Long id = _snapshotService.getNextInSequence(this);
this.setEntityId(id);
}
Snapshot snapshot = _snapshotService.createSnapshot(this);
if (snapshot != null) {
SnapshotResponse response = _responseGenerator.createSnapshotResponse(snapshot);

View File

@ -382,7 +382,9 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
throw new CloudRuntimeException("Creating snapshot failed due to " + e.toString());
} finally {
// Cleanup jobs to do after the snapshot has been created.
postCreateSnapshot(volumeId, snapshotId, policyId, backedUp);
if( snapshotId != null) {
postCreateSnapshot(volumeId, snapshotId, policyId, backedUp);
}
_volsDao.releaseFromLockTable(volumeId);
}

View File

@ -223,6 +223,9 @@ public class SnapshotSchedulerImpl implements SnapshotScheduler {
Map<String, String> params = new HashMap<String, String>();
params.put("volumeid", ""+volumeId);
params.put("policyid", ""+policyId);
params.put("ctxUserId", "1");
params.put("ctxAccountId", "1");
AsyncJobVO job = new AsyncJobVO();
job.setUserId(userId);
// Just have SYSTEM own the job for now. Users won't be able to see this job, but