You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by we...@apache.org on 2014/12/11 15:15:10 UTC

git commit: updated refs/heads/master to f5619f4

Repository: cloudstack
Updated Branches:
  refs/heads/master ed6333f3e -> f5619f428


CLOUDSTACK-8051: fix NPE in updateNetwork due to static nat rules exist but no StaticNat provider


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f5619f42
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f5619f42
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f5619f42

Branch: refs/heads/master
Commit: f5619f428b2e8ab25a2ce1ac8c03262714bc32cb
Parents: ed6333f
Author: Wei Zhou <w....@tech.leaseweb.com>
Authored: Thu Dec 11 15:13:36 2014 +0100
Committer: Wei Zhou <w....@tech.leaseweb.com>
Committed: Thu Dec 11 15:13:36 2014 +0100

----------------------------------------------------------------------
 server/src/com/cloud/network/IpAddressManagerImpl.java | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f5619f42/server/src/com/cloud/network/IpAddressManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/IpAddressManagerImpl.java b/server/src/com/cloud/network/IpAddressManagerImpl.java
index 4335349..96736ef 100644
--- a/server/src/com/cloud/network/IpAddressManagerImpl.java
+++ b/server/src/com/cloud/network/IpAddressManagerImpl.java
@@ -1697,11 +1697,17 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
 
     @Override
     public boolean applyStaticNats(List<? extends StaticNat> staticNats, boolean continueOnError, boolean forRevoke) throws ResourceUnavailableException {
+        if (staticNats == null || staticNats.size() == 0) {
+            s_logger.debug("There are no static nat rules for the network elements");
+            return true;
+        }
+
         Network network = _networksDao.findById(staticNats.get(0).getNetworkId());
         boolean success = true;
 
-        if (staticNats == null || staticNats.size() == 0) {
-            s_logger.debug("There are no static nat rules for the network elements");
+        // Check if the StaticNat service is supported
+        if (!_networkModel.areServicesSupportedInNetwork(network.getId(), Service.StaticNat)) {
+            s_logger.debug("StaticNat service is not supported in specified network id");
             return true;
         }