cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From swill <...@git.apache.org>
Subject [GitHub] cloudstack pull request #1598: [CLOUDSTACK-9423] Add ability to get virtual ...
Date Tue, 28 Jun 2016 15:24:58 GMT
Github user swill commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1598#discussion_r68779423
  
    --- Diff: core/src/com/cloud/storage/template/VhdProcessor.java ---
    @@ -91,27 +97,58 @@ public long getVirtualSize(File file) throws IOException {
             return file.length();
         }
     
    -    protected long getTemplateVirtualSize(File file) throws IOException {
    +        protected long getTemplateVirtualSize(File file) throws IOException {
             byte[] currentSize = new byte[8];
    +        byte[] cookie = new byte[8];
             byte[] creatorApp = new byte[4];
     
    -        try (FileInputStream strm = new FileInputStream(file)) {
    -            long skipped = strm.skip(file.length() - vhdFooterSize + vhdFooterCreatorAppOffset);
    +
    +        BufferedInputStream fileStream = new BufferedInputStream(new FileInputStream(file));
    +        InputStream strm = fileStream;
    +
    +        boolean isCompressed = checkCompressed(file.getAbsolutePath());
    +
    +        if ( isCompressed ) {
    +            try {
    +                strm = new CompressorStreamFactory().createCompressorInputStream(fileStream);
    +            } catch (CompressorException e) {
    +                s_logger.info("error opening compressed VHD file " + file.getName());
    +                return file.length();
    +            }
    +        }
    +
    +        try {
    +
    --- End diff --
    
    Can you remove the unneeded line break here since I already have another change for you
to make.  :)  Thx...


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message