Skip to content

Commit 4f74937

Browse files
Event typo fix (#12350)
1 parent 10dcbd7 commit 4f74937

File tree

15 files changed

+68
-72
lines changed

15 files changed

+68
-72
lines changed

engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/ObjectInDataStoreStateMachine.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ enum State {
3333
Destroying("Template is destroying"),
3434
Destroyed("Template is destroyed"),
3535
Failed("Failed to download Template");
36-
String _description;
36+
final String _description;
3737

38-
private State(String description) {
38+
State(String description) {
3939
_description = description;
4040
}
4141

@@ -48,7 +48,7 @@ enum Event {
4848
CreateRequested,
4949
CreateOnlyRequested,
5050
DestroyRequested,
51-
OperationSuccessed,
51+
OperationSucceeded,
5252
OperationFailed,
5353
CopyRequested,
5454
CopyingRequested,

engine/storage/cache/src/main/java/org/apache/cloudstack/storage/cache/manager/StorageCacheManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ public DataObject createCacheObject(DataObject data, DataStore store) {
323323
if (result.isFailed()) {
324324
objOnCacheStore.processEvent(Event.OperationFailed);
325325
} else {
326-
objOnCacheStore.processEvent(Event.OperationSuccessed, result.getAnswer());
326+
objOnCacheStore.processEvent(Event.OperationSucceeded, result.getAnswer());
327327
objOnCacheStore.incRefCount();
328328
return objOnCacheStore;
329329
}

engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ protected Answer copyVolumeBetweenPools(DataObject srcData, DataObject destData)
396396
return answer;
397397
}
398398

399-
objOnImageStore.processEvent(Event.OperationSuccessed, answer);
399+
objOnImageStore.processEvent(Event.OperationSucceeded, answer);
400400

401401
objOnImageStore.processEvent(Event.CopyingRequested);
402402

@@ -427,7 +427,7 @@ protected Answer copyVolumeBetweenPools(DataObject srcData, DataObject destData)
427427
throw e;
428428
}
429429

430-
objOnImageStore.processEvent(Event.OperationSuccessed);
430+
objOnImageStore.processEvent(Event.OperationSucceeded);
431431
deleteVolumeOnSecondaryStore(objOnImageStore);
432432
return answer;
433433
} else {

engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/StorageSystemDataMotionStrategy.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ private void handleCopyAsyncToSecondaryStorageAdaptive(SnapshotInfo snapshotInfo
10481048

10491049
//submit processEvent
10501050
if (StringUtils.isEmpty(errMsg)) {
1051-
snapshotInfo.processEvent(Event.OperationSuccessed);
1051+
snapshotInfo.processEvent(Event.OperationSucceeded);
10521052
} else {
10531053
snapshotInfo.processEvent(Event.OperationFailed);
10541054
}
@@ -1211,7 +1211,7 @@ else if (HypervisorType.VMware.equals(snapshotInfo.getHypervisorType()) || Hyper
12111211
// command to copy this data from cache to secondary storage. We
12121212
// then clean up the cache.
12131213

1214-
destOnStore.processEvent(Event.OperationSuccessed, copyCmdAnswer);
1214+
destOnStore.processEvent(Event.OperationSucceeded, copyCmdAnswer);
12151215

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

12621262
try {
12631263
if (StringUtils.isEmpty(errMsg)) {
1264-
snapshotInfo.processEvent(Event.OperationSuccessed);
1264+
snapshotInfo.processEvent(Event.OperationSucceeded);
12651265
}
12661266
else {
12671267
snapshotInfo.processEvent(Event.OperationFailed);
@@ -1394,7 +1394,7 @@ private void handleCreateNonManagedVolumeFromManagedSnapshot(SnapshotInfo snapsh
13941394

13951395
try {
13961396
if (StringUtils.isEmpty(errMsg)) {
1397-
snapshotInfo.processEvent(Event.OperationSuccessed);
1397+
snapshotInfo.processEvent(Event.OperationSucceeded);
13981398
}
13991399
else {
14001400
snapshotInfo.processEvent(Event.OperationFailed);
@@ -2316,7 +2316,7 @@ private void handlePostMigration(boolean success, Map<VolumeInfo, VolumeInfo> sr
23162316

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

2319-
_volumeService.copyPoliciesBetweenVolumesAndDestroySourceVolumeAfterMigration(Event.OperationSuccessed, null, srcVolumeInfo, destVolumeInfo, false);
2319+
_volumeService.copyPoliciesBetweenVolumesAndDestroySourceVolumeAfterMigration(Event.OperationSucceeded, null, srcVolumeInfo, destVolumeInfo, false);
23202320

23212321

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

26402640
try {
26412641
if (StringUtils.isEmpty(errMsg)) {
2642-
volumeInfo.processEvent(Event.OperationSuccessed);
2642+
volumeInfo.processEvent(Event.OperationSucceeded);
26432643
}
26442644
else {
26452645
volumeInfo.processEvent(Event.OperationFailed);

engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/SecondaryStorageServiceImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,9 @@ protected Void migrateDataCallBack(AsyncCallbackDispatcher<SecondaryStorageServi
257257
}
258258
} else {
259259
if (destData instanceof VolumeInfo) {
260-
((VolumeInfo) destData).processEventOnly(ObjectInDataStoreStateMachine.Event.OperationSuccessed, answer);
260+
((VolumeInfo) destData).processEventOnly(ObjectInDataStoreStateMachine.Event.OperationSucceeded, answer);
261261
} else {
262-
destData.processEvent(ObjectInDataStoreStateMachine.Event.OperationSuccessed, answer);
262+
destData.processEvent(ObjectInDataStoreStateMachine.Event.OperationSucceeded, answer);
263263
}
264264
updateDataObject(srcData, destData);
265265
logger.debug("Deleting source data");

engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/TemplateServiceImpl.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ protected Void copyTemplateToImageStoreCallback(AsyncCallbackDispatcher<Template
669669
TemplateApiResult res = new TemplateApiResult(tmplt);
670670
if (result.isSuccess()) {
671671
logger.info("Copied template [{}] to image store [{}].", tmplt.getUniqueName(), tmplt.getDataStore().getName());
672-
tmplt.processEvent(Event.OperationSuccessed, result.getAnswer());
672+
tmplt.processEvent(Event.OperationSucceeded, result.getAnswer());
673673
publishTemplateCreation(tmplt);
674674
} else {
675675
logger.warn("Failed to copy template [{}] to image store [{}].", tmplt.getUniqueName(), tmplt.getDataStore().getName());
@@ -822,7 +822,7 @@ protected Void createTemplateCallback(AsyncCallbackDispatcher<TemplateServiceImp
822822
}
823823

824824
try {
825-
template.processEvent(ObjectInDataStoreStateMachine.Event.OperationSuccessed);
825+
template.processEvent(ObjectInDataStoreStateMachine.Event.OperationSucceeded);
826826
} catch (Exception e) {
827827
result.setResult(e.toString());
828828
if (parentCallback != null) {
@@ -1031,7 +1031,7 @@ public Void deleteTemplateCallback(AsyncCallbackDispatcher<TemplateServiceImpl,
10311031
CommandResult result = callback.getResult();
10321032
TemplateObject vo = context.getTemplate();
10331033
if (result.isSuccess()) {
1034-
vo.processEvent(Event.OperationSuccessed);
1034+
vo.processEvent(Event.OperationSucceeded);
10351035
} else {
10361036
vo.processEvent(Event.OperationFailed);
10371037
}
@@ -1091,7 +1091,7 @@ protected Void syncTemplateCallBack(AsyncCallbackDispatcher<TemplateServiceImpl,
10911091
// no change to existing template_store_ref, will try to re-sync later if other call triggers this sync operation, like copy template
10921092
} else {
10931093
// this will update install path properly, next time it will not sync anymore.
1094-
destTemplate.processEvent(Event.OperationSuccessed, result.getAnswer());
1094+
destTemplate.processEvent(Event.OperationSucceeded, result.getAnswer());
10951095
}
10961096
future.complete(res);
10971097
} catch (Exception e) {
@@ -1271,7 +1271,7 @@ protected Void copyTemplateCallBack(AsyncCallbackDispatcher<TemplateServiceImpl,
12711271
res.setResult(result.getResult());
12721272
destTemplate.processEvent(Event.OperationFailed);
12731273
} else {
1274-
destTemplate.processEvent(Event.OperationSuccessed, result.getAnswer());
1274+
destTemplate.processEvent(Event.OperationSucceeded, result.getAnswer());
12751275
}
12761276
future.complete(res);
12771277
} catch (Exception e) {
@@ -1296,7 +1296,7 @@ protected Void copyTemplateCrossZoneCallBack(AsyncCallbackDispatcher<TemplateSer
12961296
res.setResult(result.getResult());
12971297
destTemplate.processEvent(Event.OperationFailed);
12981298
} else {
1299-
destTemplate.processEvent(Event.OperationSuccessed, result.getAnswer());
1299+
destTemplate.processEvent(Event.OperationSucceeded, result.getAnswer());
13001300
}
13011301
future.complete(res);
13021302
} catch (Exception e) {
@@ -1382,7 +1382,7 @@ protected Void createDatadiskTemplateCallback(AsyncCallbackDispatcher<TemplateSe
13821382
TemplateApiResult dataDiskTemplateResult = new TemplateApiResult((TemplateObject)dataDiskTemplate);
13831383
try {
13841384
if (result.isSuccess()) {
1385-
dataDiskTemplate.processEvent(Event.OperationSuccessed, result.getAnswer());
1385+
dataDiskTemplate.processEvent(Event.OperationSucceeded, result.getAnswer());
13861386
} else {
13871387
dataDiskTemplate.processEvent(Event.OperationFailed);
13881388
dataDiskTemplateResult.setResult(result.getResult());

engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot/DefaultSnapshotStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public SnapshotInfo backupSnapshot(SnapshotInfo snapshot) {
131131

132132
CreateObjectAnswer createSnapshotAnswer = new CreateObjectAnswer(snapTO);
133133

134-
snapshotOnImageStore.processEvent(Event.OperationSuccessed, createSnapshotAnswer);
134+
snapshotOnImageStore.processEvent(Event.OperationSucceeded, createSnapshotAnswer);
135135
SnapshotObject snapObj = castSnapshotInfoToSnapshotObject(snapshot);
136136
try {
137137
snapObj.processEvent(Snapshot.Event.OperationNotPerformed);

engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ protected Void createSnapshotAsyncCallback(AsyncCallbackDispatcher<SnapshotServi
212212
}
213213

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

424424
try {
425425
CopyCmdAnswer copyCmdAnswer = (CopyCmdAnswer)result.getAnswer();
426-
destSnapshot.processEvent(Event.OperationSuccessed, copyCmdAnswer);
426+
destSnapshot.processEvent(Event.OperationSucceeded, copyCmdAnswer);
427427
srcSnapshot.processEvent(Snapshot.Event.OperationSucceeded);
428428
snapResult = new SnapshotResult(_snapshotFactory.getSnapshot(destSnapshot.getId(), destSnapshot.getDataStore()), copyCmdAnswer);
429429
future.complete(snapResult);
@@ -448,7 +448,7 @@ protected Void copySnapshotZoneAsyncCallback(AsyncCallbackDispatcher<SnapshotSer
448448
}
449449
try {
450450
Answer answer = result.getAnswer();
451-
destSnapshot.processEvent(Event.OperationSuccessed);
451+
destSnapshot.processEvent(Event.OperationSucceeded);
452452
snapResult = new SnapshotResult(_snapshotFactory.getSnapshot(destSnapshot.getId(), destSnapshot.getDataStore()), answer);
453453
future.complete(snapResult);
454454
} catch (Exception e) {
@@ -491,7 +491,7 @@ protected Void deleteSnapshotCallback(AsyncCallbackDispatcher<SnapshotServiceImp
491491
res = new SnapshotResult(context.snapshot, null);
492492
res.setResult(result.getResult());
493493
} else {
494-
snapshot.processEvent(ObjectInDataStoreStateMachine.Event.OperationSuccessed);
494+
snapshot.processEvent(ObjectInDataStoreStateMachine.Event.OperationSucceeded);
495495
res = new SnapshotResult(context.snapshot, null);
496496
}
497497
} catch (Exception e) {
@@ -681,7 +681,7 @@ protected Void syncSnapshotCallBack(AsyncCallbackDispatcher<SnapshotServiceImpl,
681681
// no change to existing snapshot_store_ref, will try to re-sync later if other call triggers this sync operation
682682
} else {
683683
// this will update install path properly, next time it will not sync anymore.
684-
destSnapshot.processEvent(Event.OperationSuccessed, result.getAnswer());
684+
destSnapshot.processEvent(Event.OperationSucceeded, result.getAnswer());
685685
}
686686
future.complete(res);
687687
} catch (Exception e) {
@@ -711,7 +711,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) {
711711
try {
712712
SnapshotObject srcSnapshot = (SnapshotObject)snapshot;
713713
srcSnapshot.processEvent(Event.DestroyRequested);
714-
srcSnapshot.processEvent(Event.OperationSuccessed);
714+
srcSnapshot.processEvent(Event.OperationSucceeded);
715715

716716
srcSnapshot.processEvent(Snapshot.Event.OperationFailed);
717717

engine/storage/src/main/java/org/apache/cloudstack/storage/datastore/DataObjectManagerImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ protected Void createAsynCallback(AsyncCallbackDispatcher<DataObjectManagerImpl,
178178
}
179179

180180
try {
181-
objectInDataStoreMgr.update(objInStrore, ObjectInDataStoreStateMachine.Event.OperationSuccessed);
181+
objectInDataStoreMgr.update(objInStrore, ObjectInDataStoreStateMachine.Event.OperationSucceeded);
182182
} catch (NoTransitionException e) {
183183
try {
184184
objectInDataStoreMgr.update(objInStrore, ObjectInDataStoreStateMachine.Event.OperationFailed);
@@ -267,7 +267,7 @@ protected Void copyCallback(AsyncCallbackDispatcher<DataObjectManagerImpl, CopyC
267267
}
268268

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

342342
} else {
343343
try {
344-
objectInDataStoreMgr.update(destObj, Event.OperationSuccessed);
344+
objectInDataStoreMgr.update(destObj, Event.OperationSucceeded);
345345
} catch (NoTransitionException e) {
346346
logger.debug("delete failed", e);
347347
} catch (ConcurrentOperationException e) {
@@ -365,7 +365,7 @@ public DataObject createInternalStateOnly(DataObject data, DataStore store) {
365365
event = ObjectInDataStoreStateMachine.Event.CreateRequested;
366366
objectInDataStoreMgr.update(objInStore, event);
367367

368-
objectInDataStoreMgr.update(objInStore, ObjectInDataStoreStateMachine.Event.OperationSuccessed);
368+
objectInDataStoreMgr.update(objInStore, ObjectInDataStoreStateMachine.Event.OperationSucceeded);
369369
} catch (NoTransitionException e) {
370370
logger.debug("Failed to update state", e);
371371
throw new CloudRuntimeException("Failed to update state", e);

engine/storage/src/main/java/org/apache/cloudstack/storage/datastore/ObjectInDataStoreManagerImpl.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,27 +91,27 @@ public ObjectInDataStoreManagerImpl() {
9191
stateMachines.addTransition(State.Allocated, Event.CreateOnlyRequested, State.Creating);
9292
stateMachines.addTransition(State.Allocated, Event.DestroyRequested, State.Destroying);
9393
stateMachines.addTransition(State.Allocated, Event.OperationFailed, State.Failed);
94-
stateMachines.addTransition(State.Allocated, Event.OperationSuccessed, State.Ready);
94+
stateMachines.addTransition(State.Allocated, Event.OperationSucceeded, State.Ready);
9595
stateMachines.addTransition(State.Creating, Event.OperationFailed, State.Allocated);
96-
stateMachines.addTransition(State.Creating, Event.OperationSuccessed, State.Ready);
96+
stateMachines.addTransition(State.Creating, Event.OperationSucceeded, State.Ready);
9797
stateMachines.addTransition(State.Ready, Event.CopyingRequested, State.Copying);
98-
stateMachines.addTransition(State.Copying, Event.OperationSuccessed, State.Ready);
98+
stateMachines.addTransition(State.Copying, Event.OperationSucceeded, State.Ready);
9999
stateMachines.addTransition(State.Copying, Event.OperationFailed, State.Ready);
100100
stateMachines.addTransition(State.Ready, Event.DestroyRequested, State.Destroying);
101101
stateMachines.addTransition(State.Destroying, Event.DestroyRequested, State.Destroying);
102-
stateMachines.addTransition(State.Destroying, Event.OperationSuccessed, State.Destroyed);
102+
stateMachines.addTransition(State.Destroying, Event.OperationSucceeded, State.Destroyed);
103103
stateMachines.addTransition(State.Destroying, Event.OperationFailed, State.Destroying);
104104
stateMachines.addTransition(State.Failed, Event.DestroyRequested, State.Destroying);
105105
// TODO: further investigate why an extra event is sent when it is
106106
// already Ready for DownloadListener
107-
stateMachines.addTransition(State.Ready, Event.OperationSuccessed, State.Ready);
107+
stateMachines.addTransition(State.Ready, Event.OperationSucceeded, State.Ready);
108108
// State transitions for data object migration
109109
stateMachines.addTransition(State.Ready, Event.MigrateDataRequested, State.Migrating);
110110
stateMachines.addTransition(State.Ready, Event.CopyRequested, State.Copying);
111111
stateMachines.addTransition(State.Allocated, Event.MigrateDataRequested, State.Migrating);
112112
stateMachines.addTransition(State.Migrating, Event.MigrationFailed, State.Failed);
113113
stateMachines.addTransition(State.Migrating, Event.MigrationSucceeded, State.Destroyed);
114-
stateMachines.addTransition(State.Migrating, Event.OperationSuccessed, State.Ready);
114+
stateMachines.addTransition(State.Migrating, Event.OperationSucceeded, State.Ready);
115115
stateMachines.addTransition(State.Migrating, Event.OperationFailed, State.Ready);
116116
}
117117

@@ -318,9 +318,7 @@ public boolean update(DataObject data, Event event) throws NoTransitionException
318318
break;
319319
}
320320
} else if (data.getType() == DataObjectType.TEMPLATE && data.getDataStore().getRole() == DataStoreRole.Primary) {
321-
322321
result = this.stateMachines.transitTo(obj, event, null, templatePoolDao);
323-
324322
} else if (data.getType() == DataObjectType.SNAPSHOT && data.getDataStore().getRole() == DataStoreRole.Primary) {
325323
result = this.stateMachines.transitTo(obj, event, null, snapshotDataStoreDao);
326324
} else {
@@ -380,7 +378,5 @@ public DataObjectInStore findObject(long objId, DataObjectType type, long dataSt
380378
}
381379

382380
return vo;
383-
384381
}
385-
386382
}

0 commit comments

Comments
 (0)