Search in sources :

Example 1 with ListTemplateAnswer

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);
    }
}
Also used : TemplateProp(com.cloud.legacymodel.storage.TemplateProp) ListTemplateAnswer(com.cloud.legacymodel.communication.answer.ListTemplateAnswer) GetStorageStatsAnswer(com.cloud.legacymodel.communication.answer.GetStorageStatsAnswer) ReadyAnswer(com.cloud.legacymodel.communication.answer.ReadyAnswer) ListVolumeAnswer(com.cloud.legacymodel.communication.answer.ListVolumeAnswer) Answer(com.cloud.legacymodel.communication.answer.Answer) CopyCmdAnswer(com.cloud.legacymodel.communication.answer.CopyCmdAnswer) CheckHealthAnswer(com.cloud.legacymodel.communication.answer.CheckHealthAnswer) UploadStatusAnswer(com.cloud.legacymodel.communication.answer.UploadStatusAnswer) SecStorageSetupAnswer(com.cloud.legacymodel.communication.answer.SecStorageSetupAnswer) DataStoreTO(com.cloud.legacymodel.to.DataStoreTO) ListTemplateAnswer(com.cloud.legacymodel.communication.answer.ListTemplateAnswer) NfsTO(com.cloud.legacymodel.to.NfsTO)

Example 2 with ListTemplateAnswer

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;
}
Also used : ListTemplateAnswer(com.cloud.legacymodel.communication.answer.ListTemplateAnswer) Answer(com.cloud.legacymodel.communication.answer.Answer) ListTemplateAnswer(com.cloud.legacymodel.communication.answer.ListTemplateAnswer) ListTemplateCommand(com.cloud.legacymodel.communication.command.ListTemplateCommand) EndPoint(com.cloud.engine.subsystem.api.storage.EndPoint)

Aggregations

Answer (com.cloud.legacymodel.communication.answer.Answer)2 ListTemplateAnswer (com.cloud.legacymodel.communication.answer.ListTemplateAnswer)2 EndPoint (com.cloud.engine.subsystem.api.storage.EndPoint)1 CheckHealthAnswer (com.cloud.legacymodel.communication.answer.CheckHealthAnswer)1 CopyCmdAnswer (com.cloud.legacymodel.communication.answer.CopyCmdAnswer)1 GetStorageStatsAnswer (com.cloud.legacymodel.communication.answer.GetStorageStatsAnswer)1 ListVolumeAnswer (com.cloud.legacymodel.communication.answer.ListVolumeAnswer)1 ReadyAnswer (com.cloud.legacymodel.communication.answer.ReadyAnswer)1 SecStorageSetupAnswer (com.cloud.legacymodel.communication.answer.SecStorageSetupAnswer)1 UploadStatusAnswer (com.cloud.legacymodel.communication.answer.UploadStatusAnswer)1 ListTemplateCommand (com.cloud.legacymodel.communication.command.ListTemplateCommand)1 TemplateProp (com.cloud.legacymodel.storage.TemplateProp)1 DataStoreTO (com.cloud.legacymodel.to.DataStoreTO)1 NfsTO (com.cloud.legacymodel.to.NfsTO)1