Merge pull request #1598 from syed/vhd-compressed-size [CLOUDSTACK-9423] Add ability to get virtual size of compressed VHDsWith object store like Swift as secondary storage, if a compressed VHD is uploaded as a template, the `VHDProcessor` incorrectly calculates the virutal size leading to the template being useless. This fix tries to guess the virtual size by partially decompressing it and falls back to a sensible default which is the size of the file.
Before the fix: template.properties on Swift ``` uniquename=routing-1 filename=routing-1.vhd size=263417314 virtualsize=2894447637315205059 ``` After the fix ``` uniquename=routing-1 filename=routing-1.vhd size=263417314 virtualsize=3145728000 ``` Look at the `virutalsize` in both cases * pr/1598: [CLOUDSTACK-9423] Add ability to get virtual size of compressed VHDs Signed-off-by: Will Stevens <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1f9bf939 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1f9bf939 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1f9bf939 Branch: refs/heads/4.9-bountycastle-daan Commit: 1f9bf93948b37f3132f55ea6ce7041cae57696da Parents: e4ba640 b0247b5 Author: Will Stevens <[email protected]> Authored: Sun Jul 3 23:34:55 2016 -0400 Committer: Will Stevens <[email protected]> Committed: Sun Jul 3 23:34:56 2016 -0400 ---------------------------------------------------------------------- core/pom.xml | 5 ++ .../cloud/storage/template/VhdProcessor.java | 85 ++++++++++++++++--- .../storage/template/VhdProcessorTest.java | 36 +++++++- core/test/resources/vhds/test.vhd | Bin 0 -> 3584 bytes core/test/resources/vhds/test.vhd.bz2 | Bin 0 -> 212 bytes core/test/resources/vhds/test.vhd.gz | Bin 0 -> 163 bytes core/test/resources/vhds/test.vhd.zip | Bin 0 -> 341 bytes 7 files changed, 113 insertions(+), 13 deletions(-) ----------------------------------------------------------------------
