Search in sources :

Example 1 with CreateDatadiskTemplateCommand

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

the class BaseImageStoreDriverImpl method createDataDiskTemplateAsync.

@Override
public Void createDataDiskTemplateAsync(TemplateInfo dataDiskTemplate, String path, String diskId, boolean bootable, long fileSize, AsyncCompletionCallback<CreateCmdResult> callback) {
    Answer answer = null;
    String errMsg = null;
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Create Datadisk template: " + dataDiskTemplate.getId());
    }
    CreateDatadiskTemplateCommand cmd = new CreateDatadiskTemplateCommand(dataDiskTemplate.getTO(), path, diskId, fileSize, bootable);
    EndPoint ep = _defaultEpSelector.select(dataDiskTemplate.getDataStore());
    if (ep == null) {
        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()) {
        errMsg = answer.getDetails();
    }
    CreateCmdResult result = new CreateCmdResult(null, answer);
    result.setResult(errMsg);
    callback.complete(result);
    return null;
}
Also used : GetDatadisksAnswer(com.cloud.agent.api.storage.GetDatadisksAnswer) DownloadAnswer(com.cloud.agent.api.storage.DownloadAnswer) Answer(com.cloud.agent.api.Answer) CreateDatadiskTemplateCommand(com.cloud.agent.api.storage.CreateDatadiskTemplateCommand) EndPoint(org.apache.cloudstack.engine.subsystem.api.storage.EndPoint) CreateCmdResult(org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult)

Aggregations

Answer (com.cloud.agent.api.Answer)1 CreateDatadiskTemplateCommand (com.cloud.agent.api.storage.CreateDatadiskTemplateCommand)1 DownloadAnswer (com.cloud.agent.api.storage.DownloadAnswer)1 GetDatadisksAnswer (com.cloud.agent.api.storage.GetDatadisksAnswer)1 CreateCmdResult (org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult)1 EndPoint (org.apache.cloudstack.engine.subsystem.api.storage.EndPoint)1