weizhouapache commented on code in PR #11468:
URL: https://github.com/apache/cloudstack/pull/11468#discussion_r2291158889


##########
server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java:
##########
@@ -2257,12 +2262,21 @@ public LoadBalancer 
updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd) {
         LoadBalancerVO tmplbVo = _lbDao.findById(lbRuleId);
         boolean success = _lbDao.update(lbRuleId, lb);
 
-        // If algorithm is changed, have to reapply the lb config
-        if ((algorithm != null) && 
(tmplbVo.getAlgorithm().compareTo(algorithm) != 0)){
+        // If algorithm or lb protocol is changed, have to reapply the lb 
config
+        boolean needToReApplyRule = (algorithm != null && 
algorithm.equals(tmplbVo.getAlgorithm()))
+                || (lbProtocol != null && 
lbProtocol.equals(tmplbVo.getLbProtocol()));
+        if (needToReApplyRule) {
             try {
                 lb.setState(FirewallRule.State.Add);
                 _lbDao.persist(lb);
                 applyLoadBalancerConfig(lbRuleId);
+                if (!lb.getLbProtocol().equals(NetUtils.SSL_PROTO)) {
+                    LoadBalancerCertMapVO loadBalancerCertMapVO = 
_lbCertMapDao.findByLbRuleId(lbRuleId);
+                    if (loadBalancerCertMapVO != null) {
+                        logger.debug("Removing SSL cert for load balancer %s 
as the new protocol is not ssl but %s", lbRuleId, lb.getLbProtocol());
+                        _lbCertMapDao.remove(loadBalancerCertMapVO.getId());
+                    }
+                }

Review Comment:
   will do



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to