/**
* Snapshots might be in either QCOW2 or RAW image format
*
* For example RBD snapshots are in RAW format
*/
Processor processor = null;
if (srcFormat == ImageFormat.QCOW2) {
processor = new QCOW2Processor();
} else if (srcFormat == ImageFormat.RAW) {
processor = new RawImageProcessor();
}
Map<String, Object> params = new HashMap<String, Object>();
params.put(StorageLayer.InstanceConfigKey, _storage);
processor.configure("template processor", params);
String destPath = destFile.getAbsolutePath();
FormatInfo info = processor.process(destPath, null, templateName);
TemplateLocation loc = new TemplateLocation(_storage, destPath);
loc.create(1, true, destData.getName());
loc.addFormat(info);
loc.save();