use of com.cloud.legacymodel.communication.command.CreateObjectCommand in project cosmic by MissionCriticalCloud.
the class CloudStackPrimaryDataStoreDriverImpl method takeSnapshot.
@Override
public void takeSnapshot(final SnapshotInfo snapshot, final AsyncCompletionCallback<CreateCmdResult> callback) {
CreateCmdResult result = null;
try {
final SnapshotObjectTO snapshotTO = (SnapshotObjectTO) snapshot.getTO();
final Object payload = snapshot.getPayload();
if (payload != null && payload instanceof CreateSnapshotPayload) {
final CreateSnapshotPayload snapshotPayload = (CreateSnapshotPayload) payload;
snapshotTO.setQuiescevm(snapshotPayload.getQuiescevm());
}
final CreateObjectCommand cmd = new CreateObjectCommand(snapshotTO);
final EndPoint ep = epSelector.select(snapshot, StorageAction.TAKESNAPSHOT);
Answer answer = null;
if (ep == null) {
final String errMsg = "No remote endpoint to send createObjectCommand, check if host or ssvm is down?";
s_logger.error(errMsg);
answer = new Answer(cmd, false, errMsg);
} else {
answer = ep.sendMessage(cmd);
}
result = new CreateCmdResult(null, answer);
if (answer != null && !answer.getResult()) {
result.setResult(answer.getDetails());
}
callback.complete(result);
return;
} catch (final Exception e) {
s_logger.debug("Failed to take snapshot: " + snapshot.getId(), e);
result = new CreateCmdResult(null, null);
result.setResult(e.toString());
}
callback.complete(result);
}
use of com.cloud.legacymodel.communication.command.CreateObjectCommand in project cosmic by MissionCriticalCloud.
the class CloudStackPrimaryDataStoreDriverImpl method createVolume.
public Answer createVolume(final VolumeInfo volume) throws StorageUnavailableException {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Creating volume: " + volume);
}
final CreateObjectCommand cmd = new CreateObjectCommand(volume.getTO());
final EndPoint ep = epSelector.select(volume);
Answer answer = null;
if (ep == null) {
final String errMsg = "No remote endpoint to send DeleteCommand, check if host or ssvm is down?";
s_logger.error(errMsg);
answer = new Answer(cmd, false, errMsg);
} else {
answer = ep.sendMessage(cmd);
}
return answer;
}
Aggregations