mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
bug 7244: delete corresponding untagged pod vlan ranges when pod is deleted
status 7244: resolved fixed
This commit is contained in:
parent
916b516d13
commit
4ec3bc5865
@ -523,7 +523,15 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
if (!(_LinkLocalIpAllocDao.deleteIpAddressByPod(podId))) {
|
||||
throw new CloudRuntimeException("Failed to cleanup private ip addresses for pod " + podId);
|
||||
}
|
||||
|
||||
|
||||
//Delete vlans associated with the pod
|
||||
List<? extends Vlan> vlans = _networkMgr.listPodVlans(podId);
|
||||
if (vlans != null && !vlans.isEmpty()) {
|
||||
for (Vlan vlan: vlans) {
|
||||
_vlanDao.remove(vlan.getId());
|
||||
}
|
||||
}
|
||||
|
||||
//Delete the pod
|
||||
if (!(_podDao.expunge(podId))) {
|
||||
throw new CloudRuntimeException("Failed to delete pod " + podId);
|
||||
|
||||
@ -20,6 +20,7 @@ package com.cloud.network;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.dc.Vlan;
|
||||
import com.cloud.dc.Vlan.VlanType;
|
||||
import com.cloud.deploy.DeployDestination;
|
||||
import com.cloud.deploy.DeploymentPlan;
|
||||
@ -137,6 +138,6 @@ public interface NetworkManager extends NetworkService {
|
||||
|
||||
PublicIpAddress getPublicIpAddress(Ip ipAddress);
|
||||
|
||||
String getPodVlanGateway(long podId);
|
||||
List<? extends Vlan> listPodVlans(long podId);
|
||||
|
||||
}
|
||||
|
||||
@ -99,6 +99,7 @@ import com.cloud.network.lb.LoadBalancingRule;
|
||||
import com.cloud.network.lb.LoadBalancingRulesManager;
|
||||
import com.cloud.network.router.VirtualNetworkApplianceManager;
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.network.rules.PortForwardingRule;
|
||||
import com.cloud.network.rules.PortForwardingRuleVO;
|
||||
import com.cloud.network.rules.RulesManager;
|
||||
import com.cloud.network.rules.dao.PortForwardingRulesDao;
|
||||
@ -176,7 +177,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
@Inject VirtualNetworkApplianceManager _routerMgr;
|
||||
@Inject RulesManager _rulesMgr;
|
||||
@Inject LoadBalancingRulesManager _lbMgr;
|
||||
@Inject PortForwardingRulesDao _pfRulesDao;
|
||||
@Inject UsageEventDao _usageEventDao;
|
||||
@Inject PodVlanMapDao _podVlanMapDao;
|
||||
|
||||
@ -1636,7 +1636,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
|
||||
@Override
|
||||
public boolean applyRules(List<? extends FirewallRule> rules, boolean continueOnError) throws ResourceUnavailableException {
|
||||
if (rules.size() == 0) {
|
||||
if (rules == null || rules.size() == 0) {
|
||||
s_logger.debug("There are no rules to forward to the network elements");
|
||||
return true;
|
||||
}
|
||||
@ -1742,7 +1742,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
}
|
||||
|
||||
//Reapply pf rules
|
||||
List<PortForwardingRuleVO> pfRules = _pfRulesDao.listByNetworkId(networkId);
|
||||
List<? extends PortForwardingRule> pfRules = _rulesMgr.listByNetworkId(networkId);
|
||||
if (!applyRules(pfRules, true)) {
|
||||
s_logger.warn("Failed to apply port forwarding rules as a part of network " + network.getId() + " restart");
|
||||
return false;
|
||||
@ -1843,14 +1843,9 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPodVlanGateway(long podId) {
|
||||
public List<VlanVO> listPodVlans(long podId) {
|
||||
List<VlanVO> vlans = _vlanDao.listVlansForPodByType(podId, VlanType.DirectAttached);
|
||||
//we don't allow vlans to have different gateways, so take the value from the first one
|
||||
if (vlans == null || !vlans.isEmpty()) {
|
||||
return vlans.get(0).getVlanGateway();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return vlans;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -75,4 +75,6 @@ public interface RulesManager extends RulesService {
|
||||
|
||||
FirewallRule[] reservePorts(IpAddress ip, String protocol, FirewallRule.Purpose purpose, int... ports) throws NetworkRuleConflictException;
|
||||
boolean releasePorts(Ip ip, String protocol, FirewallRule.Purpose purpose, int... ports);
|
||||
|
||||
List<? extends PortForwardingRule> listByNetworkId(long networkId);
|
||||
}
|
||||
|
||||
@ -526,6 +526,10 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager {
|
||||
|
||||
return allRules;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<? extends PortForwardingRule> listByNetworkId(long networkId) {
|
||||
return _forwardingDao.listByNetworkId(networkId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user