CLOUDSTACK-10 Deleting a disconnected primary storage results in partial removed state

This commit is contained in:
Mice Xia 2012-09-18 11:11:13 +08:00
parent 11b42481e1
commit 955cbd97bc
1 changed files with 4 additions and 3 deletions

View File

@ -1503,7 +1503,10 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag
s_logger.warn("Unable to find pool:" + id);
throw new InvalidParameterValueException("Unable to find pool by id " + id);
}
if(sPool.getStatus() != StoragePoolStatus.Maintenance){
s_logger.warn("Unable to delete storage id: " + id +" due to it is not in Maintenance state");
throw new InvalidParameterValueException("Unable to delete storage due to it is not in Maintenance state, id: " + id);
}
if (sPool.getPoolType().equals(StoragePoolType.LVM) || sPool.getPoolType().equals(StoragePoolType.EXT)) {
s_logger.warn("Unable to delete local storage id:" + id);
throw new InvalidParameterValueException("Unable to delete local storage id: " + id);
@ -1545,8 +1548,6 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag
// mark storage pool as removed (so it can't be used for new volumes creation), release the lock
boolean isLockReleased = false;
sPool.setStatus(StoragePoolStatus.Removed);
_storagePoolDao.update(id, sPool);
isLockReleased = _storagePoolDao.releaseFromLockTable(lock.getId());
s_logger.trace("Released lock for storage pool " + id);