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