CLOUDSTACK-1208: Failed to shutdown guest network

Firewall manager was being used instead of LoadBalancingRules manager
while applying the load balancer rules in shut down network. Changing it
to LoadBalancingRules manager.
This commit is contained in:
Murali Reddy 2013-02-08 18:50:18 +05:30
parent b59a18d1a1
commit 68c110cb18
2 changed files with 8 additions and 6 deletions

View File

@ -2994,6 +2994,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
private boolean shutdownNetworkResources(long networkId, Account caller, long callerUserId) {
// This method cleans up network rules on the backend w/o touching them in the DB
boolean success = true;
Network network = _networksDao.findById(networkId);
// Mark all PF rules as revoked and apply them on the backend (not in the DB)
List<PortForwardingRuleVO> pfRules = _portForwardingRulesDao.listByNetwork(networkId);
@ -3066,7 +3067,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
}
try {
if (!_firewallMgr.applyRules(lbRules, true, false)) {
if (!_lbMgr.applyRules(network, Purpose.LoadBalancing, lbs)) {
s_logger.warn("Failed to cleanup lb rules as a part of shutdownNetworkRules");
success = false;
}
@ -3145,7 +3146,6 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
}
// Get all ip addresses, mark as releasing and release them on the backend
Network network = _networksDao.findById(networkId);
List<IPAddressVO> userIps = _ipAddressDao.listByAssociatedNetwork(networkId, null);
List<PublicIp> publicIpsToRelease = new ArrayList<PublicIp>();
if (userIps != null && !userIps.isEmpty()) {

View File

@ -16,16 +16,18 @@
// under the License.
package com.cloud.network.lb;
import java.util.List;
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLoadBalancerRuleCmd;
import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network;
import com.cloud.network.lb.LoadBalancingRule.LbDestination;
import com.cloud.network.lb.LoadBalancingRule.LbStickinessPolicy;
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.LbStickinessMethod;
import com.cloud.network.rules.LoadBalancer;
import com.cloud.user.Account;
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLoadBalancerRuleCmd;
import java.util.List;
public interface LoadBalancingRulesManager extends LoadBalancingRulesService {
@ -43,7 +45,7 @@ public interface LoadBalancingRulesManager extends LoadBalancingRulesService {
* @return true if removal is successful
*/
boolean removeVmFromLoadBalancers(long vmId);
boolean applyRules(Network network, FirewallRule.Purpose purpose, List<? extends FirewallRule> rules) throws ResourceUnavailableException ;
boolean applyLoadBalancersForNetwork(long networkId) throws ResourceUnavailableException;
String getLBCapability(long networkid, String capabilityName);
boolean configureLbAutoScaleVmGroup(long vmGroupid, String currentState) throws ResourceUnavailableException;