dhlaluku commented on a change in pull request #2833: Run diagnostics API UI 
integration for system VMs and VR
URL: https://github.com/apache/cloudstack/pull/2833#discussion_r214820406
 
 

 ##########
 File path: 
api/src/main/java/org/apache/cloudstack/api/command/admin/diagnostics/RunDiagnosticsCmd.java
 ##########
 @@ -124,14 +126,20 @@ public long getEntityOwnerId() {
 
     @Override
     public String getEventType() {
-        VirtualMachine vm = _entityMgr.findById(VirtualMachine.class, getId());
-        if (vm.getType() == VirtualMachine.Type.ConsoleProxy) {
-            return EventTypes.EVENT_PROXY_DIAGNOSTICS;
-        } else if (vm.getType() == VirtualMachine.Type.SecondaryStorageVm){
-            return EventTypes.EVENT_SSVM_DIAGNOSTICS;
-        } else {
-            return EventTypes.EVENT_ROUTER_DIAGNOSTICS;
+        VirtualMachine.Type vmType = _entityMgr.findById(VirtualMachine.class, 
getId()).getType();
+        String eventType = "";
+        switch (vmType) {
+            case ConsoleProxy:
+                eventType =  EventTypes.EVENT_PROXY_DIAGNOSTICS;
+            break;
+            case SecondaryStorageVm:
+                eventType = EventTypes.EVENT_SSVM_DIAGNOSTICS;
+                break;
+            case DomainRouter:
 
 Review comment:
   For now, I think it is ok like this so that it is explicit about what is 
supported, otherwise it might be misleading since it will default to 
DomainRouter even for User VMs etc.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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

Reply via email to