shwstppr commented on code in PR #7421:
URL: https://github.com/apache/cloudstack/pull/7421#discussion_r1169669091


##########
server/src/main/java/com/cloud/vm/UserVmManagerImpl.java:
##########
@@ -4810,9 +4810,12 @@ protected String validateUserData(String userData, 
HTTPMethod httpmethod) {
     }
 
     @Override
-    @ActionEvent(eventType = EventTypes.EVENT_VM_CREATE, eventDescription = 
"starting Vm", async = true)
+    @ActionEvent(eventType = EventTypes.EVENT_VM_CREATE, eventDescription = 
"deploying Vm", async = true)

Review Comment:
   @DaanHoogland As of now, when deploying a new VM, CloudStack doesn't 
publishes an `EVENT_VM_START` event and `EVENT_VM_CREATE` is not published 
during `_userVmService.createVirtualMachine(this)`.
   I feel this is apt behaviour because 
`_userVmService.createVirtualMachine(this)` will just create a DB record and 
actual deployment could fail in many scenarios.
   Also, for a BaseAsyncCmd event with `Scheduled` state is published only when 
`execute` method of the API command class is executed, 
https://github.com/apache/cloudstack/blob/main/server/src/main/java/com/cloud/api/ApiServer.java#L732-L734.
 Therefore, even if we refactor `EVENT_VM_CREATE` publishing on 
userVmService.createVirtualMachine and `EVENT_VM_START` on 
`userVmService.startVirtualMachine`, without major refactor ApiServer order of 
events would look like,
   ```
   EVENT_VM_CREATE Started
   EVENT_VM_CREATE Completed
   EVENT_VM_CREATE Scheduled
   EVENT_VM_STARTED Started
   EVENT_VM_STARTED Completed
   ```
    



-- 
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]

Reply via email to