You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ap...@apache.org on 2013/07/25 13:57:25 UTC

[47/50] git commit: updated refs/heads/ldapplugin to 1f64354

Fix the simulator

Include the createTemplateFromSnapshot in the storageprocessor.

Signed-off-by: Prasanna Santhanam <ts...@apache.org>
(cherry picked from commit e8383121c60e7c815ba1990df1e8a440f7d87188)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2d5fde3d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2d5fde3d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2d5fde3d

Branch: refs/heads/ldapplugin
Commit: 2d5fde3dc127d994d696aeacf01f73a5025aa403
Parents: 0010fae
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Thu Jul 25 12:08:55 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Thu Jul 25 14:14:49 2013 +0530

----------------------------------------------------------------------
 .../resource/SimulatorStorageProcessor.java     | 21 ++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d5fde3d/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorStorageProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorStorageProcessor.java b/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorStorageProcessor.java
index d2be9cf..0131c1d 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorStorageProcessor.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorStorageProcessor.java
@@ -94,6 +94,27 @@ public class SimulatorStorageProcessor implements StorageProcessor {
     }
 
     @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();
         DataTO destData = cmd.getDestTO();