Skip to content

Commit 2d5fde3

Browse files
author
Prasanna Santhanam
committed
Fix the simulator
Include the createTemplateFromSnapshot in the storageprocessor. Signed-off-by: Prasanna Santhanam <tsp@apache.org> (cherry picked from commit e8383121c60e7c815ba1990df1e8a440f7d87188)
1 parent 0010fae commit 2d5fde3

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorStorageProcessor.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,27 @@ public Answer createTemplateFromVolume(CopyCommand cmd) {
9393
return new CopyCmdAnswer(template);
9494
}
9595

96+
@Override
97+
public Answer createTemplateFromSnapshot(CopyCommand cmd) {
98+
TemplateObjectTO template = (TemplateObjectTO)cmd.getDestTO();
99+
DataStoreTO imageStore = template.getDataStore();
100+
String details;
101+
102+
try {
103+
if (!(imageStore instanceof NfsTO)) {
104+
return new CopyCmdAnswer("Only support create template from snapshot, when the dest store is nfs");
105+
}
106+
107+
template.setPath(template.getName());
108+
template.setFormat(Storage.ImageFormat.RAW);
109+
110+
return new CopyCmdAnswer(template);
111+
} catch (Throwable e) {
112+
details = "CreatePrivateTemplateFromSnapshotCommand exception: " + e.toString();
113+
return new CopyCmdAnswer(details);
114+
}
115+
}
116+
96117
@Override
97118
public Answer backupSnapshot(CopyCommand cmd) {
98119
DataTO srcData = cmd.getSrcTO();

0 commit comments

Comments
 (0)