You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by re...@apache.org on 2015/10/28 11:39:47 UTC

[1/2] git commit: updated refs/heads/master to 39c825c

Repository: cloudstack
Updated Branches:
  refs/heads/master 7d46b2ee5 -> 39c825c2c


CLOUDSTACK-8985: Deleted volume's removed column not updated


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7d1dc974
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7d1dc974
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7d1dc974

Branch: refs/heads/master
Commit: 7d1dc97423e5005f4e0513fc86643286c5f42ad9
Parents: 4fe56da
Author: Mike Tutkowski <mi...@solidfire.com>
Authored: Thu Oct 22 12:16:19 2015 -0600
Committer: Mike Tutkowski <mi...@solidfire.com>
Committed: Tue Oct 27 15:04:15 2015 -0600

----------------------------------------------------------------------
 .../driver/SolidFirePrimaryDataStoreDriver.java | 31 ++++++++++++++------
 1 file changed, 22 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7d1dc974/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFirePrimaryDataStoreDriver.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFirePrimaryDataStoreDriver.java b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFirePrimaryDataStoreDriver.java
index e934426..61e199c 100644
--- a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFirePrimaryDataStoreDriver.java
+++ b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFirePrimaryDataStoreDriver.java
@@ -294,12 +294,20 @@ public class SolidFirePrimaryDataStoreDriver implements PrimaryDataStoreDriver {
 
     @Override
     public long getUsedBytes(StoragePool storagePool) {
+        return getUsedBytes(storagePool, Long.MIN_VALUE);
+    }
+
+    private long getUsedBytes(StoragePool storagePool, long volumeIdToIgnore) {
         long usedSpace = 0;
 
         List<VolumeVO> lstVolumes = _volumeDao.findByPoolId(storagePool.getId(), null);
 
         if (lstVolumes != null) {
             for (VolumeVO volume : lstVolumes) {
+                if (volume.getId() == volumeIdToIgnore) {
+                    continue;
+                }
+
                 VolumeDetailVO volumeDetail = _volumeDetailsDao.findDetail(volume.getId(), SolidFireUtil.VOLUME_SIZE);
 
                 if (volumeDetail != null && volumeDetail.getValue() != null) {
@@ -309,15 +317,21 @@ public class SolidFirePrimaryDataStoreDriver implements PrimaryDataStoreDriver {
                 }
                 else {
                     SolidFireUtil.SolidFireConnection sfConnection = SolidFireUtil.getSolidFireConnection(storagePool.getId(), _storagePoolDetailsDao);
-                    long lVolumeId = Long.parseLong(volume.getFolder());
 
-                    SolidFireUtil.SolidFireVolume sfVolume = SolidFireUtil.getSolidFireVolume(sfConnection, lVolumeId);
+                    try {
+                        long lVolumeId = Long.parseLong(volume.getFolder());
 
-                    // SolidFireUtil.VOLUME_SIZE was introduced in 4.5.
-                    // To be backward compatible with releases prior to 4.5, call updateVolumeDetails here.
-                    // That way if SolidFireUtil.VOLUME_SIZE wasn't put in the volume_details table when the
-                    // volume was initially created, it can be placed in volume_details here.
-                    updateVolumeDetails(volume.getId(), sfVolume.getTotalSize());
+                        SolidFireUtil.SolidFireVolume sfVolume = SolidFireUtil.getSolidFireVolume(sfConnection, lVolumeId);
+
+                        // SolidFireUtil.VOLUME_SIZE was introduced in 4.5.
+                        // To be backward compatible with releases prior to 4.5, call updateVolumeDetails here.
+                        // That way if SolidFireUtil.VOLUME_SIZE wasn't put in the volume_details table when the
+                        // volume was initially created, it can be placed in volume_details here.
+                        updateVolumeDetails(volume.getId(), sfVolume.getTotalSize());
+                    }
+                    catch (NumberFormatException ex) {
+                        // can be ignored (the "folder" column didn't have a valid "long" in it (hasn't been placed there yet))
+                    }
                 }
             }
         }
@@ -519,8 +533,7 @@ public class SolidFirePrimaryDataStoreDriver implements PrimaryDataStoreDriver {
 
                 StoragePoolVO storagePool = _storagePoolDao.findById(storagePoolId);
 
-                // getUsedBytes(StoragePool) will not include the volume to delete because it has already been deleted by this point
-                long usedBytes = getUsedBytes(storagePool);
+                long usedBytes = getUsedBytes(storagePool, volumeId);
 
                 storagePool.setUsedBytes(usedBytes < 0 ? 0 : usedBytes);
 


[2/2] git commit: updated refs/heads/master to 39c825c

Posted by re...@apache.org.
Merge pull request #968 from mike-tutkowski/removed_column

CLOUDSTACK-8985: Deleted volume's removed column not updatedI found this issue when a SolidFire integration test yesterday wasn't able to delete primary storage because it claimed there were still volumes using the primary storage in question (this was due to the removed column not being updated appropriately).

I decided to go with a solution where the delete logic would pass in a volume ID to ignore when computing the used space of the primary storage in question.

* pr/968:
  CLOUDSTACK-8985: Deleted volume's removed column not updated

Signed-off-by: Remi Bergsma <gi...@remi.nl>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/39c825c2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/39c825c2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/39c825c2

Branch: refs/heads/master
Commit: 39c825c2c5e42a2805fb7dfcac2055d8c1edfd79
Parents: 7d46b2e 7d1dc97
Author: Remi Bergsma <gi...@remi.nl>
Authored: Wed Oct 28 11:39:05 2015 +0100
Committer: Remi Bergsma <gi...@remi.nl>
Committed: Wed Oct 28 11:39:05 2015 +0100

----------------------------------------------------------------------
 .../driver/SolidFirePrimaryDataStoreDriver.java | 31 ++++++++++++++------
 1 file changed, 22 insertions(+), 9 deletions(-)
----------------------------------------------------------------------