use of com.cloud.legacymodel.communication.answer.ListTemplateAnswer in project cosmic by MissionCriticalCloud.
the class NfsSecondaryStorageResource method execute.
private Answer execute(final ListTemplateCommand cmd) {
if (!this._inSystemVM) {
return new ListTemplateAnswer(null, null);
}
final DataStoreTO store = cmd.getDataStore();
if (store instanceof NfsTO) {
final NfsTO nfs = (NfsTO) store;
final String secUrl = nfs.getUrl();
final String root = getRootDir(secUrl);
final Map<String, TemplateProp> templateInfos = this._dlMgr.gatherTemplateInfo(root);
return new ListTemplateAnswer(secUrl, templateInfos);
} else {
return new Answer(cmd, false, "Unsupported image data store: " + store);
}
}
use of com.cloud.legacymodel.communication.answer.ListTemplateAnswer in project cosmic by MissionCriticalCloud.
the class TemplateServiceImpl method listTemplate.
private Map<String, TemplateProp> listTemplate(final DataStore ssStore) {
final ListTemplateCommand cmd = new ListTemplateCommand(ssStore.getTO());
final EndPoint ep = _epSelector.select(ssStore);
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 ListTemplateAnswer tanswer = (ListTemplateAnswer) answer;
return tanswer.getTemplateInfo();
} else {
if (s_logger.isDebugEnabled()) {
s_logger.debug("can not list template for secondary storage host " + ssStore.getId());
}
}
return null;
}
Aggregations