From dc64fcab9352babb16958efaa90ebcc29007fdb9 Mon Sep 17 00:00:00 2001 From: Alena Prokharchyk Date: Tue, 25 Sep 2012 15:17:29 -0700 Subject: [PATCH] Removed unused code that was commented out in SnapshotManagerImpl- you can alway retrieve it back from the history if needed Conflicts: server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java --- .../storage/snapshot/SnapshotManagerImpl.java | 54 +------------------ 1 file changed, 2 insertions(+), 52 deletions(-) diff --git a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java index 8a03104a8bf..d89a6d97678 100755 --- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java +++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java @@ -191,43 +191,8 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma protected SearchBuilder PolicySnapshotSearch; protected SearchBuilder PoliciesForSnapSearch; - private boolean isVolumeDirty(long volumeId, Long policy) { - VolumeVO volume = _volsDao.findById(volumeId); - boolean runSnap = true; - - if (volume.getInstanceId() == null) { - long lastSnapId = _snapshotDao.getLastSnapshot(volumeId, 0); - SnapshotVO lastSnap = _snapshotDao.findByIdIncludingRemoved(lastSnapId); - if (lastSnap != null) { - Date lastSnapTime = lastSnap.getCreated(); - if (lastSnapTime.after(volume.getUpdated())) { - runSnap = false; - s_logger.debug("Volume: " + volumeId + " is detached and last snap time is after Volume detach time. Skip snapshot for recurring policy"); - } - } - } else if (_storageMgr.volumeInactive(volume)) { - // Volume is attached to a VM which is in Stopped state. - long lastSnapId = _snapshotDao.getLastSnapshot(volumeId, 0); - SnapshotVO lastSnap = _snapshotDao.findByIdIncludingRemoved(lastSnapId); - if (lastSnap != null) { - Date lastSnapTime = lastSnap.getCreated(); - VMInstanceVO vmInstance = _vmDao.findById(volume.getInstanceId()); - if (vmInstance != null) { - if (lastSnapTime.after(vmInstance.getUpdateTime())) { - runSnap = false; - s_logger.debug("Volume: " + volumeId + " is inactive and last snap time is after VM update time. Skip snapshot for recurring policy"); - } - } - } - } - if (volume.getState() == Volume.State.Destroy || volume.getRemoved() != null) { - s_logger.debug("Volume: " + volumeId + " is destroyed/removed. Not taking snapshot"); - runSnap = false; - } - - return runSnap; - } - + + protected Answer sendToPool(Volume vol, Command cmd) { StoragePool pool = _storagePoolDao.findById(vol.getPoolId()); VMInstanceVO vm = _vmDao.findById(vol.getInstanceId()); @@ -434,20 +399,6 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma } } - //when taking snapshot, make sure nobody can delete/move the volume - boolean stateTransit = false; - /* - try { - stateTransit = _storageMgr.stateTransitTo(volume, Volume.Event.SnapshotRequested); - } catch (NoTransitionException e) { - s_logger.debug("Failed transit volume state: " + e.toString()); - } finally { - if (!stateTransit) { - _snapshotDao.expunge(snapshotId); - throw new CloudRuntimeException("Creating snapshot failed due to volume:" + volumeId + " is being used, try it later "); - } - }*/ - snapshot = createSnapshotOnPrimary(volume, policyId, snapshotId); if (snapshot != null) { if (snapshot.getStatus() == Snapshot.Status.CreatedOnPrimary) { @@ -864,7 +815,6 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma Long dcId = snapshot.getDataCenterId(); Long accountId = snapshot.getAccountId(); Long volumeId = snapshot.getVolumeId(); - HypervisorType hvType = snapshot.getHypervisorType(); String backupOfSnapshot = snapshot.getBackupSnapshotId(); if (backupOfSnapshot == null) {