mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Handle failure case of putting datastore cluster on maintenance mode
This commit is contained in:
parent
2dd6e184d5
commit
ab171adfdd
@ -1562,9 +1562,8 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
||||
}
|
||||
});
|
||||
List<DataStore> maintenanceSuccessfulStoragePools = new ArrayList<>();
|
||||
for (StoragePoolVO childDatastore : childDatastores) {
|
||||
//FR41 need to handle when one of the primary stores is unable to put in maintenance mode
|
||||
DataStore childStore = _dataStoreMgr.getDataStore(childDatastore.getId(), DataStoreRole.Primary);
|
||||
for (Iterator<StoragePoolVO> iteratorChildDatastore = childDatastores.listIterator(); iteratorChildDatastore.hasNext(); ) {
|
||||
DataStore childStore = _dataStoreMgr.getDataStore(iteratorChildDatastore.next().getId(), DataStoreRole.Primary);
|
||||
try {
|
||||
lifeCycle.maintain(childStore);
|
||||
} catch (Exception e) {
|
||||
@ -1572,9 +1571,17 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
||||
s_logger.debug(String.format("Exception on maintenance preparation of one of the child datastores in datastore cluster %d with error %s", primaryStorageId, e));
|
||||
s_logger.debug(String.format("Cancelling the maintenance mode of child datastores in datastore cluster %d", primaryStorageId));
|
||||
}
|
||||
// Cancel maintenance mode of already prepared child storage pools
|
||||
maintenanceSuccessfulStoragePools.add(childStore);
|
||||
for (DataStore dataStore: maintenanceSuccessfulStoragePools) {
|
||||
lifeCycle.cancelMaintain(dataStore);
|
||||
}
|
||||
// Set back to Up state of remaining child storage pools
|
||||
while (iteratorChildDatastore.hasNext()) {
|
||||
StoragePoolVO childDatastore = iteratorChildDatastore.next();
|
||||
childDatastore.setStatus(StoragePoolStatus.Up);
|
||||
_storagePoolDao.update(childDatastore.getId(), childDatastore);
|
||||
}
|
||||
throw new CloudRuntimeException(String.format("Failed to prepare maintenance mode for datastore cluster %d with error %s %s", primaryStorageId, e.getMessage(), e));
|
||||
}
|
||||
maintenanceSuccessfulStoragePools.add(childStore);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user