mirror of https://github.com/apache/cloudstack.git
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)
This commit is contained in:
parent
a5e563aa85
commit
bcfbc6d73c
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue