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; }
} catch (Exception e) { s_logger.debug("Failed to copy snapshot", e); result.setResult("Failed to copy snapshot:" + e.toString()); try {