You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/12/14 06:01:31 UTC
[GitHub] [cloudstack] sureshanaparti commented on a change in pull request #5757: network: update ip in lb/pf/dnat tables when update vm nic ip
sureshanaparti commented on a change in pull request #5757:
URL: https://github.com/apache/cloudstack/pull/5757#discussion_r768339657
##########
File path: server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
##########
@@ -1747,38 +1748,12 @@ public UserVm updateNicIpForVirtualMachine(UpdateVmNicIpCmd cmd) {
throw new InvalidParameterValueException("Allocating ip to guest nic " + nicVO.getUuid() + " failed, please choose another ip");
}
- if (_networkModel.areServicesSupportedInNetwork(network.getId(), Service.StaticNat)) {
- IPAddressVO oldIP = _ipAddressDao.findByAssociatedVmId(vm.getId());
- if (oldIP != null) {
- oldIP.setVmIp(ipaddr);
- _ipAddressDao.persist(oldIP);
- }
+ if (nicVO.getIPv4Address() != null) {
+ updatePublicIpDnatVmIp(vm.getId(), network.getId(), nicVO.getIPv4Address(), ipaddr);
+ updateLoadBalancerRulesVmIp(vm.getId(), network.getId(), nicVO.getIPv4Address(), ipaddr);
+ updatePortForwardingRulesVmIp(vm.getId(), network.getId(), nicVO.getIPv4Address(), ipaddr);
}
- // implementing the network elements and resources as a part of vm nic ip update if network has services and it is in Implemented state
- if (!_networkModel.listNetworkOfferingServices(offering.getId()).isEmpty() && network.getState() == Network.State.Implemented) {
- User callerUser = _accountMgr.getActiveUser(CallContext.current().getCallingUserId());
- ReservationContext context = new ReservationContextImpl(null, null, callerUser, caller);
- DeployDestination dest = new DeployDestination(_dcDao.findById(network.getDataCenterId()), null, null, null);
- s_logger.debug("Implementing the network " + network + " elements and resources as a part of vm nic ip update");
- try {
- // implement the network elements and rules again
- _networkMgr.implementNetworkElementsAndResources(dest, context, network, offering);
Review comment:
@weizhouapache is this call not required while updating nic?
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org