Skip to content

Commit 9947e68

Browse files
committed
CS-18564: create template from snapshot failed, due to the volume(the
snapshot created from) is deleted.
1 parent e52a4d9 commit 9947e68

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,14 @@ protected Answer copySnapshotToTemplateFromNfsToNfs(CopyCommand cmd, SnapshotObj
444444
File srcFile = getFile(srcData.getPath(), srcDataStore.getUrl());
445445
File destFile = getFile(destData.getPath(), destDataStore.getUrl());
446446

447-
ImageFormat srcFormat = srcData.getVolume().getFormat();
447+
VolumeObjectTO volumeObjectTO = srcData.getVolume();
448+
ImageFormat srcFormat = null;
449+
//TODO: the image format should be stored in snapshot table, instead of getting from volume
450+
if (volumeObjectTO != null) {
451+
srcFormat = volumeObjectTO.getFormat();
452+
} else {
453+
srcFormat = ImageFormat.QCOW2;
454+
}
448455

449456
// get snapshot file name
450457
String templateName = srcFile.getName();

0 commit comments

Comments
 (0)