Skip to content

Commit c894d9a

Browse files
Srivastava, PiyushSrivastava, Piyush
authored andcommitted
bugfix/CSTACKEX-155: Fix cancel maintain for vm provisioning 1
1 parent 9404164 commit c894d9a

2 files changed

Lines changed: 2 additions & 23 deletions

File tree

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/lifecycle/OntapPrimaryDatastoreLifecycle.java

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -452,29 +452,8 @@ public boolean maintain(DataStore store) {
452452
@Override
453453
public boolean cancelMaintain(DataStore store) {
454454
logger.info("Cancelling storage pool maintenance for {}", store);
455-
456-
// Save capacity before the generic cancelMaintain path overwrites it.
457-
// The generic flow sends ModifyStoragePoolCommand to agents. For managed iSCSI pools,
458-
// IscsiAdmStoragePool returns capacityBytes=0 , With capacity=0,
459-
// the deployment planner's checkPoolforSpace rejects the pool ("No destination found").
460-
StoragePoolVO poolVO = storagePoolDao.findById(store.getId());
461-
long savedCapacityBytes = poolVO.getCapacityBytes();
462-
long savedUsedBytes = poolVO.getUsedBytes();
463-
464455
if (_dataStoreHelper.cancelMaintain(store)) {
465-
boolean result = _storagePoolAutomation.cancelMaintain(store);
466-
467-
// Restore capacity
468-
poolVO = storagePoolDao.findById(store.getId());
469-
if (poolVO.getCapacityBytes() == 0 && savedCapacityBytes > 0) {
470-
logger.info("Restoring storage pool {} capacity to {} bytes",
471-
poolVO.getName(), savedCapacityBytes);
472-
poolVO.setCapacityBytes(savedCapacityBytes);
473-
poolVO.setUsedBytes(savedUsedBytes);
474-
storagePoolDao.update(poolVO.getId(), poolVO);
475-
}
476-
477-
return result;
456+
return _storagePoolAutomation.cancelMaintain(store);
478457
} else {
479458
return false;
480459
}

server/src/main/java/com/cloud/storage/StorageManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3109,7 +3109,7 @@ public void updateStoragePoolHostVOAndBytes(StoragePool pool, long hostId, Modif
31093109
}
31103110

31113111
StoragePoolVO poolVO = _storagePoolDao.findById(pool.getId());
3112-
if (!Storage.StoragePoolType.StorPool.equals(poolVO.getPoolType())) {
3112+
if (!Storage.StoragePoolType.StorPool.equals(poolVO.getPoolType()) && !poolVO.getStorageProviderName().equals(DataStoreProvider.ONTAP_PLUGIN_NAME) ) {
31133113
poolVO.setUsedBytes(mspAnswer.getPoolInfo().getCapacityBytes() - mspAnswer.getPoolInfo().getAvailableBytes());
31143114
poolVO.setCapacityBytes(mspAnswer.getPoolInfo().getCapacityBytes());
31153115
}

0 commit comments

Comments
 (0)