Repository: cloudstack
Updated Branches:
  refs/heads/master fa56b3f37 -> 55ae168cd


getUsedBytes should query the SolidFire cluster to acquire the size of the 
given volume if there is no volume_details info for that volume (and then 
create a volume_details row for this volume so we don't have to make that 
cluster call for this purpose again)


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

Branch: refs/heads/master
Commit: bcfbc6d73c39213b65334bfd5e2cac1a235462f5
Parents: a5e563a
Author: Mike Tutkowski <[email protected]>
Authored: Thu Aug 6 11:59:30 2015 -0600
Committer: Mike Tutkowski <[email protected]>
Committed: Wed Aug 12 12:24:17 2015 -0600

----------------------------------------------------------------------
 .../driver/SolidFirePrimaryDataStoreDriver.java     | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bcfbc6d7/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 46ecd69..b545931 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
@@ -307,6 +307,18 @@ public class SolidFirePrimaryDataStoreDriver implements 
PrimaryDataStoreDriver {
 
                     usedSpace += volumeSize;
                 }
+                else {
+                    SolidFireUtil.SolidFireConnection sfConnection = 
SolidFireUtil.getSolidFireConnection(storagePool.getId(), 
_storagePoolDetailsDao);
+                    long lVolumeId = Long.valueOf(volume.getFolder());
+
+                    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());
+                }
             }
         }
 
@@ -417,8 +429,6 @@ public class SolidFirePrimaryDataStoreDriver implements 
PrimaryDataStoreDriver {
 
         if (dataObject.getType() == DataObjectType.VOLUME) {
             VolumeInfo volumeInfo = (VolumeInfo)dataObject;
-            AccountVO account = 
_accountDao.findById(volumeInfo.getAccountId());
-            String sfAccountName = 
SolidFireUtil.getSolidFireAccountName(account.getUuid(), 
account.getAccountId());
 
             long storagePoolId = dataStore.getId();
 
@@ -427,6 +437,8 @@ public class SolidFirePrimaryDataStoreDriver implements 
PrimaryDataStoreDriver {
             AccountDetailVO accountDetail = 
SolidFireUtil.getAccountDetail(volumeInfo.getAccountId(), storagePoolId, 
_accountDetailsDao);
 
             if (accountDetail == null || accountDetail.getValue() == null) {
+                AccountVO account = 
_accountDao.findById(volumeInfo.getAccountId());
+                String sfAccountName = 
SolidFireUtil.getSolidFireAccountName(account.getUuid(), 
account.getAccountId());
                 SolidFireUtil.SolidFireAccount sfAccount = 
SolidFireUtil.getSolidFireAccount(sfConnection, sfAccountName);
 
                 if (sfAccount == null) {

Reply via email to