} else if (srcData.getHypervisorType() == HypervisorType.KVM) {
File srcFile = getFile(srcData.getPath(), srcDataStore.getUrl());
File destFile = getFile(destData.getPath(), destDataStore.getUrl());
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
String templateName = srcFile.getName();
// add kvm file extension for copied template name
String fileName = templateName + "." + srcFormat.getFileExtension();
String destFileFullPath = destFile.getAbsolutePath() + File.separator + fileName;
s_logger.debug("copy snapshot " + srcFile.getAbsolutePath() + " to template " + destFileFullPath);
Script.runSimpleBashScript("cp " + srcFile.getAbsolutePath() + " " + destFileFullPath);
try {
// generate template.properties file