Fix the simulator

Include the createTemplateFromSnapshot in the storageprocessor.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
(cherry picked from commit e8383121c60e7c815ba1990df1e8a440f7d87188)
This commit is contained in:
Prasanna Santhanam 2013-07-25 12:08:55 +05:30
parent 0010faee4b
commit 2d5fde3dc1

View File

@ -93,6 +93,27 @@ public class SimulatorStorageProcessor implements StorageProcessor {
return new CopyCmdAnswer(template);
}
@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);
}
}
@Override
public Answer backupSnapshot(CopyCommand cmd) {
DataTO srcData = cmd.getSrcTO();