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;
}
Aggregations