Set back the datastore cluster state to UP upon on failure in prepare maintenance

This commit is contained in:
Harikrishna Patnala 2020-08-28 01:03:05 +05:30
parent 40934ba9ff
commit c11dc337be

View File

@ -1583,12 +1583,14 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
for (DataStore dataStore: maintenanceSuccessfulStoragePools) { for (DataStore dataStore: maintenanceSuccessfulStoragePools) {
lifeCycle.cancelMaintain(dataStore); lifeCycle.cancelMaintain(dataStore);
} }
// Set back to Up state of remaining child storage pools // Set back to Up state of remaining child storage pools and datastore cluster
while (iteratorChildDatastore.hasNext()) { while (iteratorChildDatastore.hasNext()) {
StoragePoolVO childDatastore = iteratorChildDatastore.next(); StoragePoolVO childDatastore = iteratorChildDatastore.next();
childDatastore.setStatus(StoragePoolStatus.Up); childDatastore.setStatus(StoragePoolStatus.Up);
_storagePoolDao.update(childDatastore.getId(), childDatastore); _storagePoolDao.update(childDatastore.getId(), childDatastore);
} }
datastoreCluster.setStatus(StoragePoolStatus.Up);
_storagePoolDao.update(datastoreCluster.getId(), datastoreCluster);
throw new CloudRuntimeException(String.format("Failed to prepare maintenance mode for datastore cluster %d with error %s %s", primaryStorageId, e.getMessage(), e)); 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); maintenanceSuccessfulStoragePools.add(childStore);