From 2d5fde3dc127d994d696aeacf01f73a5025aa403 Mon Sep 17 00:00:00 2001 From: Prasanna Santhanam Date: Thu, 25 Jul 2013 12:08:55 +0530 Subject: [PATCH] Fix the simulator Include the createTemplateFromSnapshot in the storageprocessor. Signed-off-by: Prasanna Santhanam (cherry picked from commit e8383121c60e7c815ba1990df1e8a440f7d87188) --- .../resource/SimulatorStorageProcessor.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) 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();