weizhouapache commented on a change in pull request #5757:
URL: https://github.com/apache/cloudstack/pull/5757#discussion_r773825598
##########
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:
@GutoVeronezi
thanks for your suggestion. I will consider it if there are many code lines
in the `if` block.
for these 3 methods, they have only 2 lines in `if` block, and I think `&&`
is easier to understand than `!(aa) || !(bb)`
--
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]