Bug 1428863
| Summary: | Getting ticket for VM that is down fails with NPE | ||
|---|---|---|---|
| Product: | [oVirt] ovirt-engine | Reporter: | Juan Hernández <juan.hernandez> |
| Component: | RestAPI | Assignee: | Martin Betak <mbetak> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Israel Pinto <ipinto> |
| Severity: | medium | Docs Contact: | |
| Priority: | high | ||
| Version: | future | CC: | bugs, lveyde, pkliczew |
| Target Milestone: | ovirt-4.1.2 | Flags: | rule-engine:
ovirt-4.1+
|
| Target Release: | 4.1.2 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2017-05-23 08:15:13 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | Virt | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
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
|
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>