Github user jburwell commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1403#discussion_r59082769
  
    --- Diff: 
engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
 ---
    @@ -189,12 +189,24 @@ public void 
processEvent(ObjectInDataStoreStateMachine.Event event, Answer answe
                         TemplateObjectTO newTemplate = 
(TemplateObjectTO)cpyAnswer.getNewData();
                         VMTemplateStoragePoolVO templatePoolRef = 
templatePoolDao.findByPoolTemplate(getDataStore().getId(), getId());
                         templatePoolRef.setDownloadPercent(100);
    -                    if (newTemplate.getSize() != null) {
    +
    +                    // In the case of managed storage, the template size 
may already be specified (by the storage plug-in), so do not overwrite it.
    +                    if (templatePoolRef.getTemplateSize() == 0 && 
newTemplate.getSize() != null) {
                             
templatePoolRef.setTemplateSize(newTemplate.getSize());
                         }
    +
                         templatePoolRef.setDownloadState(Status.DOWNLOADED);
    -                    
templatePoolRef.setLocalDownloadPath(newTemplate.getPath());
    -                    templatePoolRef.setInstallPath(newTemplate.getPath());
    +
    +                    // In the case of managed storage, the local download 
path may already be specified (by the storage plug-in), so do not overwrite it.
    +                    if (templatePoolRef.getLocalDownloadPath() == null) {
    --- End diff --
    
    Consider using ``Strings.isNullorEmpty`` to cover both the ``null`` and 
empty cases.


---
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.
---

Reply via email to