mirror of https://github.com/apache/cloudstack.git
Fixed NPE in deleteAccount code - when shutdown the network, always set reservation context with account/userCaller information
This commit is contained in:
parent
3113ae4993
commit
cb73c1e1fa
|
|
@ -1710,7 +1710,20 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
|||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Sending network shutdown to " + element);
|
||||
}
|
||||
element.shutdown(network, null);
|
||||
|
||||
User caller = null;
|
||||
Account owner = _accountMgr.getAccount(network.getAccountId());
|
||||
|
||||
UserContext ctx = UserContext.current();
|
||||
if (ctx == null) {
|
||||
caller = _accountMgr.getSystemUser();
|
||||
} else {
|
||||
caller = _accountMgr.getActiveUser(ctx.getCallerUserId());
|
||||
}
|
||||
|
||||
ReservationContext context = new ReservationContextImpl(null, null, caller, owner);
|
||||
|
||||
element.shutdown(network, context);
|
||||
} catch (ResourceUnavailableException e) {
|
||||
s_logger.warn("Unable to complete shutdown of the network due to element: " + element.getName(), e);
|
||||
success = false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue