/**
* Use the imageSize
**/
public static EnvelopeType createOVFEnvelopeFromTemplate(final TemplateDto template)
{
EnvelopeType envelope = new EnvelopeType();
ReferencesType references = new ReferencesType();
final String diskPath = template.getDiskFilePath();
// final String packRelPath = getRelativePackagePath(disk.getOvfUrl(),
// String.valueOf(disk.getIdEnterprise()));
final Long diskSize = template.getDiskFileSize();
// final String completPath = packRelPath +'/'+diskPath;
// System.err.println(packRelPath);
try
{
FileType fileRef =
OVFReferenceUtils.createFileType("diskFile", diskPath,
BigInteger.valueOf(diskSize), null, null);
OVFReferenceUtils.addFile(references, fileRef);
DiskSectionType diskSection = createDiskSection(template);
VirtualSystemType vsystem = createVirtualSystem(template);
ProductSectionType product = createProductSection(template);
OperatingSystemSectionType ossection = createOperatingSystemSection(template);
OVFEnvelopeUtils.addSection(vsystem, product);
OVFEnvelopeUtils.addSection(vsystem, ossection);
OVFEnvelopeUtils.addSection(envelope, diskSection);
OVFEnvelopeUtils.addVirtualSystem(envelope, vsystem);
envelope.setReferences(references);
}
catch (Exception e)
{
throw new AMException(AMError.TEMPLATE_INSTALL,
"Can not create the OVF from the DiskInfo", e);