@@ -191,43 +191,8 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
191191 protected SearchBuilder <SnapshotVO > PolicySnapshotSearch ;
192192 protected SearchBuilder <SnapshotPolicyVO > PoliciesForSnapSearch ;
193193
194- private boolean isVolumeDirty (long volumeId , Long policy ) {
195- VolumeVO volume = _volsDao .findById (volumeId );
196- boolean runSnap = true ;
197-
198- if (volume .getInstanceId () == null ) {
199- long lastSnapId = _snapshotDao .getLastSnapshot (volumeId , 0 );
200- SnapshotVO lastSnap = _snapshotDao .findByIdIncludingRemoved (lastSnapId );
201- if (lastSnap != null ) {
202- Date lastSnapTime = lastSnap .getCreated ();
203- if (lastSnapTime .after (volume .getUpdated ())) {
204- runSnap = false ;
205- s_logger .debug ("Volume: " + volumeId + " is detached and last snap time is after Volume detach time. Skip snapshot for recurring policy" );
206- }
207- }
208- } else if (_storageMgr .volumeInactive (volume )) {
209- // Volume is attached to a VM which is in Stopped state.
210- long lastSnapId = _snapshotDao .getLastSnapshot (volumeId , 0 );
211- SnapshotVO lastSnap = _snapshotDao .findByIdIncludingRemoved (lastSnapId );
212- if (lastSnap != null ) {
213- Date lastSnapTime = lastSnap .getCreated ();
214- VMInstanceVO vmInstance = _vmDao .findById (volume .getInstanceId ());
215- if (vmInstance != null ) {
216- if (lastSnapTime .after (vmInstance .getUpdateTime ())) {
217- runSnap = false ;
218- s_logger .debug ("Volume: " + volumeId + " is inactive and last snap time is after VM update time. Skip snapshot for recurring policy" );
219- }
220- }
221- }
222- }
223- if (volume .getState () == Volume .State .Destroy || volume .getRemoved () != null ) {
224- s_logger .debug ("Volume: " + volumeId + " is destroyed/removed. Not taking snapshot" );
225- runSnap = false ;
226- }
227-
228- return runSnap ;
229- }
230-
194+
195+
231196 protected Answer sendToPool (Volume vol , Command cmd ) {
232197 StoragePool pool = _storagePoolDao .findById (vol .getPoolId ());
233198 VMInstanceVO vm = _vmDao .findById (vol .getInstanceId ());
@@ -434,20 +399,6 @@ public SnapshotVO createSnapshot(Long volumeId, Long policyId, Long snapshotId,
434399 }
435400 }
436401
437- //when taking snapshot, make sure nobody can delete/move the volume
438- boolean stateTransit = false ;
439- /*
440- try {
441- stateTransit = _storageMgr.stateTransitTo(volume, Volume.Event.SnapshotRequested);
442- } catch (NoTransitionException e) {
443- s_logger.debug("Failed transit volume state: " + e.toString());
444- } finally {
445- if (!stateTransit) {
446- _snapshotDao.expunge(snapshotId);
447- throw new CloudRuntimeException("Creating snapshot failed due to volume:" + volumeId + " is being used, try it later ");
448- }
449- }*/
450-
451402 snapshot = createSnapshotOnPrimary (volume , policyId , snapshotId );
452403 if (snapshot != null ) {
453404 if (snapshot .getStatus () == Snapshot .Status .CreatedOnPrimary ) {
@@ -864,7 +815,6 @@ public boolean destroySnapshotBackUp(long snapshotId) {
864815 Long dcId = snapshot .getDataCenterId ();
865816 Long accountId = snapshot .getAccountId ();
866817 Long volumeId = snapshot .getVolumeId ();
867- HypervisorType hvType = snapshot .getHypervisorType ();
868818
869819 String backupOfSnapshot = snapshot .getBackupSnapshotId ();
870820 if (backupOfSnapshot == null ) {
0 commit comments