Skip to content

Commit 691d261

Browse files
Fix for create template from snapshot
1 parent 9fd2b90 commit 691d261

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

server/src/main/java/com/cloud/template/TemplateManagerImpl.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,9 +1701,8 @@ public VirtualMachineTemplate createPrivateTemplate(CreateTemplateCmd command) t
17011701
snapInfo = _snapshotFactory.getSnapshotWithRoleAndZone(snapshotId, dataStoreRole, zoneId);
17021702
boolean kvmIncrementalSnapshot = SnapshotManager.kvmIncrementalSnapshot.valueIn(_hostDao.findClusterIdByVolumeInfo(snapInfo.getBaseVolume()));
17031703

1704-
boolean skipCopyToSecondary = false;
1705-
boolean keepOnPrimary = snapshotHelper.isStorageSupportSnapshotToTemplate(snapInfo);
1706-
if (keepOnPrimary) {
1704+
boolean storageSupportsSnapshotToTemplate = snapshotHelper.isStorageSupportSnapshotToTemplate(snapInfo);
1705+
if (storageSupportsSnapshotToTemplate) {
17071706
ImageStoreVO imageStore = _imgStoreDao.findOneByZoneAndProtocol(zoneId, "nfs");
17081707
if (imageStore == null) {
17091708
throw new CloudRuntimeException(String.format("Could not find an NFS secondary storage pool on zone %s to use as a temporary location " +
@@ -1713,7 +1712,7 @@ public VirtualMachineTemplate createPrivateTemplate(CreateTemplateCmd command) t
17131712
if (dataStore != null) {
17141713
store = dataStore;
17151714
}
1716-
} else if (dataStoreRole == DataStoreRole.Image) {
1715+
} else if (dataStoreRole == DataStoreRole.Image || kvmSnapshotOnlyInPrimaryStorage) {
17171716
snapInfo = snapshotHelper.backupSnapshotToSecondaryStorageIfNotExists(snapInfo, dataStoreRole, snapshot, kvmSnapshotOnlyInPrimaryStorage);
17181717
_accountMgr.checkAccess(caller, null, true, snapInfo);
17191718
DataStore snapStore = snapInfo.getDataStore();

0 commit comments

Comments
 (0)