CLOUDSTACK-2193: associateIpAddress is failing in "basic zone" that is
enabled for EIP/ELB

restricting check that shared network should have services in orider to
associate ip, to advaced zone shared networks only. On basic zone shared
network associateIpAddress should work.


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

Branch: refs/heads/internallb
Commit: 0680fbdff3876723035ae86ab9b7c577a9452836
Parents: 3087bf7
Author: Murali Reddy <murali.re...@citrix.com>
Authored: Fri May 3 11:36:58 2013 +0530
Committer: Murali Reddy <murali.re...@citrix.com>
Committed: Fri May 3 11:38:40 2013 +0530

----------------------------------------------------------------------
 .../src/com/cloud/network/NetworkServiceImpl.java  |   22 ++++++++-------
 1 files changed, 12 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0680fbdf/server/src/com/cloud/network/NetworkServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java 
b/server/src/com/cloud/network/NetworkServiceImpl.java
index b2db06c..d8f8d5d 100755
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@ -426,17 +426,19 @@ public class NetworkServiceImpl extends ManagerBase 
implements  NetworkService {
                 }
 
                 // if shared network in the advanced zone, then check the 
caller against the network for 'AccessType.UseNetwork'
-                if 
(isSharedNetworkOfferingWithServices(network.getNetworkOfferingId()) && 
zone.getNetworkType() == NetworkType.Advanced) {
-                    Account caller = UserContext.current().getCaller();
-                    long callerUserId = 
UserContext.current().getCallerUserId();
-                    _accountMgr.checkAccess(caller, AccessType.UseNetwork, 
false, network);
-                    if (s_logger.isDebugEnabled()) {
-                        s_logger.debug("Associate IP address called by the 
user " + callerUserId + " account " + ipOwner.getId());
+                if (zone.getNetworkType() == NetworkType.Advanced) {
+                    if 
(isSharedNetworkOfferingWithServices(network.getNetworkOfferingId())) {
+                        Account caller = UserContext.current().getCaller();
+                        long callerUserId = 
UserContext.current().getCallerUserId();
+                        _accountMgr.checkAccess(caller, AccessType.UseNetwork, 
false, network);
+                        if (s_logger.isDebugEnabled()) {
+                            s_logger.debug("Associate IP address called by the 
user " + callerUserId + " account " + ipOwner.getId());
+                        }
+                        return _networkMgr.allocateIp(ipOwner, false, caller, 
callerUserId, zone);
+                    } else {
+                        throw new InvalidParameterValueException("Associate IP 
address can only be called on the shared networks in the advanced zone" +
+                                " with Firewall/Source Nat/Static Nat/Port 
Forwarding/Load balancing services enabled");
                     }
-                    return _networkMgr.allocateIp(ipOwner, false, caller, 
callerUserId, zone);
-                } else {
-                    throw new InvalidParameterValueException("Associate IP 
address can only be called on the shared networks in the advanced zone" +
-                        " with Firewall/Source Nat/Static Nat/Port 
Forwarding/Load balancing services enabled");
                 }
             }
         }

Reply via email to