use of com.cloud.legacymodel.communication.answer.ListVolumeAnswer in project cosmic by MissionCriticalCloud.
the class NfsSecondaryStorageResource method execute.
private Answer execute(final ListVolumeCommand cmd) {
if (!this._inSystemVM) {
return new ListVolumeAnswer(cmd.getSecUrl(), null);
}
final DataStoreTO store = cmd.getDataStore();
if (store instanceof NfsTO) {
final String root = getRootDir(cmd.getSecUrl());
final Map<Long, TemplateProp> templateInfos = this._dlMgr.gatherVolumeInfo(root);
return new ListVolumeAnswer(cmd.getSecUrl(), templateInfos);
} else {
return new Answer(cmd, false, "Unsupported image data store: " + store);
}
}
use of com.cloud.legacymodel.communication.answer.ListVolumeAnswer in project cosmic by MissionCriticalCloud.
the class VolumeServiceImpl method listVolume.
private Map<Long, TemplateProp> listVolume(final DataStore store) {
final ListVolumeCommand cmd = new ListVolumeCommand(store.getTO(), store.getUri());
final EndPoint ep = _epSelector.select(store);
Answer answer = null;
if (ep == null) {
final String errMsg = "No remote endpoint to send command, check if host or ssvm is down?";
s_logger.error(errMsg);
answer = new Answer(cmd, false, errMsg);
} else {
answer = ep.sendMessage(cmd);
}
if (answer != null && answer.getResult()) {
final ListVolumeAnswer tanswer = (ListVolumeAnswer) answer;
return tanswer.getTemplateInfo();
} else {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Can not list volumes for image store " + store.getId());
}
}
return null;
}
Aggregations