Damans227 commented on code in PR #14341:
URL: https://github.com/apache/cloudstack/pull/14341#discussion_r4271232647
##########
server/src/main/java/com/cloud/vm/UserVmManagerImpl.java:
##########
@@ -1790,12 +1790,14 @@ public UserVm
updateDefaultNicForVirtualMachine(UpdateDefaultNicForVMCmd cmd) th
logger.debug("successfully set default network to " + network + "
for " + vmInstance);
String nicIdString = Long.toString(nic.getId());
long newNetworkOfferingId = network.getNetworkOfferingId();
+ // close nic's old row before opening its new one, not after -
otherwise the REMOVE below can't tell
+ // the stale row apart from the one just ASSIGNed and closes both
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_REMOVE,
vmInstance.getAccountId(), vmInstance.getDataCenterId(), vmInstance.getId(),
oldNicIdString, oldNetworkOfferingId, null, 1L,
VirtualMachine.class.getName(), vmInstance.getUuid(), vmInstance.isDisplay());
-
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_ASSIGN,
vmInstance.getAccountId(), vmInstance.getDataCenterId(), vmInstance.getId(),
nicIdString,
- newNetworkOfferingId, null, 1L,
VirtualMachine.class.getName(), vmInstance.getUuid(), vmInstance.isDisplay());
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_REMOVE,
vmInstance.getAccountId(), vmInstance.getDataCenterId(), vmInstance.getId(),
nicIdString,
newNetworkOfferingId, null, 0L,
VirtualMachine.class.getName(), vmInstance.getUuid(), vmInstance.isDisplay());
+
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_ASSIGN,
vmInstance.getAccountId(), vmInstance.getDataCenterId(), vmInstance.getId(),
nicIdString,
Review Comment:
does the usage server always process these in this order? all four land in
the same second and it only sorts events by time
--
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]