mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-6223. removeNicFromVirtualMachine fails if another instance in another domain has a nic with the same ip and a forwarding rule configured on it
Signed-off-by: Daan Hoogland <daan@onecht.net>
This commit is contained in:
parent
b105a33e0c
commit
e9af5f44ae
|
|
@ -44,5 +44,7 @@ public interface PortForwardingRulesDao extends GenericDao<PortForwardingRuleVO,
|
|||
|
||||
List<PortForwardingRuleVO> listByDestIpAddr(String ip4Address);
|
||||
|
||||
List<PortForwardingRuleVO> listByVmidAndDestIpAddr(String ip4Address,long vmid);
|
||||
|
||||
PortForwardingRuleVO findByIdAndIp(long id, String secondaryIp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,6 +157,14 @@ public class PortForwardingRulesDaoImpl extends GenericDaoBase<PortForwardingRul
|
|||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PortForwardingRuleVO> listByVmidAndDestIpAddr(String ip4Address,long vmid) {
|
||||
SearchCriteria<PortForwardingRuleVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("dstIp", ip4Address);
|
||||
sc.setParameters("vmId", vmid);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PortForwardingRuleVO findByIdAndIp(long id, String secondaryIp) {
|
||||
SearchCriteria<PortForwardingRuleVO> sc = AllFieldsSearch.create();
|
||||
|
|
|
|||
|
|
@ -1465,7 +1465,7 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
|
|||
public List<FirewallRuleVO> listAssociatedRulesForGuestNic(Nic nic) {
|
||||
List<FirewallRuleVO> result = new ArrayList<FirewallRuleVO>();
|
||||
// add PF rules
|
||||
result.addAll(_portForwardingDao.listByDestIpAddr(nic.getIp4Address()));
|
||||
result.addAll(_portForwardingDao.listByVmidAndDestIpAddr(nic.getIp4Address(),nic.getInstanceId()));
|
||||
// add static NAT rules
|
||||
List<FirewallRuleVO> staticNatRules = _firewallDao.listStaticNatByVmId(nic.getInstanceId());
|
||||
for (FirewallRuleVO rule : staticNatRules) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue