use of com.cloud.storage.command.RevertSnapshotCommand in project cosmic by MissionCriticalCloud.
the class CloudStackPrimaryDataStoreDriverImpl method revertSnapshot.
@Override
public void revertSnapshot(final SnapshotInfo snapshot, final SnapshotInfo snapshotOnPrimaryStore, final AsyncCompletionCallback<CommandResult> callback) {
final SnapshotObjectTO snapshotTO = (SnapshotObjectTO) snapshot.getTO();
final RevertSnapshotCommand cmd = new RevertSnapshotCommand(snapshotTO);
final CommandResult result = new CommandResult();
try {
final EndPoint ep = epSelector.select(snapshotOnPrimaryStore);
if (ep == null) {
final String errMsg = "No remote endpoint to send RevertSnapshotCommand, check if host or ssvm is down?";
s_logger.error(errMsg);
result.setResult(errMsg);
} else {
final Answer answer = ep.sendMessage(cmd);
if (answer != null && !answer.getResult()) {
result.setResult(answer.getDetails());
}
}
} catch (final Exception ex) {
s_logger.debug("Unable to revert snapshot " + snapshot.getId(), ex);
result.setResult(ex.toString());
}
callback.complete(result);
}
Aggregations