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:30:50 GMT
Github user jburwell commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1403#discussion_r59084967
  
    --- Diff: engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java
---
    @@ -440,41 +526,28 @@ private void markAsBackedUp(SnapshotObject snapshotObj) {
     
         @Override
         public StrategyPriority canHandle(Snapshot snapshot, SnapshotOperation op) {
    -        long volumeId = snapshot.getVolumeId();
    -        VolumeVO volumeVO = _volumeDao.findById(volumeId);
             if (SnapshotOperation.REVERT.equals(op)) {
    -            if (volumeVO != null && ImageFormat.QCOW2.equals(volumeVO.getFormat()))
    -                return StrategyPriority.DEFAULT;
    -            else
    -                return StrategyPriority.CANT_HANDLE;
    +            return StrategyPriority.CANT_HANDLE;
             }
     
    -        long storagePoolId;
    +        long volumeId = snapshot.getVolumeId();
     
    -        if (volumeVO == null) {
    -            SnapshotDataStoreVO snapshotStore = _snapshotStoreDao.findBySnapshot(snapshot.getId(),
DataStoreRole.Primary);
    +        VolumeVO volumeVO = _volumeDao.findByIdIncludingRemoved(volumeId);
     
    -            if (snapshotStore != null) {
    -                storagePoolId = snapshotStore.getDataStoreId();
    -            }
    -            else {
    -                throw new CloudRuntimeException("Unable to determine the storage pool
of the snapshot");
    -            }
    -        }
    -        else {
    -            storagePoolId = volumeVO.getPoolId();
    -        }
    +        long storagePoolId = volumeVO.getPoolId();
     
             DataStore dataStore = _dataStoreMgr.getDataStore(storagePoolId, DataStoreRole.Primary);
     
    -        Map<String, String> mapCapabilities = dataStore.getDriver().getCapabilities();
    +        if (dataStore != null) {
    +            Map<String, String> mapCapabilities = dataStore.getDriver().getCapabilities();
     
    -        if (mapCapabilities != null) {
    -            String value = mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString());
    -            Boolean supportsStorageSystemSnapshots = new Boolean(value);
    +            if (mapCapabilities != null) {
    +                String value = mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString());
    +                Boolean supportsStorageSystemSnapshots = new Boolean(value);
    --- End diff --
    
    ``new Boolean`` skips the constant pool -- placing unnecessary pressure on the garbage
collector.  Please use ``Boolean.valueOf`` instead.


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