Bug 1540071 - An attempt to get the snapshot creation status with JSON request results in 406 response code from server.
Summary: An attempt to get the snapshot creation status with JSON request results in 4...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: RestAPI
Version: 4.1.5.2
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ovirt-4.2.2
: ---
Assignee: Ondra Machacek
QA Contact: Radim Hrazdil
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-01-30 08:35 UTC by Anton Erdman
Modified: 2018-03-29 11:10 UTC (History)
4 users (show)

Fixed In Version: ovirt-engine-4.2.2
Clone Of:
Environment:
Last Closed: 2018-03-29 11:10:03 UTC
oVirt Team: Infra
Embargoed:
rule-engine: ovirt-4.2+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 86912 0 master MERGED restapi: CreationResource should produce JSON 2018-01-31 09:31:07 UTC

Comment 1 Ondra Machacek 2018-01-30 09:04:29 UTC
Description of problem:
When trying to obtain a VM snapshot creation status via REST API, the server responds with code 406 Not Acceptable.
This only happens when the request contains "Accept: application/json" header. 
If Accept is set to application/xml, the server response is correct, but with XML body.

Version-Release number of selected component (if applicable):
4.1.5.2

How reproducible:
Always.

Steps to Reproduce:
1. Request a snapshot creation with POST request to /ovirt-engine/api/<VM_UID>/snapshots
2. Get the status confirmation link from JSON body of the response.
3. Try to get the status response in JSON using the link, e.g. with curl:
   curl \                                                                                                                                                                                      
      --verbose \                                                                                                                                                                              
      --request GET \                                                                                                                                                                          
      --user "admin@internal:<password>" \                                                                                                                                                       
      --header "Accept: application/json" \                                                                                                                                                    
      https://<engine-hostname>/ovirt-engine/api/vms/d4e6000b-bff6-4af3-b876-5b6d7fd39ed1/snapshots/b917bbff-dcca-4fe3-9866-878972c3da26/creation_status/439ee213-2529-4a0d-aabb-958ed5a27eb5  

Actual results:
* Connected to <hostname> (172.20.7.107) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: ./ca.pem
  CApath: none
* SSL connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate:
*       subject: CN=ovirtengine.iba,O=iba,C=US
*       start date: Sep 07 16:36:28 2017 GMT
*       expire date: Aug 13 16:36:28 2022 GMT
*       common name: ovirtengine.iba
*       issuer: CN=ovirtengine.iba.86763,O=iba,C=US
* Server auth using Basic with user 'admin@internal'
> GET /ovirt-engine/api/vms/d4e6000b-bff6-4af3-b876-5b6d7fd39ed1/snapshots/b917bbff-dcca-4fe3-9866-878972c3da26/creation_status/439ee213-2529-4a0d-aabb-958ed5a27eb5 HTTP/1.1
> Authorization: Basic XXXX
> User-Agent: curl/7.29.0
> Host: ovirtengine.iba
> Accept: application/json
> 
< HTTP/1.1 406 Not Acceptable
< Date: Tue, 30 Jan 2018 08:31:59 GMT
< Server: Apache/2.4.27 (Fedora) OpenSSL/1.0.2k-fips
< Content-Length: 0
< Correlation-Id: 621c61b3-69f8-48ab-9f58-9f66096e2f75
< 
* Connection #0 to host ovirtengine.iba left intact

Expected results:
Correct response, like in case with Accept: application/xml:
< HTTP/1.1 200 OK
< Date: Tue, 30 Jan 2018 08:33:36 GMT
< Server: Apache/2.4.27 (Fedora) OpenSSL/1.0.2k-fips
< Content-Type: application/xml
< Content-Length: 317
< Correlation-Id: 4b73b4a5-76a3-4f22-861e-625135384986
< Vary: Accept-Encoding
< 
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<creation href="/ovirt-engine/api/vms/d4e6000b-bff6-4af3-b876-5b6d7fd39ed1/snapshots/b917bbff-dcca-4fe3-9866-878972c3da26/creation_status/439ee213-2529-4a0d-aabb-958ed5a27eb5" id="439ee213-2529-4a0d-aabb-958ed5a27eb5">
    <status>complete</status>
</creation>
* Connection #0 to host ovirtengine.iba left intact

Additional info:
I didn't find any lines in oVirt logs that could be related to the problem, but can provide them if necessary.

Comment 2 Radim Hrazdil 2018-02-26 13:41:34 UTC
Verified by following the steps in the description, that quering the creation_status in json returns:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<creation href="/ovirt-engine/api/vms/123/snapshots/456/creation_status/789" id="789">
    <status>complete</status>
</creation>

RHV version 4.2.2.

Comment 3 Sandro Bonazzola 2018-03-29 11:10:03 UTC
This bugzilla is included in oVirt 4.2.2 release, published on March 28th 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.2 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.