weizhouapache commented on a change in pull request #5757:
URL: https://github.com/apache/cloudstack/pull/5757#discussion_r773854729
##########
File path: server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
##########
@@ -1826,6 +1801,45 @@ public void
doInTransactionWithoutResult(TransactionStatus status) {
return vm;
}
+ private void updatePublicIpDnatVmIp(long vmId, long networkId, String
oldIp, String newIp) {
+ if (_networkModel.areServicesSupportedInNetwork(networkId,
Service.StaticNat)) {
+ List<IPAddressVO> publicIps =
_ipAddressDao.listByAssociatedVmId(vmId);
+ for (IPAddressVO publicIp : publicIps) {
+ if (oldIp.equals(publicIp.getVmIp()) &&
publicIp.getAssociatedWithNetworkId() == networkId) {
+ publicIp.setVmIp(newIp);
+ _ipAddressDao.persist(publicIp);
+ }
+ }
+ }
Review comment:
> @weizhouapache sorry, selecting multiple lines may have confused my
comment.
>
> I agree with you when we talk about the second `if` statement, however, I
meant invert the first `if` statement, like this:
>
> This way we can avoid the `hadouken code` =)
@GutoVeronezi ah ok, my misunderstanding. I will change it. thanks
--
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]