mirror of https://github.com/apache/cloudstack.git
add logs
This commit is contained in:
parent
4a56dbba92
commit
3e8bb8d8f8
|
|
@ -387,7 +387,8 @@ public class NsxResource implements ServerResource {
|
||||||
String privatePort = cmd.getPrivatePort();
|
String privatePort = cmd.getPrivatePort();
|
||||||
String service = privatePort.contains("-") ? nsxApiClient.getServicePath(ruleName, privatePort, cmd.getProtocol(), null, null) :
|
String service = privatePort.contains("-") ? nsxApiClient.getServicePath(ruleName, privatePort, cmd.getProtocol(), null, null) :
|
||||||
nsxApiClient.getNsxInfraServices(ruleName, privatePort, cmd.getProtocol(), null, null);
|
nsxApiClient.getNsxInfraServices(ruleName, privatePort, cmd.getProtocol(), null, null);
|
||||||
if (nsxApiClient.doesPfRuleExist(ruleName, tier1GatewayName, cmd.getNetworkResourceName())) {
|
if (nsxApiClient.doesPfRuleExist(ruleName, tier1GatewayName)) {
|
||||||
|
LOGGER.debug(String.format("Port forward rule for port: %s exits on NSX, not adding it again", privatePort));
|
||||||
return new NsxAnswer(cmd, true, null);
|
return new NsxAnswer(cmd, true, null);
|
||||||
}
|
}
|
||||||
nsxApiClient.createPortForwardingRule(ruleName, tier1GatewayName, cmd.getNetworkResourceName(), cmd.getPublicIp(),
|
nsxApiClient.createPortForwardingRule(ruleName, tier1GatewayName, cmd.getNetworkResourceName(), cmd.getPublicIp(),
|
||||||
|
|
|
||||||
|
|
@ -572,12 +572,13 @@ public class NsxApiClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean doesPfRuleExist(String ruleName, String tier1GatewayName, String networkName) {
|
public boolean doesPfRuleExist(String ruleName, String tier1GatewayName) {
|
||||||
try {
|
try {
|
||||||
NatRules natService = (NatRules) nsxService.apply(NatRules.class);
|
NatRules natService = (NatRules) nsxService.apply(NatRules.class);
|
||||||
PolicyNatRule rule = natService.get(tier1GatewayName, NAT_ID, ruleName);
|
PolicyNatRule rule = natService.get(tier1GatewayName, NAT_ID, ruleName);
|
||||||
return !Objects.isNull(rule);
|
return !Objects.isNull(rule);
|
||||||
} catch (Error error) {
|
} catch (Error error) {
|
||||||
|
LOGGER.debug(String.format("Found a port forward rule named: %s on NSX", ruleName));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -781,6 +782,7 @@ public class NsxApiClient {
|
||||||
return lbVirtualServer;
|
return lbVirtualServer;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
LOGGER.debug(String.format("Found an LB virtual server named: %s on NSX", lbVSName));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue