From ed50caa01c12320c4fa5ff7d4e0818840a6c764d Mon Sep 17 00:00:00 2001 From: Alena Prokharchyk Date: Mon, 29 Apr 2013 17:48:36 -0700 Subject: [PATCH] InternalLbVM: handle the scenario when sourceIpAddress is not passed when create internal Lb rule --- .../lb/ApplicationLoadBalancerManagerImpl.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java b/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java index b646bad0fca..296dea982da 100644 --- a/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java +++ b/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java @@ -236,14 +236,14 @@ public class ApplicationLoadBalancerManagerImpl extends ManagerBase implements A * @return * @throws InsufficientVirtualNetworkCapcityException */ - protected Ip getSourceIp(Scheme scheme, Network sourceIpNtwk, String requestedIp) throws InsufficientVirtualNetworkCapcityException { - //Get source IP address - if (_lbDao.countBySourceIp(new Ip(requestedIp), sourceIpNtwk.getId()) > 0) { - s_logger.debug("IP address " + requestedIp + " is already used by existing LB rule, returning it"); - return new Ip(requestedIp); - } + protected Ip getSourceIp(Scheme scheme, Network sourceIpNtwk, String requestedIp) throws InsufficientVirtualNetworkCapcityException { if (requestedIp != null) { + if (_lbDao.countBySourceIp(new Ip(requestedIp), sourceIpNtwk.getId()) > 0) { + s_logger.debug("IP address " + requestedIp + " is already used by existing LB rule, returning it"); + return new Ip(requestedIp); + } + validateRequestedSourceIpForLbRule(sourceIpNtwk, new Ip(requestedIp), scheme); }