Use ImageFormat.getFileExtension instead of toString() to retrieve template file extension name

This commit is contained in:
Kelven Yang 2010-08-26 10:07:13 -07:00
parent 0e2df1fe42
commit a3a503fecb
2 changed files with 3 additions and 3 deletions

View File

@ -303,7 +303,7 @@ public class DownloadManagerImpl implements DownloadManager {
}
// add options common to ISO and template
String extension = dnld.getFormat().toString().toLowerCase();
String extension = dnld.getFormat().getFileExtension();
String templateName = "";
if( extension.equals("iso")) {
templateName = jobs.get(jobId).getTmpltName().trim().replace(" ", "_");

View File

@ -26,7 +26,7 @@ public class VmdkProcessor implements Processor {
}
s_logger.info("Template processing. templatePath: " + templatePath + ", templateName: " + templateName);
String templateFilePath = templatePath + File.separator + templateName + ImageFormat.VMDK.getFileExtension();
String templateFilePath = templatePath + File.separator + templateName + "." + ImageFormat.VMDK.getFileExtension();
if (!_storage.exists(templateFilePath)) {
if(s_logger.isInfoEnabled())
s_logger.info("Unable to find the vmware template file: " + templateFilePath);
@ -35,7 +35,7 @@ public class VmdkProcessor implements Processor {
FormatInfo info = new FormatInfo();
info.format = ImageFormat.VMDK;
info.filename = templateName + ImageFormat.VMDK.getFileExtension();
info.filename = templateName + "." + ImageFormat.VMDK.getFileExtension();
info.size = _storage.getSize(templateFilePath);
info.virtualSize = info.size;
return info;