if (diskSection.getDisk().size() != 1)
{
final String message =
"abicloud only supports single disk definition on the OVF, the current envelope contains multiple disk";
throw new InvalidSectionException(message);
}
VirtualDiskDescType vdisk = diskSection.getDisk().get(0);
String formatUri = vdisk.getFormat();
if (formatUri == null || formatUri.isEmpty())
{
final String message = "Missing ''format'' attribute for the Disk element";
throw new InvalidSectionException(message);
}
DiskFormatOVF format = DiskFormatOVF.fromValue(formatUri);
if (format == null) // the format URI isn't on the abicloud enumeration. FIX it
{
// vbox/vmware
// http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized
// abiquo
// http://www.vmware.com/technical-resources/interfaces/vmdk_access.html#streamOptimized
if (formatUri.contains("interfaces/specifications/vmdk.html"))
{
formatUri =
formatUri.replace("interfaces/specifications/vmdk.html",
"technical-resources/interfaces/vmdk_access.html");
format = DiskFormatOVF.fromValue(formatUri);
if (format == null)
{
throw new InvalidSectionException(String.format(
"Invalid disk format type [%s]", formatUri));
}
vdisk.setFormat(formatUri);
}