From 4ba68e3b3fd58bd1e7333bb68e8970b3af7a954f Mon Sep 17 00:00:00 2001 From: Min Chen Date: Tue, 27 Aug 2013 16:56:21 -0700 Subject: [PATCH] CLOUDSTACK-4530:Create Template from a Snapshot fails with unable to find any snapshot ova/ovf when we have multiple secondary storage for a zone. --- server/src/com/cloud/template/TemplateManagerImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/src/com/cloud/template/TemplateManagerImpl.java b/server/src/com/cloud/template/TemplateManagerImpl.java index 2a0e04dfbee..fa92a02dd98 100755 --- a/server/src/com/cloud/template/TemplateManagerImpl.java +++ b/server/src/com/cloud/template/TemplateManagerImpl.java @@ -1374,6 +1374,10 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager, AsyncCallFuture future = null; if (snapshotId != null) { SnapshotInfo snapInfo = this._snapshotFactory.getSnapshot(snapshotId, DataStoreRole.Image); + DataStore snapStore = snapInfo.getDataStore(); + if ( snapStore != null ){ + store = snapStore; // pick snapshot image store to create template + } future = this._tmpltSvr.createTemplateFromSnapshotAsync(snapInfo, tmplInfo, store); } else if (volumeId != null) { VolumeInfo volInfo = this._volFactory.getVolume(volumeId);