changing the nat feature to work with kvm

This commit is contained in:
abhishek 2010-11-24 10:04:01 -08:00
parent 44737d24c5
commit 1950bf7a99
3 changed files with 5 additions and 7 deletions

View File

@ -25,7 +25,6 @@ public class SetFirewallRuleCommand extends RoutingCommand {
String routerIpAddress;
String oldPrivateIP = null;
String oldPrivatePort = null;
boolean nat = false;
boolean create = false;
protected SetFirewallRuleCommand() {
@ -39,10 +38,9 @@ public class SetFirewallRuleCommand extends RoutingCommand {
this.oldPrivatePort = oldPrivatePort;
}
public SetFirewallRuleCommand(String routerName, String routerIpAddress, boolean nat, FirewallRuleVO rule2, boolean create) {
public SetFirewallRuleCommand(String routerName, String routerIpAddress,FirewallRuleVO rule2, boolean create) {
this.routerName = routerName;
this.routerIpAddress = routerIpAddress;
this.nat = nat;
this.rule = new FirewallRuleVO(rule2);
this.create = create;
}

View File

@ -1147,7 +1147,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
protected Answer execute(final SetFirewallRuleCommand cmd) {
String args;
if(cmd.isNat()){
if(cmd.getProtocol().toLowerCase().equals(NetUtils.NAT_PROTO)){
//1:1 NAT needs instanceip;publicip;domrip;op
if(cmd.isCreate())
args = "-A";

View File

@ -870,7 +870,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
if (rule.isForwarding()) {
fwdRules.add(rule);
final SetFirewallRuleCommand cmd = new SetFirewallRuleCommand(routerName, routerIp, false, rule, false);
final SetFirewallRuleCommand cmd = new SetFirewallRuleCommand(routerName, routerIp,rule, false);
cmds.addCommand(cmd);
} else if (rule.getGroupId() != null){
lbRules.add(rule);
@ -952,7 +952,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
rule.setVlanNetmask(vlanNetmask);
if (rule.isForwarding()) {
fwdRules.add(rule);
final SetFirewallRuleCommand cmd = new SetFirewallRuleCommand(router.getInstanceName(), router.getPrivateIpAddress(), false, rule, false);
final SetFirewallRuleCommand cmd = new SetFirewallRuleCommand(router.getInstanceName(), router.getPrivateIpAddress(),rule, false);
cmds.addCommand(cmd);
}
}
@ -3251,7 +3251,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
private boolean createOrDeleteIpForwardingRuleOnDomr(FirewallRuleVO fwRule, DomainRouterVO router, String guestIp, boolean create){
Commands cmds = new Commands(OnError.Continue);
final SetFirewallRuleCommand cmd = new SetFirewallRuleCommand(router.getInstanceName(), router.getPrivateIpAddress(), true, fwRule, create);
final SetFirewallRuleCommand cmd = new SetFirewallRuleCommand(router.getInstanceName(), router.getPrivateIpAddress(),fwRule, create);
cmds.addCommand(cmd);
try {
_agentMgr.send(router.getHostId(), cmds);