Getting a ticket for a virtual machine that is down fails with the following NPE: Caused by: java.lang.NullPointerException at org.ovirt.engine.api.restapi.resource.BackendGraphicsConsoleHelper.asConsoleId(BackendGraphicsConsoleHelper.java:51) [restapi-jaxrs.jar:] at org.ovirt.engine.api.restapi.resource.BackendVmResource.ticket(BackendVmResource.java:486) [restapi-jaxrs.jar:] To reproduce it send a request like this: POST /ovirt-engine/api/vms/{vm:id}/ticket <action/> The actual result is 500 HTTP error code and the above NPE in server.log. The expected result is either a ticket (which doesn't make sense when the VM is down) or a meaningful error message: HTTP/1.1 409 Conflict <fault> <reason>Operation failed</reason> <detail>[Can't get ticket because the virtual machine is down.]</detail> </fault>
Verify with: Steps: 1. On VM in down status get ticket: POST /ovirt-engine/api/vms/{vm:id}/ticket <action/> 2. Check logs Response: <fault> <detail>[Cannot set Virtual Machine Ticket because the VM is in Down status.]</detail> <reason>Operation Failed</reason> </fault> Engine log: 2017-05-03 06:34:51,323+03 WARN [org.ovirt.engine.core.bll.SetVmTicketCommand] (default task-2) [0fc00b5e-26d2-4eb8-84e1-5eaffdd44b37] Validation of action 'SetVmTicket' failed for user admin@internal-authz. Reasons: VAR__ACTION__SET,VAR__TYPE__VM_TICKET,ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL,VAR__VM_STATUS__DOWN 2017-05-03 06:34:51,352+03 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (default task-2) [] Operation Failed: [Cannot set Virtual Machine Ticket because the VM is in Down status.] No NPE, PASS