diff --git a/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorStorageProcessor.java b/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorStorageProcessor.java index d2be9cfbd5b..0131c1da2c4 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorStorageProcessor.java +++ b/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorStorageProcessor.java @@ -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();