harikrishna-patnala commented on a change in pull request #5647:
URL: https://github.com/apache/cloudstack/pull/5647#discussion_r776935145



##########
File path: core/src/main/java/com/cloud/storage/template/OVAProcessor.java
##########
@@ -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;
+                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

Review comment:
       @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.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to