protected Void revertSnapshotCallback(AsyncCallbackDispatcher<SnapshotServiceImpl, CommandResult> callback, RevertSnapshotContext<CommandResult> context) { CommandResult result = callback.getResult(); AsyncCallFuture<SnapshotResult> future = context.future; SnapshotResult res = null; try { if (result.isFailed()) { s_logger.debug("revert snapshot failed" + result.getResult()); res = new SnapshotResult(context.snapshot, null); res.setResult(result.getResult()); } else { res = new SnapshotResult(context.snapshot, null); } } catch (Exception e) { s_logger.debug("Failed to in revertSnapshotCallback", e); res.setResult(e.toString()); } future.complete(res); return null; }
protected Void deleteSnapshotCallback(AsyncCallbackDispatcher<SnapshotServiceImpl, CommandResult> callback, DeleteSnapshotContext<CommandResult> context) { CommandResult result = callback.getResult(); AsyncCallFuture<SnapshotResult> future = context.future; SnapshotInfo snapshot = context.snapshot; SnapshotResult res = null; try { if (result.isFailed()) { s_logger.debug("delete snapshot failed" + result.getResult()); snapshot.processEvent(ObjectInDataStoreStateMachine.Event.OperationFailed); res = new SnapshotResult(context.snapshot, null); res.setResult(result.getResult()); } else { snapshot.processEvent(ObjectInDataStoreStateMachine.Event.OperationSuccessed); res = new SnapshotResult(context.snapshot, null); } } catch (Exception e) { s_logger.debug("Failed to in deleteSnapshotCallback", e); res.setResult(e.toString()); } future.complete(res); return null; }
protected Void syncSnapshotCallBack(AsyncCallbackDispatcher<SnapshotServiceImpl, CopyCommandResult> callback, CopySnapshotContext<CommandResult> context) { CopyCommandResult result = callback.getResult(); SnapshotInfo destSnapshot = context.destSnapshot; SnapshotResult res = new SnapshotResult(destSnapshot, null); AsyncCallFuture<SnapshotResult> future = context.future; try { if (result.isFailed()) { res.setResult(result.getResult()); // 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()); } future.complete(res); } catch (Exception e) { s_logger.debug("Failed to process sync snapshot callback", e); res.setResult(e.toString()); future.complete(res); } return null; }
SnapshotObject snapshot = (SnapshotObject)context.snapshot; AsyncCallFuture<SnapshotResult> future = context.future; SnapshotResult snapResult = new SnapshotResult(snapshot, result.getAnswer()); if (result.isFailed()) { s_logger.debug("create snapshot " + context.snapshot.getName() + " failed: " + result.getResult());
CreateSnapshotPayload createSnapshotPayload = (CreateSnapshotPayload)payload; AsyncCallFuture<SnapshotResult> future = context.future; SnapshotResult snapResult = new SnapshotResult(destSnapshot, result.getAnswer()); if (result.isFailed()) { try { destSnapshot.processEvent(Event.OperationSuccessed, copyCmdAnswer); srcSnapshot.processEvent(Snapshot.Event.OperationSucceeded); snapResult = new SnapshotResult(_snapshotFactory.getSnapshot(destSnapshot.getId(), destSnapshot.getDataStore()), copyCmdAnswer); future.complete(snapResult); } catch (Exception e) {
SnapshotObject snapObj = (SnapshotObject)snapshot; AsyncCallFuture<SnapshotResult> future = new AsyncCallFuture<SnapshotResult>(); SnapshotResult result = new SnapshotResult(snapshot, null); Snapshot.State origState = snapObj.getState(); try {