You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by wi...@apache.org on 2013/02/22 15:01:12 UTC
[17/58] [abbrv] git commit: refs/heads/qemu-img - rebase to master
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/0f532c4b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/0f532c4b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/0f532c4b
Branch: refs/heads/qemu-img
Commit: 0f532c4b3a84f8b0d098a55e22c9a3669c99eeb9
Parents: ff047e7
Author: Edison Su <su...@gmail.com>
Authored: Wed Feb 13 17:08:39 2013 -0800
Committer: Edison Su <su...@gmail.com>
Committed: Thu Feb 21 11:22:49 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/0f532c4b/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/0f532c4b/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/0f532c4b/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/0f532c4b/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/0f532c4b/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);
}