Updated Branches: refs/heads/storage_refactor 9d98ece14 -> 3041e6bf6 (forced update)
rebase to master Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/3041e6bf Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/3041e6bf Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/3041e6bf Branch: refs/heads/storage_refactor Commit: 3041e6bf6a082fa34d616d4d3e5df5e9ebd9c715 Parents: 1964708 Author: Edison Su <[email protected]> Authored: Wed Feb 13 17:08:39 2013 -0800 Committer: Edison Su <[email protected]> Committed: Wed Feb 13 17:08:39 2013 -0800 ---------------------------------------------------------------------- api/src/com/cloud/storage/Snapshot.java | 2 +- core/src/com/cloud/storage/SnapshotVO.java | 2 +- .../snapshot/SnapshotStateMachineManagerImpl.java | 2 +- .../snapshot/strategy/AncientSnasphotStrategy.java | 5 +++++ .../cloud/vm/snapshot/VMSnapshotManagerImpl.java | 7 +++++-- 5 files changed, 13 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3041e6bf/api/src/com/cloud/storage/Snapshot.java ---------------------------------------------------------------------- diff --git a/api/src/com/cloud/storage/Snapshot.java b/api/src/com/cloud/storage/Snapshot.java index 9c2217e..f71265c 100644 --- a/api/src/com/cloud/storage/Snapshot.java +++ b/api/src/com/cloud/storage/Snapshot.java @@ -19,7 +19,6 @@ package com.cloud.storage; import java.util.Date; import com.cloud.hypervisor.Hypervisor.HypervisorType; -import com.cloud.utils.fsm.StateMachine2; import com.cloud.utils.fsm.StateObject; import org.apache.cloudstack.acl.ControlledEntity; import org.apache.cloudstack.api.Identity; @@ -55,6 +54,7 @@ public interface Snapshot extends ControlledEntity, Identity, InternalIdentity, } public enum State { + Allocated, Creating, CreatedOnPrimary, BackingUp, http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3041e6bf/core/src/com/cloud/storage/SnapshotVO.java ---------------------------------------------------------------------- diff --git a/core/src/com/cloud/storage/SnapshotVO.java b/core/src/com/cloud/storage/SnapshotVO.java index 1bb0854..78b96ec 100644 --- a/core/src/com/cloud/storage/SnapshotVO.java +++ b/core/src/com/cloud/storage/SnapshotVO.java @@ -117,7 +117,7 @@ public class SnapshotVO implements Snapshot { this.snapshotType = snapshotType; this.typeDescription = typeDescription; this.size = size; - this.state = State.Creating; + this.state = State.Allocated; this.prevSnapshotId = 0; this.hypervisorType = hypervisorType; this.version = "2.2"; http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3041e6bf/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStateMachineManagerImpl.java ---------------------------------------------------------------------- diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStateMachineManagerImpl.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStateMachineManagerImpl.java index a20a2c8..ad65deb 100644 --- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStateMachineManagerImpl.java +++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStateMachineManagerImpl.java @@ -20,7 +20,7 @@ SnapshotStateMachineManager { @Inject protected SnapshotDao snapshotDao; public SnapshotStateMachineManagerImpl() { - stateMachine.addTransition(null, Event.CreateRequested, Snapshot.State.Creating); + stateMachine.addTransition(Snapshot.State.Allocated, Event.CreateRequested, Snapshot.State.Creating); stateMachine.addTransition(Snapshot.State.Creating, Event.OperationSucceeded, Snapshot.State.CreatedOnPrimary); stateMachine.addTransition(Snapshot.State.Creating, Event.OperationNotPerformed, Snapshot.State.BackedUp); stateMachine.addTransition(Snapshot.State.Creating, Event.OperationFailed, Snapshot.State.Error); http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3041e6bf/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/strategy/AncientSnasphotStrategy.java ---------------------------------------------------------------------- diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/strategy/AncientSnasphotStrategy.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/strategy/AncientSnasphotStrategy.java index 2e3b90f..8d72be2 100644 --- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/strategy/AncientSnasphotStrategy.java +++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/strategy/AncientSnasphotStrategy.java @@ -67,6 +67,9 @@ import com.cloud.utils.fsm.NoTransitionException; import com.cloud.vm.UserVmVO; import com.cloud.vm.VirtualMachine.State; import com.cloud.vm.dao.UserVmDao; +import com.cloud.vm.snapshot.VMSnapshot; +import com.cloud.vm.snapshot.VMSnapshotVO; +import com.cloud.vm.snapshot.dao.VMSnapshotDao; @Component public class AncientSnasphotStrategy implements SnapshotStrategy { @@ -103,6 +106,8 @@ public class AncientSnasphotStrategy implements SnapshotStrategy { DataMotionService motionSrv; @Inject ObjectInDataStoreManager objInStoreMgr; + @Inject + VMSnapshotDao _vmSnapshotDao; @Override http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3041e6bf/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java b/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java index a033563..01f3dd3 100644 --- a/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java +++ b/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java @@ -28,6 +28,8 @@ import javax.inject.Inject; import javax.naming.ConfigurationException; import org.apache.cloudstack.api.command.user.vmsnapshot.ListVMSnapshotCmd; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; +import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; import org.apache.log4j.Logger; import org.springframework.stereotype.Component; @@ -61,7 +63,7 @@ import com.cloud.projects.Project.ListProjectResourcesCriteria; import com.cloud.storage.GuestOSVO; import com.cloud.storage.Snapshot; import com.cloud.storage.SnapshotVO; -import com.cloud.storage.StoragePoolVO; +import com.cloud.storage.StoragePool; import com.cloud.storage.VolumeVO; import com.cloud.storage.dao.GuestOSDao; import com.cloud.storage.dao.SnapshotDao; @@ -115,6 +117,7 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana @Inject StoragePoolDao _storagePoolDao; @Inject SnapshotDao _snapshotDao; @Inject VirtualMachineManager _itMgr; + @Inject DataStoreManager dataStoreMgr; @Inject ConfigurationDao _configDao; int _vmSnapshotMax; StateMachine2<VMSnapshot.State, VMSnapshot.Event, VMSnapshot> _vmSnapshottateMachine ; @@ -393,7 +396,7 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana List<VolumeVO> volumeVos = _volumeDao.findByInstance(vmId); for (VolumeVO volume : volumeVos) { - StoragePoolVO pool = _storagePoolDao.findById(volume.getPoolId()); + StoragePool pool = (StoragePool)this.dataStoreMgr.getPrimaryDataStore(volume.getPoolId()); VolumeTO volumeTO = new VolumeTO(volume, pool); volumeTOs.add(volumeTO); }
