bug 7034,6869: fixing the storage pools issue, and the npe at load balancer if the router is not found.

status 7034, 6869: resolved fixed
This commit is contained in:
abhishek 2010-11-04 17:17:51 -07:00
parent 1eef924c6c
commit 364e1e1c4a
2 changed files with 11 additions and 13 deletions

View File

@ -1180,8 +1180,13 @@ public class NetworkManagerImpl implements NetworkManager, DomainRouterService {
}
DomainRouterVO syncObject = _routerMgr.getRouter(loadBalancer.getIpAddress());
cmd.synchronizeCommand("Router", syncObject.getId());
if(syncObject == null){
throw new InvalidParameterValueException("Failed to assign to load balancer " + loadBalancerId + ", the domain router was not found at "+loadBalancer.getIpAddress());
}
else{
cmd.synchronizeCommand("Router", syncObject.getId());
}
// Permission check...
Account account = UserContext.current().getAccount();
if (account != null) {

View File

@ -2160,17 +2160,10 @@ public class StorageManagerImpl implements StorageManager {
s_logger.error(msg);
throw new ResourceUnavailableException(msg);
}
primaryStorage = _storagePoolDao.findById(primaryStorageId);
if(primaryStorage == null)
{
s_logger.warn("The primary storage does not exist");
throw new InvalidParameterValueException("Primary storage doesn't exist");
}
// if (!primaryStorage.getStatus().equals(Status.Up)) {
// throw new InvalidParameterValueException("Primary storage with id " + primaryStorageId + " is not ready for migration, as the status is:" + primaryStorage.getStatus().toString());
// }
if (!primaryStorage.getStatus().equals(Status.Up) && !primaryStorage.getStatus().equals(Status.ErrorInMaintenance)) {
throw new InvalidParameterValueException("Primary storage with id " + primaryStorageId + " is not ready for migration, as the status is:" + primaryStorage.getStatus().toString());
}
//set the pool state to prepare for maintenance
primaryStorage.setStatus(Status.PrepareForMaintenance);
_storagePoolDao.persist(primaryStorage);
@ -2195,7 +2188,7 @@ public class StorageManagerImpl implements StorageManager {
continue;
//shut down the running vms
if(vmInstance.getState().equals(State.Running) || vmInstance.getState().equals(State.Stopped) || vmInstance.getState().equals(State.Stopping) || vmInstance.getState().equals(State.Starting))
if(vmInstance.getState().equals(State.Running) || vmInstance.getState().equals(State.Starting))
{
//if the instance is of type consoleproxy, call the console proxy