Search in sources :

Example 61 with CopyCmdAnswer

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

the class SimulatorStorageProcessor method createVolumeFromSnapshot.

@Override
public Answer createVolumeFromSnapshot(CopyCommand cmd) {
    DataTO srcData = cmd.getSrcTO();
    SnapshotObjectTO snapshot = (SnapshotObjectTO) srcData;
    String snapshotPath = snapshot.getPath();
    int index = snapshotPath.lastIndexOf("/");
    String snapshotName = snapshotPath.substring(index + 1);
    VolumeObjectTO newVol = new VolumeObjectTO();
    newVol.setPath(snapshotName);
    return new CopyCmdAnswer(newVol);
}
Also used : SnapshotObjectTO(org.apache.cloudstack.storage.to.SnapshotObjectTO) DataTO(com.cloud.agent.api.to.DataTO) VolumeObjectTO(org.apache.cloudstack.storage.to.VolumeObjectTO) CopyCmdAnswer(org.apache.cloudstack.storage.command.CopyCmdAnswer)

Example 62 with CopyCmdAnswer

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

the class SimulatorStorageProcessor method copyTemplateToPrimaryStorage.

@Override
public Answer copyTemplateToPrimaryStorage(CopyCommand cmd) {
    TemplateObjectTO template = new TemplateObjectTO();
    template.setPath(UUID.randomUUID().toString());
    template.setSize(new Long(100));
    template.setFormat(Storage.ImageFormat.RAW);
    return new CopyCmdAnswer(template);
}
Also used : TemplateObjectTO(org.apache.cloudstack.storage.to.TemplateObjectTO) CopyCmdAnswer(org.apache.cloudstack.storage.command.CopyCmdAnswer)

Example 63 with CopyCmdAnswer

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

the class SimulatorStorageProcessor method copyVolumeFromPrimaryToSecondary.

@Override
public Answer copyVolumeFromPrimaryToSecondary(CopyCommand cmd) {
    VolumeObjectTO volume = new VolumeObjectTO();
    volume.setPath(UUID.randomUUID().toString());
    volume.setSize(100);
    volume.setFormat(Storage.ImageFormat.RAW);
    return new CopyCmdAnswer(volume);
}
Also used : VolumeObjectTO(org.apache.cloudstack.storage.to.VolumeObjectTO) CopyCmdAnswer(org.apache.cloudstack.storage.command.CopyCmdAnswer)

Example 64 with CopyCmdAnswer

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

the class SimulatorStorageProcessor method createTemplateFromSnapshot.

@Override
public Answer createTemplateFromSnapshot(CopyCommand cmd) {
    TemplateObjectTO template = (TemplateObjectTO) cmd.getDestTO();
    DataStoreTO imageStore = template.getDataStore();
    String details;
    try {
        if (!(imageStore instanceof NfsTO)) {
            return new CopyCmdAnswer("Only support create template from snapshot, when the dest store is nfs");
        }
        template.setPath(template.getName());
        template.setFormat(Storage.ImageFormat.RAW);
        return new CopyCmdAnswer(template);
    } catch (Throwable e) {
        details = "CreatePrivateTemplateFromSnapshotCommand exception: " + e.toString();
        return new CopyCmdAnswer(details);
    }
}
Also used : DataStoreTO(com.cloud.agent.api.to.DataStoreTO) TemplateObjectTO(org.apache.cloudstack.storage.to.TemplateObjectTO) NfsTO(com.cloud.agent.api.to.NfsTO) CopyCmdAnswer(org.apache.cloudstack.storage.command.CopyCmdAnswer)

Example 65 with CopyCmdAnswer

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

the class SimulatorStorageProcessor method cloneVolumeFromBaseTemplate.

@Override
public Answer cloneVolumeFromBaseTemplate(CopyCommand cmd) {
    VolumeObjectTO volume = new VolumeObjectTO();
    volume.setPath(UUID.randomUUID().toString());
    volume.setSize(100);
    volume.setFormat(Storage.ImageFormat.RAW);
    return new CopyCmdAnswer(volume);
}
Also used : VolumeObjectTO(org.apache.cloudstack.storage.to.VolumeObjectTO) CopyCmdAnswer(org.apache.cloudstack.storage.command.CopyCmdAnswer)

Aggregations

CopyCmdAnswer (org.apache.cloudstack.storage.command.CopyCmdAnswer)78 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)49 NfsTO (com.cloud.agent.api.to.NfsTO)40 DataStoreTO (com.cloud.agent.api.to.DataStoreTO)38 DataTO (com.cloud.agent.api.to.DataTO)37 VolumeObjectTO (org.apache.cloudstack.storage.to.VolumeObjectTO)37 TemplateObjectTO (org.apache.cloudstack.storage.to.TemplateObjectTO)34 PrimaryDataStoreTO (org.apache.cloudstack.storage.to.PrimaryDataStoreTO)30 InternalErrorException (com.cloud.exception.InternalErrorException)27 SnapshotObjectTO (org.apache.cloudstack.storage.to.SnapshotObjectTO)25 Connection (com.xensource.xenapi.Connection)18 XenAPIException (com.xensource.xenapi.Types.XenAPIException)18 XmlRpcException (org.apache.xmlrpc.XmlRpcException)18 SR (com.xensource.xenapi.SR)17 VDI (com.xensource.xenapi.VDI)17 URI (java.net.URI)16 UnsupportedEncodingException (java.io.UnsupportedEncodingException)10 ConfigurationException (javax.naming.ConfigurationException)10 IOException (java.io.IOException)9 CopyCommand (org.apache.cloudstack.storage.command.CopyCommand)9