Skip to content

Commit 0f532c4

Browse files
committed
rebase to master
1 parent ff047e7 commit 0f532c4

5 files changed

Lines changed: 13 additions & 5 deletions

File tree

api/src/com/cloud/storage/Snapshot.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import java.util.Date;
2020

2121
import com.cloud.hypervisor.Hypervisor.HypervisorType;
22-
import com.cloud.utils.fsm.StateMachine2;
2322
import com.cloud.utils.fsm.StateObject;
2423
import org.apache.cloudstack.acl.ControlledEntity;
2524
import org.apache.cloudstack.api.Identity;
@@ -55,6 +54,7 @@ public boolean equals(String snapshotType) {
5554
}
5655

5756
public enum State {
57+
Allocated,
5858
Creating,
5959
CreatedOnPrimary,
6060
BackingUp,

core/src/com/cloud/storage/SnapshotVO.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public SnapshotVO(long dcId, long accountId, long domainId, Long volumeId, Long
117117
this.snapshotType = snapshotType;
118118
this.typeDescription = typeDescription;
119119
this.size = size;
120-
this.state = State.Creating;
120+
this.state = State.Allocated;
121121
this.prevSnapshotId = 0;
122122
this.hypervisorType = hypervisorType;
123123
this.version = "2.2";

engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStateMachineManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class SnapshotStateMachineManagerImpl implements
2020
@Inject
2121
protected SnapshotDao snapshotDao;
2222
public SnapshotStateMachineManagerImpl() {
23-
stateMachine.addTransition(null, Event.CreateRequested, Snapshot.State.Creating);
23+
stateMachine.addTransition(Snapshot.State.Allocated, Event.CreateRequested, Snapshot.State.Creating);
2424
stateMachine.addTransition(Snapshot.State.Creating, Event.OperationSucceeded, Snapshot.State.CreatedOnPrimary);
2525
stateMachine.addTransition(Snapshot.State.Creating, Event.OperationNotPerformed, Snapshot.State.BackedUp);
2626
stateMachine.addTransition(Snapshot.State.Creating, Event.OperationFailed, Snapshot.State.Error);

engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/strategy/AncientSnasphotStrategy.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@
6767
import com.cloud.vm.UserVmVO;
6868
import com.cloud.vm.VirtualMachine.State;
6969
import com.cloud.vm.dao.UserVmDao;
70+
import com.cloud.vm.snapshot.VMSnapshot;
71+
import com.cloud.vm.snapshot.VMSnapshotVO;
72+
import com.cloud.vm.snapshot.dao.VMSnapshotDao;
7073

7174
@Component
7275
public class AncientSnasphotStrategy implements SnapshotStrategy {
@@ -103,6 +106,8 @@ public class AncientSnasphotStrategy implements SnapshotStrategy {
103106
DataMotionService motionSrv;
104107
@Inject
105108
ObjectInDataStoreManager objInStoreMgr;
109+
@Inject
110+
VMSnapshotDao _vmSnapshotDao;
106111

107112

108113
@Override

server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
import javax.naming.ConfigurationException;
2929

3030
import org.apache.cloudstack.api.command.user.vmsnapshot.ListVMSnapshotCmd;
31+
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
32+
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
3133
import org.apache.log4j.Logger;
3234
import org.springframework.stereotype.Component;
3335

@@ -61,7 +63,7 @@
6163
import com.cloud.storage.GuestOSVO;
6264
import com.cloud.storage.Snapshot;
6365
import com.cloud.storage.SnapshotVO;
64-
import com.cloud.storage.StoragePoolVO;
66+
import com.cloud.storage.StoragePool;
6567
import com.cloud.storage.VolumeVO;
6668
import com.cloud.storage.dao.GuestOSDao;
6769
import com.cloud.storage.dao.SnapshotDao;
@@ -115,6 +117,7 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana
115117
@Inject StoragePoolDao _storagePoolDao;
116118
@Inject SnapshotDao _snapshotDao;
117119
@Inject VirtualMachineManager _itMgr;
120+
@Inject DataStoreManager dataStoreMgr;
118121
@Inject ConfigurationDao _configDao;
119122
int _vmSnapshotMax;
120123
StateMachine2<VMSnapshot.State, VMSnapshot.Event, VMSnapshot> _vmSnapshottateMachine ;
@@ -393,7 +396,7 @@ protected List<VolumeTO> getVolumeTOList(Long vmId) {
393396
List<VolumeVO> volumeVos = _volumeDao.findByInstance(vmId);
394397

395398
for (VolumeVO volume : volumeVos) {
396-
StoragePoolVO pool = _storagePoolDao.findById(volume.getPoolId());
399+
StoragePool pool = (StoragePool)this.dataStoreMgr.getPrimaryDataStore(volume.getPoolId());
397400
VolumeTO volumeTO = new VolumeTO(volume, pool);
398401
volumeTOs.add(volumeTO);
399402
}

0 commit comments

Comments
 (0)