From d3594526294601bcfda01415f370f4bc0e71e910 Mon Sep 17 00:00:00 2001 From: Anshul Gangwar Date: Mon, 2 Nov 2015 13:58:44 +0530 Subject: [PATCH] CLOUDSTACK-9198: Virtual router gets deployed in disabled Pod. While starting the router, send the user from the callingContext instead of defaulting to System user --- .../src/com/cloud/network/router/NetworkHelperImpl.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/src/com/cloud/network/router/NetworkHelperImpl.java b/server/src/com/cloud/network/router/NetworkHelperImpl.java index 12ef0f9995e7..354f529286d3 100644 --- a/server/src/com/cloud/network/router/NetworkHelperImpl.java +++ b/server/src/com/cloud/network/router/NetworkHelperImpl.java @@ -331,7 +331,9 @@ public List startRouters(final RouterDeploymentDefinition router } if (!skip) { if (state != State.Running) { - router = startVirtualRouter(router, _accountMgr.getSystemUser(), _accountMgr.getSystemAccount(), routerDeploymentDefinition.getParams()); + final Account caller = CallContext.current().getCallingAccount(); + final User callerUser = _accountMgr.getActiveUser(CallContext.current().getCallingUserId()); + router = startVirtualRouter(router,callerUser, caller, routerDeploymentDefinition.getParams()); } if (router != null) { runningRouters.add(router); @@ -509,7 +511,9 @@ public DomainRouterVO deployRouter(final RouterDeploymentDefinition routerDeploy if (startRouter) { try { - router = startVirtualRouter(router, _accountMgr.getSystemUser(), _accountMgr.getSystemAccount(), routerDeploymentDefinition.getParams()); + final Account caller = CallContext.current().getCallingAccount(); + final User callerUser = _accountMgr.getActiveUser(CallContext.current().getCallingUserId()); + router = startVirtualRouter(router, callerUser, caller, routerDeploymentDefinition.getParams()); break; } catch (final InsufficientCapacityException ex) { if (startRetry < 2 && iter.hasNext()) {