mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-9701: When host is disabled/removed,
capacity_type for local storage in op_host_capacity is still enabled
This commit is contained in:
parent
ed2f573160
commit
e06e3b7cd4
@ -1181,6 +1181,13 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
|
|||||||
final CapacityState capacityState = nextState == ResourceState.Enabled ? CapacityState.Enabled : CapacityState.Disabled;
|
final CapacityState capacityState = nextState == ResourceState.Enabled ? CapacityState.Enabled : CapacityState.Disabled;
|
||||||
final short[] capacityTypes = {Capacity.CAPACITY_TYPE_CPU, Capacity.CAPACITY_TYPE_MEMORY};
|
final short[] capacityTypes = {Capacity.CAPACITY_TYPE_CPU, Capacity.CAPACITY_TYPE_MEMORY};
|
||||||
_capacityDao.updateCapacityState(null, null, null, host.getId(), capacityState.toString(), capacityTypes);
|
_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);
|
return _hostDao.updateResourceState(currentState, event, nextState, host);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -965,6 +965,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) {
|
if (capacities.size() == 0) {
|
||||||
CapacityVO capacity =
|
CapacityVO capacity =
|
||||||
new CapacityVO(storagePool.getId(), storagePool.getDataCenterId(), storagePool.getPodId(), storagePool.getClusterId(), allocated, totalOverProvCapacity,
|
new CapacityVO(storagePool.getId(), storagePool.getDataCenterId(), storagePool.getPodId(), storagePool.getClusterId(), allocated, totalOverProvCapacity,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user