mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
don't set state to errorinmaintenance if cancel maintenance encounters a ps with a state !=Maintenance
This commit is contained in:
parent
d96a1a841d
commit
55e9378f9a
@ -2349,7 +2349,7 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@DB
|
@DB
|
||||||
public synchronized StoragePoolVO cancelPrimaryStorageForMaintenance(CancelPrimaryStorageMaintenanceCmd cmd) throws InvalidParameterValueException{
|
public synchronized StoragePoolVO cancelPrimaryStorageForMaintenance(CancelPrimaryStorageMaintenanceCmd cmd){
|
||||||
Long primaryStorageId = cmd.getId();
|
Long primaryStorageId = cmd.getId();
|
||||||
Long userId = UserContext.current().getUserId();
|
Long userId = UserContext.current().getUserId();
|
||||||
StoragePoolVO primaryStorage = null;
|
StoragePoolVO primaryStorage = null;
|
||||||
@ -2365,7 +2365,7 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!primaryStorage.getStatus().equals(Status.Maintenance)) {
|
if (!primaryStorage.getStatus().equals(Status.Maintenance)) {
|
||||||
throw new InvalidParameterValueException("Primary storage with id " + primaryStorageId + " is not ready to complete migration, as the status is:" + primaryStorage.getStatus().toString());
|
throw new StorageUnavailableException("Primary storage with id " + primaryStorageId + " is not ready to complete migration, as the status is:" + primaryStorage.getStatus().toString()+".Re-run maintenance.");
|
||||||
}
|
}
|
||||||
|
|
||||||
//2. Get a list of all the volumes within this storage pool
|
//2. Get a list of all the volumes within this storage pool
|
||||||
@ -2478,6 +2478,10 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
_storagePoolDao.persist(primaryStorage);
|
_storagePoolDao.persist(primaryStorage);
|
||||||
throw new ServerApiException(BaseCmd.CANCEL_STORAGE_MAINTENANCE_ERROR, e.getMessage());
|
throw new ServerApiException(BaseCmd.CANCEL_STORAGE_MAINTENANCE_ERROR, e.getMessage());
|
||||||
}
|
}
|
||||||
|
else if(e instanceof StorageUnavailableException){
|
||||||
|
//the ps was not in maintenance mode; dont reset state as maintenance did not begin
|
||||||
|
throw new ServerApiException(BaseCmd.CANCEL_STORAGE_MAINTENANCE_ERROR, e.getMessage());
|
||||||
|
}
|
||||||
else{//all other exceptions
|
else{//all other exceptions
|
||||||
primaryStorage.setStatus(Status.ErrorInMaintenance);
|
primaryStorage.setStatus(Status.ErrorInMaintenance);
|
||||||
_storagePoolDao.persist(primaryStorage);
|
_storagePoolDao.persist(primaryStorage);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user