mirror of https://github.com/apache/cloudstack.git
Merge pull request #1869 from sudhansu7/CLOUDSTACK-9701
CLOUDSTACK-9701: Local storage capacity is not handled properly
This commit is contained in:
commit
d962cc1b60
|
|
@ -1187,6 +1187,13 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
|
|||
final CapacityState capacityState = nextState == ResourceState.Enabled ? CapacityState.Enabled : CapacityState.Disabled;
|
||||
final short[] capacityTypes = {Capacity.CAPACITY_TYPE_CPU, Capacity.CAPACITY_TYPE_MEMORY};
|
||||
_capacityDao.updateCapacityState(null, null, null, host.getId(), capacityState.toString(), capacityTypes);
|
||||
|
||||
final StoragePoolVO storagePool = _storageMgr.findLocalStorageOnHost(host.getId());
|
||||
|
||||
if(storagePool != null){
|
||||
final short[] capacityTypesLocalStorage = {Capacity.CAPACITY_TYPE_LOCAL_STORAGE};
|
||||
_capacityDao.updateCapacityState(null, null, null, storagePool.getId(), capacityState.toString(), capacityTypesLocalStorage);
|
||||
}
|
||||
}
|
||||
return _hostDao.updateResourceState(currentState, event, nextState, host);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -969,6 +969,19 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (storagePool.getScope() == ScopeType.HOST) {
|
||||
List<StoragePoolHostVO> stoargePoolHostVO = _storagePoolHostDao.listByPoolId(storagePool.getId());
|
||||
|
||||
if(stoargePoolHostVO != null && !stoargePoolHostVO.isEmpty()){
|
||||
HostVO host = _hostDao.findById(stoargePoolHostVO.get(0).getHostId());
|
||||
|
||||
if(host != null){
|
||||
capacityState = (host.getResourceState() == ResourceState.Disabled) ? CapacityState.Disabled : CapacityState.Enabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (capacities.size() == 0) {
|
||||
CapacityVO capacity =
|
||||
new CapacityVO(storagePool.getId(), storagePool.getDataCenterId(), storagePool.getPodId(), storagePool.getClusterId(), allocated, totalOverProvCapacity,
|
||||
|
|
|
|||
Loading…
Reference in New Issue