sureshanaparti commented on a change in pull request #5757:
URL: https://github.com/apache/cloudstack/pull/5757#discussion_r768408320
##########
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:
ok, thanks for the confirmation @weizhouapache
--
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]