bug CS-15200: Introducing state transition when volume is getting copied from secondary storage and it is put into Creating state

Reviewed-by: Kishan
This commit is contained in:
Nitin Mehta 2012-08-03 16:15:22 +05:30
parent 44c067cd10
commit a82ad3b3bc
2 changed files with 5 additions and 3 deletions

View File

@ -32,7 +32,7 @@ public interface Volume extends ControlledEntity, BasedOn, StateObject<Volume.St
Snapshotting("There is a snapshot created on this volume, not backed up to secondary storage yet"),
Expunging("The volume is being expunging"),
Destroy("The volume is destroyed, and can't be recovered."),
UploadOp ("The volume upload operation is in progress");
UploadOp ("The volume upload operation is in progress or in short the volume is on secondary storage");
String _description;
@ -57,9 +57,10 @@ public interface Volume extends ControlledEntity, BasedOn, StateObject<Volume.St
s_fsm.addTransition(Creating, Event.OperationSucceeded, Ready);
s_fsm.addTransition(Creating, Event.DestroyRequested, Destroy);
s_fsm.addTransition(Creating, Event.CreateRequested, Creating);
s_fsm.addTransition(Allocated, Event.UploadRequested, UploadOp);
s_fsm.addTransition(Allocated, Event.UploadRequested, UploadOp);
s_fsm.addTransition(UploadOp, Event.CopyRequested, Creating);// CopyRequested for volume from sec to primary storage
s_fsm.addTransition(Creating, Event.CopySucceeded, Ready);
s_fsm.addTransition(UploadOp, Event.CopySucceeded, Ready);
s_fsm.addTransition(Creating, Event.CopyFailed, UploadOp);// Copying volume from sec to primary failed.
s_fsm.addTransition(UploadOp, Event.DestroyRequested, Destroy);
s_fsm.addTransition(Ready, Event.DestroyRequested, Destroy);
s_fsm.addTransition(Destroy, Event.ExpungingRequested, Expunging);

View File

@ -732,6 +732,7 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag
StoragePoolVO destPool = findStoragePool(dskCh, dc, pod, clusterId, vm, avoidPools);
// Copy the volume from secondary storage to the destination storage pool
stateTransitTo(volume, Event.CopyRequested);
VolumeHostVO volumeHostVO = _volumeHostDao.findByVolumeId(volume.getId());
HostVO secStorage = _hostDao.findById(volumeHostVO.getHostId());
String secondaryStorageURL = secStorage.getStorageUrl();