GitHub user karuturi opened a pull request: https://github.com/apache/cloudstack/pull/901
CLOUDSTACK-8808: Successfully registered VHD template is downloaded again due to missing virtualsize property in template.properties We have multiple file processors to process different types of image formats. The processor interface has two methods getVirtualSize() and process(). 1. getVirtualSize() as the name says, returns the virtual size of the file and is used at get the size while copying files from NFS to s3 2. process() returns FormatInfo struct which has fileType, size, virutalSize, filename. on successfully downloading a template, each file is passed to all the processors.process() and whichever returns a FormatInfo, that will be used to create template.properties file. If process() throws an InternalErrorException, template installation fails. But, if process() returns null, template registration is successful with template.properties missing some attributes like virtualSize, file format etc. which results in this bug on restart of ssvm/cloud service/management server. failing the template download if virutalsize or some other properties cannot be determined. The following changes are done: getVirtualSize() to always return size(if it can calculate, get virtual size else return file size). This would mean the following changes 1. QCOW2Processor.getVirtualSize() to return file size if virtual size calculation fails 2. VHDProcessor.getVirtualSize() to return file size if virtual size calculation fails process() to throw InternalErrorException if virtual size calculation fails or any other exceptions occur. This would mean the following changes 1. OVAProcessor to throw InternalErrorException if untar fails 2. QCOW2Processor to throw InternalErrorException if virtual size calculation fails 3. VHDProcessor to throw InternalErrorException if virtual size calculation fails Testing: added unittests for the changes in the file processors. manual test: setup: host xenserver 6.5, management server centos 6.7 template: disk created using the process specified by andy at https://issues.apache.org/jira/browse/CLOUDSTACK-8808?focusedCommentId=14933368 tried to register the template and it failed with an error. Template never moved to Ready state.  You can merge this pull request into a Git repository by running: $ git pull https://github.com/karuturi/cloudstack CLOUDSTACK-8808 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cloudstack/pull/901.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #901 ---- commit 1056171aca8816492c16c5bdf8f963745f968b5d Author: Rajani Karuturi <rajanikarut...@gmail.com> Date: 2015-09-29T16:25:23Z CLOUDSTACK-8808: Successfully registered VHD template is downloaded again due to missing virtualsize property in template.properties We have multiple file processors to process different types of image formats. The processor interface has two methods getVirtualSize() and process(). 1. getVirtualSize() as the name says, returns the virtual size of the file and is used at get the size while copying files from NFS to s3 2. process() returns FormatInfo struct which has fileType, size, virutalSize, filename. on successfully downloading a template, each file is passed to all the processors.process() and whichever returns a FormatInfo, that will be used to create template.properties file. If process() throws an InternalErrorException, template installation fails. But, if process() returns null, template registration is successful with template.properties missing some attributes like virtualSize, file format etc. which results in this bug on restart of ssvm/cloud service/management server. failing the template download if virutalsize or some other properties cannot be determined. The following changes are done: getVirtualSize() to always return size(if it can calculate, get virtual size else return file size). This would mean the following changes 1. QCOW2Processor.getVirtualSize() to return file size if virtual size calculation fails 2. VHDProcessor.getVirtualSize() to return file size if virtual size calculation fails process() to throw InternalErrorException if virtual size calculation fails or any other exceptions occur. This would mean the following changes 1. OVAProcessor to throw InternalErrorException if untar fails 2. QCOW2Processor to throw InternalErrorException if virtual size calculation fails 3. VHDProcessor to throw InternalErrorException if virtual size calculation fails ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---