cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] rafaelweingartner commented on issue #2298: CLOUDSTACK-9620: Enhancements for managed storage
Date Thu, 01 Jan 1970 00:00:00 GMT
rafaelweingartner commented on issue #2298: CLOUDSTACK-9620: Enhancements for managed storage
URL: https://github.com/apache/cloudstack/pull/2298#issuecomment-355687919
 
 
   I understood that. It is good the way you did as well. What I meant previously was the
following.
   You have this block of code:
   ```
     if (canHandleSrc) {
           if (srcSnapshotInfo.getDataStore().getId() == destVolumeInfo.getDataStore().getId())
{
               handleCreateVolumeFromSnapshotBothOnStorageSystem(srcSnapshotInfo, destVolumeInfo,
callback);
           } else {
               String errMsg = "To perform this operation, the source and destination primary
storages must be the same.";
   
               handleError(errMsg, callback);
           }
       } else {
           handleCreateVolumeFromSnapshotOnSecondaryStorage(srcSnapshotInfo, destVolumeInfo,
callback);
       }
   ```
   
   This previous block is the same as:
   ```
     if (!canHandleSrc) {
           handleCreateVolumeFromSnapshotOnSecondaryStorage(srcSnapshotInfo, destVolumeInfo,
callback);
       }
   
    if (srcSnapshotInfo.getDataStore().getId() == destVolumeInfo.getDataStore().getId()) {
               handleCreateVolumeFromSnapshotBothOnStorageSystem(srcSnapshotInfo, destVolumeInfo,
callback);
           } else {
               String errMsg = "To perform this operation, the source and destination primary
storages must be the same.";
   
               handleError(errMsg, callback);
           }
   ```
   
   Sorry the bad indentation here. So, the idea was to remove one IF inside the other. At
least for me, the least nested conditions and operations, the better to read the code.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message