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
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit:
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/d4261f84
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/d4261f84
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/d4261f84
Branch: refs/heads/4.0
Commit: d4261f84009a122a4ff5ffd05a65de9860123a50
Parents: d55212e
Author: Alena Prokharchyk <[email protected]>
Authored: Tue Sep 25 15:17:29 2012 -0700
Committer: Edison Su <[email protected]>
Committed: Thu Sep 27 17:22:10 2012 -0700
----------------------------------------------------------------------
.../storage/snapshot/SnapshotManagerImpl.java | 54 +--------------
1 files changed, 2 insertions(+), 52 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d4261f84/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
index 8a03104..d89a6d9 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<SnapshotVO> PolicySnapshotSearch;
protected SearchBuilder<SnapshotPolicyVO> 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) {