Search in sources :

Example 1 with ListVolumeAnswer

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);
    }
}
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) ListVolumeAnswer(com.cloud.legacymodel.communication.answer.ListVolumeAnswer) NfsTO(com.cloud.legacymodel.to.NfsTO)

Example 2 with ListVolumeAnswer

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

Aggregations

Answer (com.cloud.legacymodel.communication.answer.Answer)2 CopyCmdAnswer (com.cloud.legacymodel.communication.answer.CopyCmdAnswer)2 ListVolumeAnswer (com.cloud.legacymodel.communication.answer.ListVolumeAnswer)2 EndPoint (com.cloud.engine.subsystem.api.storage.EndPoint)1 CheckHealthAnswer (com.cloud.legacymodel.communication.answer.CheckHealthAnswer)1 GetStorageStatsAnswer (com.cloud.legacymodel.communication.answer.GetStorageStatsAnswer)1 ListTemplateAnswer (com.cloud.legacymodel.communication.answer.ListTemplateAnswer)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 ListVolumeCommand (com.cloud.legacymodel.communication.command.ListVolumeCommand)1 TemplateProp (com.cloud.legacymodel.storage.TemplateProp)1 DataStoreTO (com.cloud.legacymodel.to.DataStoreTO)1 NfsTO (com.cloud.legacymodel.to.NfsTO)1 RemoteHostEndPoint (com.cloud.storage.RemoteHostEndPoint)1