s_logger.debug("File extension '" + currentExtension + "' was found in '" + _file + "'."); FormatInfo info = new FormatInfo(); info.format = format; info.filename = _props.getProperty(currentExtension + ".filename");
FormatInfo info = new FormatInfo(); info.format = ImageFormat.OVA; info.filename = templateName + "." + ImageFormat.OVA.getFileExtension();
@Override public FormatInfo process(String templatePath, ImageFormat format, String templateName, long processTimeout) throws InternalErrorException { if (format != null) { s_logger.debug("We currently don't handle conversion from " + format + " to VHD."); return null; } String vhdPath = templatePath + File.separator + templateName + "." + ImageFormat.VHD.getFileExtension(); if (!_storage.exists(vhdPath)) { s_logger.debug("Unable to find the vhd file: " + vhdPath); return null; } File vhdFile = _storage.getFile(vhdPath); FormatInfo info = new FormatInfo(); info.format = ImageFormat.VHD; info.filename = templateName + "." + ImageFormat.VHD.getFileExtension(); info.size = _storage.getSize(vhdPath); try { info.virtualSize = getTemplateVirtualSize(vhdFile); } catch (IOException e) { s_logger.error("Unable to get the virtual size for " + vhdPath); throw new InternalErrorException("unable to get virtual size from vhd file"); } return info; }
@Override public FormatInfo process(String templatePath, ImageFormat format, String templateName, long processTimeout) throws InternalErrorException { if (format != null) { if (s_logger.isInfoEnabled()) { s_logger.info("We currently don't handle conversion from " + format + " to VMDK."); } return null; } s_logger.info("Template processing. templatePath: " + templatePath + ", templateName: " + templateName); 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); } return null; } FormatInfo info = new FormatInfo(); info.format = ImageFormat.VMDK; info.filename = templateName + "." + ImageFormat.VMDK.getFileExtension(); info.size = _storage.getSize(templateFilePath); info.virtualSize = getTemplateVirtualSize(templatePath, info.filename); return info; }
@Override public FormatInfo process(String templatePath, ImageFormat format, String templateName, long processTimeout) throws InternalErrorException { if (format != null) { s_logger.debug("We currently don't handle conversion from " + format + " to QCOW2."); return null; } String qcow2Path = templatePath + File.separator + templateName + "." + ImageFormat.QCOW2.getFileExtension(); if (!_storage.exists(qcow2Path)) { s_logger.debug("Unable to find the qcow2 file: " + qcow2Path); return null; } FormatInfo info = new FormatInfo(); info.format = ImageFormat.QCOW2; info.filename = templateName + "." + ImageFormat.QCOW2.getFileExtension(); File qcow2File = _storage.getFile(qcow2Path); info.size = _storage.getSize(qcow2Path); try { info.virtualSize = getTemplateVirtualSize(qcow2File); } catch (IOException e) { s_logger.error("Unable to get virtual size from " + qcow2File.getName()); throw new InternalErrorException("unable to get virtual size from qcow2 file"); } return info; }
@Override public FormatInfo process(String templatePath, ImageFormat format, String templateName, long processTimeout) { if (format != null) { s_logger.debug("We don't handle conversion from " + format + " to ISO."); return null; } String isoPath = templatePath + File.separator + templateName + "." + ImageFormat.ISO.getFileExtension(); if (!_storage.exists(isoPath)) { s_logger.debug("Unable to find the iso file: " + isoPath); return null; } FormatInfo info = new FormatInfo(); info.format = ImageFormat.ISO; info.filename = templateName + "." + ImageFormat.ISO.getFileExtension(); info.size = _storage.getSize(isoPath); info.virtualSize = info.size; return info; }
@Override public FormatInfo process(String templatePath, ImageFormat format, String templateName, long processTimeout) { if (format != null) { s_logger.debug("We currently don't handle conversion from " + format + " to TAR."); return null; } String tarPath = templatePath + File.separator + templateName + "." + ImageFormat.TAR.getFileExtension(); if (!_storage.exists(tarPath)) { s_logger.debug("Unable to find the tar file: " + tarPath); return null; } FormatInfo info = new FormatInfo(); info.format = ImageFormat.TAR; info.filename = templateName + "." + ImageFormat.TAR.getFileExtension(); File tarFile = _storage.getFile(tarPath); info.size = _storage.getSize(tarPath); info.virtualSize = getVirtualSize(tarFile); return info; }
@Override public FormatInfo process(String templatePath, ImageFormat format, String templateName, long processTimeout) throws InternalErrorException { if (format != null) { s_logger.debug("We currently don't handle conversion from " + format + " to raw image."); return null; } String imgPath = templatePath + File.separator + templateName + "." + ImageFormat.RAW.getFileExtension(); if (!_storage.exists(imgPath)) { s_logger.debug("Unable to find raw image:" + imgPath); return null; } FormatInfo info = new FormatInfo(); info.format = ImageFormat.RAW; info.filename = templateName + "." + ImageFormat.RAW.getFileExtension(); info.size = _storage.getSize(imgPath); info.virtualSize = info.size; s_logger.debug("Process raw image " + info.filename + " successfully"); return info; }