cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jburwell <...@git.apache.org>
Subject [GitHub] cloudstack pull request: Taking fast and efficient volume snapshot...
Date Fri, 08 Apr 2016 20:14:39 GMT
Github user jburwell commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1403#discussion_r59082791
  
    --- 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) {
    +                        templatePoolRef.setLocalDownloadPath(newTemplate.getPath());
    +                    }
    +
    +                    // In the case of managed storage, the install path may already be
specified (by the storage plug-in), so do not overwrite it.
    +                    if (templatePoolRef.getInstallPath() == 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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message