rhtyd commented on a change in pull request #3205: server: update dhcp
configurations in vrs while update default nic of running vms
URL: https://github.com/apache/cloudstack/pull/3205#discussion_r264535778
##########
File path: server/src/com/cloud/vm/UserVmManagerImpl.java
##########
@@ -1448,6 +1448,19 @@ public UserVm
updateDefaultNicForVirtualMachine(UpdateDefaultNicForVMCmd cmd) th
newNetworkOfferingId, null, 0L,
VirtualMachine.class.getName(), vmInstance.getUuid(), vmInstance.isDisplay());
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_ASSIGN,
vmInstance.getAccountId(), vmInstance.getDataCenterId(), vmInstance.getId(),
oldNicIdString, oldNetworkOfferingId, null, 0L,
VirtualMachine.class.getName(), vmInstance.getUuid(), vmInstance.isDisplay());
+
+ if (vmInstance.getState() != State.Stopped) {
+ try {
+ VirtualMachineProfile vmProfile = new
VirtualMachineProfileImpl(vmInstance);
+ User callerUser =
_accountMgr.getActiveUser(CallContext.current().getCallingUserId());
+ ReservationContext context = new
ReservationContextImpl(null, null, callerUser, caller);
+ DeployDestination dest = new DeployDestination(dc, null,
null, null);
+ _networkMgr.prepare(vmProfile, dest, context);
+ } catch (final Exception e) {
+ s_logger.info("Got exception: ", e);
Review comment:
Can you fix and elaborate the exception. And should we be doing
network-manager.prepare()? Will this remove old configuration (all metadata and
config) for the VM? Should we check for vm state to be running instead?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services