Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion core/src/main/java/com/cloud/storage/template/OVAProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,17 @@ public long getTemplateVirtualSize(String templatePath, String templateName) thr
NodeList diskElements = new OVFHelper().getElementsByTagNameAndPrefix(ovfDoc, "Disk", "ovf");
for (int i = 0; i < diskElements.getLength(); i++) {
Element disk = (Element)diskElements.item(i);
long diskSize = Long.parseLong(disk.getAttribute("ovf:capacity"));
String diskSizeValue = disk.getAttribute("ovf:capacity");
long diskSize = 1;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure here if we should 'some' or 0 (zero)

try {
diskSize = Long.parseLong(diskSizeValue);
} catch (NumberFormatException e) {
// ASSUMEably the diskSize contains a property for replacement
LOGGER.warn(String.format("the disksize for disk %s is not a valid number: %s", disk.getAttribute("diskId"), diskSizeValue));
// TODO parse the property to get any value can not be done at registration time
// and will have to be done at deploytime, so for orchestration purposes
// we now assume, a value of one
Comment on lines +256 to +258
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more like a design brainstorm than a TODO

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DaanHoogland any specific reason for completely not supporting those kinds of templates instead of assuming the size to be 1 ? I think this approach will have some effect on the usage records of the volume also.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@harikrishna-patnala this is only the template and there will be only a "real" disksize on/after deployment. This will only fix registration btw, and assumes deployment is going on as usual, probably for bad reason.

}
String allocationUnits = disk.getAttribute("ovf:capacityAllocationUnits");
diskSize = OVFHelper.getDiskVirtualSize(diskSize, allocationUnits, ovfFileName);
virtualSize += diskSize;
Expand Down