Search in sources :

Example 1 with GetDatadisksCommand

use of com.cloud.agent.api.storage.GetDatadisksCommand in project cloudstack by apache.

the class BaseImageStoreDriverImpl method getDataDiskTemplates.

@Override
public List<DatadiskTO> getDataDiskTemplates(DataObject obj, String configurationId) {
    List<DatadiskTO> dataDiskDetails = new ArrayList<DatadiskTO>();
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Get the data disks present in the OVA template");
    }
    DataStore store = obj.getDataStore();
    GetDatadisksCommand cmd = new GetDatadisksCommand(obj.getTO(), configurationId);
    EndPoint ep = _defaultEpSelector.select(store);
    Answer answer = null;
    if (ep == null) {
        String errMsg = "No remote endpoint to send command, check if host or ssvm is down?";
        LOGGER.error(errMsg);
        answer = new Answer(cmd, false, errMsg);
    } else {
        answer = ep.sendMessage(cmd);
    }
    if (answer != null && answer.getResult()) {
        GetDatadisksAnswer getDatadisksAnswer = (GetDatadisksAnswer) answer;
        // Details - Disk path, virtual size
        dataDiskDetails = getDatadisksAnswer.getDataDiskDetails();
    } else {
        throw new CloudRuntimeException("Get Data disk command failed " + answer.getDetails());
    }
    return dataDiskDetails;
}
Also used : GetDatadisksAnswer(com.cloud.agent.api.storage.GetDatadisksAnswer) DownloadAnswer(com.cloud.agent.api.storage.DownloadAnswer) Answer(com.cloud.agent.api.Answer) DatadiskTO(com.cloud.agent.api.to.DatadiskTO) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) DataStore(org.apache.cloudstack.engine.subsystem.api.storage.DataStore) ArrayList(java.util.ArrayList) GetDatadisksCommand(com.cloud.agent.api.storage.GetDatadisksCommand) EndPoint(org.apache.cloudstack.engine.subsystem.api.storage.EndPoint) GetDatadisksAnswer(com.cloud.agent.api.storage.GetDatadisksAnswer)

Aggregations

Answer (com.cloud.agent.api.Answer)1 DownloadAnswer (com.cloud.agent.api.storage.DownloadAnswer)1 GetDatadisksAnswer (com.cloud.agent.api.storage.GetDatadisksAnswer)1 GetDatadisksCommand (com.cloud.agent.api.storage.GetDatadisksCommand)1 DatadiskTO (com.cloud.agent.api.to.DatadiskTO)1 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)1 ArrayList (java.util.ArrayList)1 DataStore (org.apache.cloudstack.engine.subsystem.api.storage.DataStore)1 EndPoint (org.apache.cloudstack.engine.subsystem.api.storage.EndPoint)1