Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,29 @@ public boolean maintain(DataStore store) {
@Override
public boolean cancelMaintain(DataStore store) {
logger.info("Cancelling storage pool maintenance for {}", store);

// Save capacity before the generic cancelMaintain path overwrites it.
// The generic flow sends ModifyStoragePoolCommand to agents. For managed iSCSI pools,
// IscsiAdmStoragePool returns capacityBytes=0 , With capacity=0,
// the deployment planner's checkPoolforSpace rejects the pool ("No destination found").
StoragePoolVO poolVO = storagePoolDao.findById(store.getId());
long savedCapacityBytes = poolVO.getCapacityBytes();
long savedUsedBytes = poolVO.getUsedBytes();

if (_dataStoreHelper.cancelMaintain(store)) {
return _storagePoolAutomation.cancelMaintain(store);
boolean result = _storagePoolAutomation.cancelMaintain(store);

// Restore capacity
poolVO = storagePoolDao.findById(store.getId());
if (poolVO.getCapacityBytes() == 0 && savedCapacityBytes > 0) {
logger.info("Restoring storage pool {} capacity to {} bytes",
poolVO.getName(), savedCapacityBytes);
poolVO.setCapacityBytes(savedCapacityBytes);
poolVO.setUsedBytes(savedUsedBytes);
storagePoolDao.update(poolVO.getId(), poolVO);
}

return result;
} else {
return false;
}
Expand Down
Loading