Search in sources :

Example 1 with IntroduceObjectCmd

use of org.apache.cloudstack.storage.command.IntroduceObjectCmd in project cloudstack by apache.

the class HypervisorHelperImpl method introduceObject.

@Override
public DataTO introduceObject(DataTO object, Scope scope, Long storeId) {
    EndPoint ep = selector.select(scope, storeId);
    IntroduceObjectCmd cmd = new IntroduceObjectCmd(object);
    Answer answer = null;
    if (ep == null) {
        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()) {
        String errMsg = answer == null ? null : answer.getDetails();
        throw new CloudRuntimeException("Failed to introduce object, due to " + errMsg);
    }
    IntroduceObjectAnswer introduceObjectAnswer = (IntroduceObjectAnswer) answer;
    return introduceObjectAnswer.getDataTO();
}
Also used : CreateVMSnapshotAnswer(com.cloud.agent.api.CreateVMSnapshotAnswer) Answer(com.cloud.agent.api.Answer) IntroduceObjectAnswer(org.apache.cloudstack.storage.command.IntroduceObjectAnswer) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) EndPoint(org.apache.cloudstack.engine.subsystem.api.storage.EndPoint) IntroduceObjectAnswer(org.apache.cloudstack.storage.command.IntroduceObjectAnswer) IntroduceObjectCmd(org.apache.cloudstack.storage.command.IntroduceObjectCmd)

Aggregations

Answer (com.cloud.agent.api.Answer)1 CreateVMSnapshotAnswer (com.cloud.agent.api.CreateVMSnapshotAnswer)1 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)1 EndPoint (org.apache.cloudstack.engine.subsystem.api.storage.EndPoint)1 IntroduceObjectAnswer (org.apache.cloudstack.storage.command.IntroduceObjectAnswer)1 IntroduceObjectCmd (org.apache.cloudstack.storage.command.IntroduceObjectCmd)1