mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
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 service = privatePort.contains("-") ? nsxApiClient.getServicePath(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);
|
||||
}
|
||||
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 {
|
||||
NatRules natService = (NatRules) nsxService.apply(NatRules.class);
|
||||
PolicyNatRule rule = natService.get(tier1GatewayName, NAT_ID, ruleName);
|
||||
return !Objects.isNull(rule);
|
||||
} catch (Error error) {
|
||||
LOGGER.debug(String.format("Found a port forward rule named: %s on NSX", ruleName));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -781,6 +782,7 @@ public class NsxApiClient {
|
||||
return lbVirtualServer;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.debug(String.format("Found an LB virtual server named: %s on NSX", lbVSName));
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user