You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/12/31 06:20:55 UTC

[GitHub] [cloudstack] harikrishna-patnala commented on a change in pull request #5647: assume a property is one when it isn't a number

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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org