weizhouapache edited a comment on pull request #5985:
URL: https://github.com/apache/cloudstack/pull/5985#issuecomment-1039964422
@Pearl1594
in my testing, if public ips are used for port forwarding or load balancer,
everything seems ok.
If public ips are used for static nat, the interface will be removed even if
there is still public ip in use (for example, pf or lb or nat). This issue
happens with eth2 as well which is the interface for source nat.
steps to reproduce the issue
(1) acquire public IP in source NAT ip range or additional IP range
(2) enable static nat
(3) disbale static nat
expected result: interface is plugged when enable static nat if needed.
interface is unplugged if IP is the last attached IP on the interface, when
disable static nat.
actual result: interface is unplugged every time when disable static nat, no
matter if it is the last IP.
I think we should use similar code like
```
final String lastIp =
cmd.getAccessDetail(NetworkElementCommand.NETWORK_PUB_LAST_IP);
for (final IpAddressTO ip : ips) {
if (!StringUtils.equalsIgnoreCase(lastIp, "true") ||
ip.isAdd()) {
continue;
}
```
and
```
if (publicNicInfo.first() == 2) {
s_logger.debug("Do not remove eth2 in network VR because it is
the public NIC of source NAT.");
continue;
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]