Search in sources :

Example 1 with IntroduceObjectAnswer

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

the class XenServerStorageProcessor method forgetObject.

@Override
public Answer forgetObject(final ForgetObjectCmd cmd) {
    try {
        final Connection conn = hypervisorResource.getConnection();
        final DataTO data = cmd.getDataTO();
        final VDI vdi = VDI.getByUuid(conn, data.getPath());
        vdi.forget(conn);
        return new IntroduceObjectAnswer(cmd.getDataTO());
    } catch (final Exception e) {
        s_logger.debug("Failed to introduce object", e);
        return new Answer(cmd, false, e.toString());
    }
}
Also used : CreateObjectAnswer(org.apache.cloudstack.storage.command.CreateObjectAnswer) Answer(com.cloud.agent.api.Answer) ResignatureAnswer(org.apache.cloudstack.storage.command.ResignatureAnswer) IntroduceObjectAnswer(org.apache.cloudstack.storage.command.IntroduceObjectAnswer) AttachPrimaryDataStoreAnswer(org.apache.cloudstack.storage.command.AttachPrimaryDataStoreAnswer) DettachAnswer(org.apache.cloudstack.storage.command.DettachAnswer) SnapshotAndCopyAnswer(org.apache.cloudstack.storage.command.SnapshotAndCopyAnswer) CopyCmdAnswer(org.apache.cloudstack.storage.command.CopyCmdAnswer) AttachAnswer(org.apache.cloudstack.storage.command.AttachAnswer) DataTO(com.cloud.agent.api.to.DataTO) Connection(com.xensource.xenapi.Connection) VDI(com.xensource.xenapi.VDI) IntroduceObjectAnswer(org.apache.cloudstack.storage.command.IntroduceObjectAnswer) XenAPIException(com.xensource.xenapi.Types.XenAPIException) InternalErrorException(com.cloud.exception.InternalErrorException) XmlRpcException(org.apache.xmlrpc.XmlRpcException) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException)

Example 2 with IntroduceObjectAnswer

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

the class XenServerStorageProcessor method introduceObject.

@Override
public Answer introduceObject(final IntroduceObjectCmd cmd) {
    try {
        final Connection conn = hypervisorResource.getConnection();
        final DataStoreTO store = cmd.getDataTO().getDataStore();
        final SR poolSr = hypervisorResource.getStorageRepository(conn, store.getUuid());
        poolSr.scan(conn);
        return new IntroduceObjectAnswer(cmd.getDataTO());
    } catch (final Exception e) {
        s_logger.debug("Failed to introduce object", e);
        return new Answer(cmd, false, e.toString());
    }
}
Also used : CreateObjectAnswer(org.apache.cloudstack.storage.command.CreateObjectAnswer) Answer(com.cloud.agent.api.Answer) ResignatureAnswer(org.apache.cloudstack.storage.command.ResignatureAnswer) IntroduceObjectAnswer(org.apache.cloudstack.storage.command.IntroduceObjectAnswer) AttachPrimaryDataStoreAnswer(org.apache.cloudstack.storage.command.AttachPrimaryDataStoreAnswer) DettachAnswer(org.apache.cloudstack.storage.command.DettachAnswer) SnapshotAndCopyAnswer(org.apache.cloudstack.storage.command.SnapshotAndCopyAnswer) CopyCmdAnswer(org.apache.cloudstack.storage.command.CopyCmdAnswer) AttachAnswer(org.apache.cloudstack.storage.command.AttachAnswer) PrimaryDataStoreTO(org.apache.cloudstack.storage.to.PrimaryDataStoreTO) DataStoreTO(com.cloud.agent.api.to.DataStoreTO) Connection(com.xensource.xenapi.Connection) IntroduceObjectAnswer(org.apache.cloudstack.storage.command.IntroduceObjectAnswer) XenAPIException(com.xensource.xenapi.Types.XenAPIException) InternalErrorException(com.cloud.exception.InternalErrorException) XmlRpcException(org.apache.xmlrpc.XmlRpcException) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) SR(com.xensource.xenapi.SR)

Example 3 with IntroduceObjectAnswer

use of org.apache.cloudstack.storage.command.IntroduceObjectAnswer 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)3 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)3 IntroduceObjectAnswer (org.apache.cloudstack.storage.command.IntroduceObjectAnswer)3 InternalErrorException (com.cloud.exception.InternalErrorException)2 Connection (com.xensource.xenapi.Connection)2 XenAPIException (com.xensource.xenapi.Types.XenAPIException)2 AttachAnswer (org.apache.cloudstack.storage.command.AttachAnswer)2 AttachPrimaryDataStoreAnswer (org.apache.cloudstack.storage.command.AttachPrimaryDataStoreAnswer)2 CopyCmdAnswer (org.apache.cloudstack.storage.command.CopyCmdAnswer)2 CreateObjectAnswer (org.apache.cloudstack.storage.command.CreateObjectAnswer)2 DettachAnswer (org.apache.cloudstack.storage.command.DettachAnswer)2 ResignatureAnswer (org.apache.cloudstack.storage.command.ResignatureAnswer)2 SnapshotAndCopyAnswer (org.apache.cloudstack.storage.command.SnapshotAndCopyAnswer)2 XmlRpcException (org.apache.xmlrpc.XmlRpcException)2 CreateVMSnapshotAnswer (com.cloud.agent.api.CreateVMSnapshotAnswer)1 DataStoreTO (com.cloud.agent.api.to.DataStoreTO)1 DataTO (com.cloud.agent.api.to.DataTO)1 SR (com.xensource.xenapi.SR)1 VDI (com.xensource.xenapi.VDI)1 EndPoint (org.apache.cloudstack.engine.subsystem.api.storage.EndPoint)1