Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ enum State {
Destroying("Template is destroying"),
Destroyed("Template is destroyed"),
Failed("Failed to download Template");
String _description;
final String _description;

private State(String description) {
State(String description) {
_description = description;
}

Expand All @@ -48,7 +48,7 @@ enum Event {
CreateRequested,
CreateOnlyRequested,
DestroyRequested,
OperationSuccessed,
OperationSucceeded,
OperationFailed,
CopyRequested,
CopyingRequested,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ public DataObject createCacheObject(DataObject data, DataStore store) {
if (result.isFailed()) {
objOnCacheStore.processEvent(Event.OperationFailed);
} else {
objOnCacheStore.processEvent(Event.OperationSuccessed, result.getAnswer());
objOnCacheStore.processEvent(Event.OperationSucceeded, result.getAnswer());
objOnCacheStore.incRefCount();
return objOnCacheStore;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ protected Answer copyVolumeBetweenPools(DataObject srcData, DataObject destData)
return answer;
}

objOnImageStore.processEvent(Event.OperationSuccessed, answer);
objOnImageStore.processEvent(Event.OperationSucceeded, answer);

objOnImageStore.processEvent(Event.CopyingRequested);

Expand Down Expand Up @@ -427,7 +427,7 @@ protected Answer copyVolumeBetweenPools(DataObject srcData, DataObject destData)
throw e;
}

objOnImageStore.processEvent(Event.OperationSuccessed);
objOnImageStore.processEvent(Event.OperationSucceeded);
deleteVolumeOnSecondaryStore(objOnImageStore);
return answer;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@ private void handleCopyAsyncToSecondaryStorageAdaptive(SnapshotInfo snapshotInfo

//submit processEvent
if (StringUtils.isEmpty(errMsg)) {
snapshotInfo.processEvent(Event.OperationSuccessed);
snapshotInfo.processEvent(Event.OperationSucceeded);
} else {
snapshotInfo.processEvent(Event.OperationFailed);
}
Expand Down Expand Up @@ -1211,7 +1211,7 @@ else if (HypervisorType.VMware.equals(snapshotInfo.getHypervisorType()) || Hyper
// command to copy this data from cache to secondary storage. We
// then clean up the cache.

destOnStore.processEvent(Event.OperationSuccessed, copyCmdAnswer);
destOnStore.processEvent(Event.OperationSucceeded, copyCmdAnswer);

CopyCommand cmd = new CopyCommand(destOnStore.getTO(), destData.getTO(), primaryStorageDownloadWait,
VirtualMachineManager.ExecuteInSequence.value());
Expand Down Expand Up @@ -1261,7 +1261,7 @@ else if (HypervisorType.VMware.equals(snapshotInfo.getHypervisorType()) || Hyper

try {
if (StringUtils.isEmpty(errMsg)) {
snapshotInfo.processEvent(Event.OperationSuccessed);
snapshotInfo.processEvent(Event.OperationSucceeded);
}
else {
snapshotInfo.processEvent(Event.OperationFailed);
Expand Down Expand Up @@ -1394,7 +1394,7 @@ private void handleCreateNonManagedVolumeFromManagedSnapshot(SnapshotInfo snapsh

try {
if (StringUtils.isEmpty(errMsg)) {
snapshotInfo.processEvent(Event.OperationSuccessed);
snapshotInfo.processEvent(Event.OperationSucceeded);
}
else {
snapshotInfo.processEvent(Event.OperationFailed);
Expand Down Expand Up @@ -2316,7 +2316,7 @@ private void handlePostMigration(boolean success, Map<VolumeInfo, VolumeInfo> sr

_volumeDao.update(volumeVO.getId(), volumeVO);

_volumeService.copyPoliciesBetweenVolumesAndDestroySourceVolumeAfterMigration(Event.OperationSuccessed, null, srcVolumeInfo, destVolumeInfo, false);
_volumeService.copyPoliciesBetweenVolumesAndDestroySourceVolumeAfterMigration(Event.OperationSucceeded, null, srcVolumeInfo, destVolumeInfo, false);


// Update the volume ID for snapshots on secondary storage
Expand Down Expand Up @@ -2639,7 +2639,7 @@ private void handleCreateTemplateFromManagedVolume(VolumeInfo volumeInfo, Templa

try {
if (StringUtils.isEmpty(errMsg)) {
volumeInfo.processEvent(Event.OperationSuccessed);
volumeInfo.processEvent(Event.OperationSucceeded);
}
else {
volumeInfo.processEvent(Event.OperationFailed);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ protected Void migrateDataCallBack(AsyncCallbackDispatcher<SecondaryStorageServi
}
} else {
if (destData instanceof VolumeInfo) {
((VolumeInfo) destData).processEventOnly(ObjectInDataStoreStateMachine.Event.OperationSuccessed, answer);
((VolumeInfo) destData).processEventOnly(ObjectInDataStoreStateMachine.Event.OperationSucceeded, answer);
} else {
destData.processEvent(ObjectInDataStoreStateMachine.Event.OperationSuccessed, answer);
destData.processEvent(ObjectInDataStoreStateMachine.Event.OperationSucceeded, answer);
}
updateDataObject(srcData, destData);
logger.debug("Deleting source data");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ protected Void copyTemplateToImageStoreCallback(AsyncCallbackDispatcher<Template
TemplateApiResult res = new TemplateApiResult(tmplt);
if (result.isSuccess()) {
logger.info("Copied template [{}] to image store [{}].", tmplt.getUniqueName(), tmplt.getDataStore().getName());
tmplt.processEvent(Event.OperationSuccessed, result.getAnswer());
tmplt.processEvent(Event.OperationSucceeded, result.getAnswer());
publishTemplateCreation(tmplt);
} else {
logger.warn("Failed to copy template [{}] to image store [{}].", tmplt.getUniqueName(), tmplt.getDataStore().getName());
Expand Down Expand Up @@ -822,7 +822,7 @@ protected Void createTemplateCallback(AsyncCallbackDispatcher<TemplateServiceImp
}

try {
template.processEvent(ObjectInDataStoreStateMachine.Event.OperationSuccessed);
template.processEvent(ObjectInDataStoreStateMachine.Event.OperationSucceeded);
} catch (Exception e) {
result.setResult(e.toString());
if (parentCallback != null) {
Expand Down Expand Up @@ -1031,7 +1031,7 @@ public Void deleteTemplateCallback(AsyncCallbackDispatcher<TemplateServiceImpl,
CommandResult result = callback.getResult();
TemplateObject vo = context.getTemplate();
if (result.isSuccess()) {
vo.processEvent(Event.OperationSuccessed);
vo.processEvent(Event.OperationSucceeded);
} else {
vo.processEvent(Event.OperationFailed);
}
Expand Down Expand Up @@ -1091,7 +1091,7 @@ protected Void syncTemplateCallBack(AsyncCallbackDispatcher<TemplateServiceImpl,
// no change to existing template_store_ref, will try to re-sync later if other call triggers this sync operation, like copy template
} else {
// this will update install path properly, next time it will not sync anymore.
destTemplate.processEvent(Event.OperationSuccessed, result.getAnswer());
destTemplate.processEvent(Event.OperationSucceeded, result.getAnswer());
}
future.complete(res);
} catch (Exception e) {
Expand Down Expand Up @@ -1271,7 +1271,7 @@ protected Void copyTemplateCallBack(AsyncCallbackDispatcher<TemplateServiceImpl,
res.setResult(result.getResult());
destTemplate.processEvent(Event.OperationFailed);
} else {
destTemplate.processEvent(Event.OperationSuccessed, result.getAnswer());
destTemplate.processEvent(Event.OperationSucceeded, result.getAnswer());
}
future.complete(res);
} catch (Exception e) {
Expand All @@ -1296,7 +1296,7 @@ protected Void copyTemplateCrossZoneCallBack(AsyncCallbackDispatcher<TemplateSer
res.setResult(result.getResult());
destTemplate.processEvent(Event.OperationFailed);
} else {
destTemplate.processEvent(Event.OperationSuccessed, result.getAnswer());
destTemplate.processEvent(Event.OperationSucceeded, result.getAnswer());
}
future.complete(res);
} catch (Exception e) {
Expand Down Expand Up @@ -1382,7 +1382,7 @@ protected Void createDatadiskTemplateCallback(AsyncCallbackDispatcher<TemplateSe
TemplateApiResult dataDiskTemplateResult = new TemplateApiResult((TemplateObject)dataDiskTemplate);
try {
if (result.isSuccess()) {
dataDiskTemplate.processEvent(Event.OperationSuccessed, result.getAnswer());
dataDiskTemplate.processEvent(Event.OperationSucceeded, result.getAnswer());
} else {
dataDiskTemplate.processEvent(Event.OperationFailed);
dataDiskTemplateResult.setResult(result.getResult());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public SnapshotInfo backupSnapshot(SnapshotInfo snapshot) {

CreateObjectAnswer createSnapshotAnswer = new CreateObjectAnswer(snapTO);

snapshotOnImageStore.processEvent(Event.OperationSuccessed, createSnapshotAnswer);
snapshotOnImageStore.processEvent(Event.OperationSucceeded, createSnapshotAnswer);
SnapshotObject snapObj = castSnapshotInfoToSnapshotObject(snapshot);
try {
snapObj.processEvent(Snapshot.Event.OperationNotPerformed);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ protected Void createSnapshotAsyncCallback(AsyncCallbackDispatcher<SnapshotServi
}

try {
snapshot.processEvent(Event.OperationSuccessed, result.getAnswer());
snapshot.processEvent(Event.OperationSucceeded, result.getAnswer());
snapshot.processEvent(Snapshot.Event.OperationSucceeded);
} catch (Exception e) {
logger.debug("Failed to create snapshot: ", e);
Expand Down Expand Up @@ -423,7 +423,7 @@ protected Void copySnapshotAsyncCallback(AsyncCallbackDispatcher<SnapshotService

try {
CopyCmdAnswer copyCmdAnswer = (CopyCmdAnswer)result.getAnswer();
destSnapshot.processEvent(Event.OperationSuccessed, copyCmdAnswer);
destSnapshot.processEvent(Event.OperationSucceeded, copyCmdAnswer);
srcSnapshot.processEvent(Snapshot.Event.OperationSucceeded);
snapResult = new SnapshotResult(_snapshotFactory.getSnapshot(destSnapshot.getId(), destSnapshot.getDataStore()), copyCmdAnswer);
future.complete(snapResult);
Expand All @@ -448,7 +448,7 @@ protected Void copySnapshotZoneAsyncCallback(AsyncCallbackDispatcher<SnapshotSer
}
try {
Answer answer = result.getAnswer();
destSnapshot.processEvent(Event.OperationSuccessed);
destSnapshot.processEvent(Event.OperationSucceeded);
snapResult = new SnapshotResult(_snapshotFactory.getSnapshot(destSnapshot.getId(), destSnapshot.getDataStore()), answer);
future.complete(snapResult);
} catch (Exception e) {
Expand Down Expand Up @@ -491,7 +491,7 @@ protected Void deleteSnapshotCallback(AsyncCallbackDispatcher<SnapshotServiceImp
res = new SnapshotResult(context.snapshot, null);
res.setResult(result.getResult());
} else {
snapshot.processEvent(ObjectInDataStoreStateMachine.Event.OperationSuccessed);
snapshot.processEvent(ObjectInDataStoreStateMachine.Event.OperationSucceeded);
res = new SnapshotResult(context.snapshot, null);
}
} catch (Exception e) {
Expand Down Expand Up @@ -681,7 +681,7 @@ protected Void syncSnapshotCallBack(AsyncCallbackDispatcher<SnapshotServiceImpl,
// no change to existing snapshot_store_ref, will try to re-sync later if other call triggers this sync operation
} else {
// this will update install path properly, next time it will not sync anymore.
destSnapshot.processEvent(Event.OperationSuccessed, result.getAnswer());
destSnapshot.processEvent(Event.OperationSucceeded, result.getAnswer());
}
future.complete(res);
} catch (Exception e) {
Expand Down Expand Up @@ -711,7 +711,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) {
try {
SnapshotObject srcSnapshot = (SnapshotObject)snapshot;
srcSnapshot.processEvent(Event.DestroyRequested);
srcSnapshot.processEvent(Event.OperationSuccessed);
srcSnapshot.processEvent(Event.OperationSucceeded);

srcSnapshot.processEvent(Snapshot.Event.OperationFailed);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ protected Void createAsynCallback(AsyncCallbackDispatcher<DataObjectManagerImpl,
}

try {
objectInDataStoreMgr.update(objInStrore, ObjectInDataStoreStateMachine.Event.OperationSuccessed);
objectInDataStoreMgr.update(objInStrore, ObjectInDataStoreStateMachine.Event.OperationSucceeded);
} catch (NoTransitionException e) {
try {
objectInDataStoreMgr.update(objInStrore, ObjectInDataStoreStateMachine.Event.OperationFailed);
Expand Down Expand Up @@ -267,7 +267,7 @@ protected Void copyCallback(AsyncCallbackDispatcher<DataObjectManagerImpl, CopyC
}

try {
objectInDataStoreMgr.update(destObj, ObjectInDataStoreStateMachine.Event.OperationSuccessed);
objectInDataStoreMgr.update(destObj, ObjectInDataStoreStateMachine.Event.OperationSucceeded);
} catch (NoTransitionException e) {
logger.debug("Failed to update copying state: ", e);
try {
Expand Down Expand Up @@ -341,7 +341,7 @@ protected Void deleteAsynCallback(AsyncCallbackDispatcher<DataObjectManagerImpl,

} else {
try {
objectInDataStoreMgr.update(destObj, Event.OperationSuccessed);
objectInDataStoreMgr.update(destObj, Event.OperationSucceeded);
} catch (NoTransitionException e) {
logger.debug("delete failed", e);
} catch (ConcurrentOperationException e) {
Expand All @@ -365,7 +365,7 @@ public DataObject createInternalStateOnly(DataObject data, DataStore store) {
event = ObjectInDataStoreStateMachine.Event.CreateRequested;
objectInDataStoreMgr.update(objInStore, event);

objectInDataStoreMgr.update(objInStore, ObjectInDataStoreStateMachine.Event.OperationSuccessed);
objectInDataStoreMgr.update(objInStore, ObjectInDataStoreStateMachine.Event.OperationSucceeded);
} catch (NoTransitionException e) {
logger.debug("Failed to update state", e);
throw new CloudRuntimeException("Failed to update state", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,27 +91,27 @@ public ObjectInDataStoreManagerImpl() {
stateMachines.addTransition(State.Allocated, Event.CreateOnlyRequested, State.Creating);
stateMachines.addTransition(State.Allocated, Event.DestroyRequested, State.Destroying);
stateMachines.addTransition(State.Allocated, Event.OperationFailed, State.Failed);
stateMachines.addTransition(State.Allocated, Event.OperationSuccessed, State.Ready);
stateMachines.addTransition(State.Allocated, Event.OperationSucceeded, State.Ready);
stateMachines.addTransition(State.Creating, Event.OperationFailed, State.Allocated);
stateMachines.addTransition(State.Creating, Event.OperationSuccessed, State.Ready);
stateMachines.addTransition(State.Creating, Event.OperationSucceeded, State.Ready);
stateMachines.addTransition(State.Ready, Event.CopyingRequested, State.Copying);
stateMachines.addTransition(State.Copying, Event.OperationSuccessed, State.Ready);
stateMachines.addTransition(State.Copying, Event.OperationSucceeded, State.Ready);
stateMachines.addTransition(State.Copying, Event.OperationFailed, State.Ready);
stateMachines.addTransition(State.Ready, Event.DestroyRequested, State.Destroying);
stateMachines.addTransition(State.Destroying, Event.DestroyRequested, State.Destroying);
stateMachines.addTransition(State.Destroying, Event.OperationSuccessed, State.Destroyed);
stateMachines.addTransition(State.Destroying, Event.OperationSucceeded, State.Destroyed);
stateMachines.addTransition(State.Destroying, Event.OperationFailed, State.Destroying);
stateMachines.addTransition(State.Failed, Event.DestroyRequested, State.Destroying);
// TODO: further investigate why an extra event is sent when it is
// already Ready for DownloadListener
stateMachines.addTransition(State.Ready, Event.OperationSuccessed, State.Ready);
stateMachines.addTransition(State.Ready, Event.OperationSucceeded, State.Ready);
// State transitions for data object migration
stateMachines.addTransition(State.Ready, Event.MigrateDataRequested, State.Migrating);
stateMachines.addTransition(State.Ready, Event.CopyRequested, State.Copying);
stateMachines.addTransition(State.Allocated, Event.MigrateDataRequested, State.Migrating);
stateMachines.addTransition(State.Migrating, Event.MigrationFailed, State.Failed);
stateMachines.addTransition(State.Migrating, Event.MigrationSucceeded, State.Destroyed);
stateMachines.addTransition(State.Migrating, Event.OperationSuccessed, State.Ready);
stateMachines.addTransition(State.Migrating, Event.OperationSucceeded, State.Ready);
stateMachines.addTransition(State.Migrating, Event.OperationFailed, State.Ready);
}

Expand Down Expand Up @@ -318,9 +318,7 @@ public boolean update(DataObject data, Event event) throws NoTransitionException
break;
}
} else if (data.getType() == DataObjectType.TEMPLATE && data.getDataStore().getRole() == DataStoreRole.Primary) {

result = this.stateMachines.transitTo(obj, event, null, templatePoolDao);

} else if (data.getType() == DataObjectType.SNAPSHOT && data.getDataStore().getRole() == DataStoreRole.Primary) {
result = this.stateMachines.transitTo(obj, event, null, snapshotDataStoreDao);
} else {
Expand Down Expand Up @@ -380,7 +378,5 @@ public DataObjectInStore findObject(long objId, DataObjectType type, long dataSt
}

return vo;

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ protected Map<ObjectInDataStoreStateMachine.Event, Volume.Event> getMapOfEvents(
}
mapOfEvents.put(ObjectInDataStoreStateMachine.Event.DestroyRequested, Volume.Event.DestroyRequested);
mapOfEvents.put(ObjectInDataStoreStateMachine.Event.ExpungeRequested, Volume.Event.ExpungingRequested);
mapOfEvents.put(ObjectInDataStoreStateMachine.Event.OperationSuccessed, Volume.Event.OperationSucceeded);
mapOfEvents.put(ObjectInDataStoreStateMachine.Event.OperationSucceeded, Volume.Event.OperationSucceeded);
mapOfEvents.put(ObjectInDataStoreStateMachine.Event.MigrationCopySucceeded, Volume.Event.MigrationCopySucceeded);
mapOfEvents.put(ObjectInDataStoreStateMachine.Event.OperationFailed, Volume.Event.OperationFailed);
mapOfEvents.put(ObjectInDataStoreStateMachine.Event.MigrationCopyFailed, Volume.Event.MigrationCopyFailed);
Expand Down
Loading