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.
This commit is contained in:
Murali Reddy 2013-05-03 11:36:58 +05:30
parent 3087bf7e5b
commit 0680fbdff3
1 changed files with 12 additions and 10 deletions

View File

@ -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");
}
}
}