CS-18564: create template from snapshot failed, due to the volume(the

snapshot created from) is deleted.
This commit is contained in:
Edison Su 2013-12-20 12:43:06 -08:00
parent e52a4d9306
commit 9947e688c4

View File

@ -444,7 +444,14 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
File srcFile = getFile(srcData.getPath(), srcDataStore.getUrl()); File srcFile = getFile(srcData.getPath(), srcDataStore.getUrl());
File destFile = getFile(destData.getPath(), destDataStore.getUrl()); File destFile = getFile(destData.getPath(), destDataStore.getUrl());
ImageFormat srcFormat = srcData.getVolume().getFormat(); VolumeObjectTO volumeObjectTO = srcData.getVolume();
ImageFormat srcFormat = null;
//TODO: the image format should be stored in snapshot table, instead of getting from volume
if (volumeObjectTO != null) {
srcFormat = volumeObjectTO.getFormat();
} else {
srcFormat = ImageFormat.QCOW2;
}
// get snapshot file name // get snapshot file name
String templateName = srcFile.getName(); String templateName = srcFile.getName();