Fixed NPE in deleteAccount code - when shutdown the network, always set reservation context with account/userCaller information
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java
index 89e2a4e..598000f 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -1711,7 +1711,20 @@
                 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;