Bug 1506284

Summary: Downloading disk for a running vm fails with: response content type 'text/html;charset=UTF-8' isn't the expected XML
Product: [oVirt] ovirt-engine Reporter: Natalie Gavrielov <ngavrilo>
Component: RestAPIAssignee: Ori Liel <oliel>
Status: CLOSED CURRENTRELEASE QA Contact: Radim Hrazdil <rhrazdil>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.2.0CC: amureini, bugs, derez, juan.hernandez, lsvaty, mperina
Target Milestone: ovirt-4.2.0Flags: rule-engine: ovirt-4.2+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-12-20 10:46:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1477922    
Attachments:
Description Flags
server.log, engine.log none

Description Natalie Gavrielov 2017-10-25 15:09:47 UTC
Created attachment 1343309 [details]
server.log, engine.log

Description of problem:
When trying to download a disk that is attached to a running VM, operation fails without supplying information about the failure, instead it outputs that the response content type isn't the expected XML.

Version-Release number of selected component (if applicable):
ovirt-engine-4.2.0-0.0.master.20171022103432.gitaf9d8b6.el7.centos.noarch

How reproducible:
100%

Steps to Reproduce:
Try to download a disk that is attached to a running VM, using python sdk (examples/download_disk.py) 

Actual results:
Fails with the following output:
Can't open '/usr/share/abrt/conf.d/plugins/python.conf': No such file or directory
Can't open '/etc/abrt/plugins/python.conf': No such file or directory
Traceback (most recent call last):
  File "./download_disk.py", line 71, in <module>
    direction=types.ImageTransferDirection.DOWNLOAD,
  File "build/bdist.linux-x86_64/egg/ovirtsdk4/services.py", line 10354, in add
  File "build/bdist.linux-x86_64/egg/ovirtsdk4/service.py", line 223, in _internal_add
  File "build/bdist.linux-x86_64/egg/ovirtsdk4/service.py", line 53, in wait
  File "build/bdist.linux-x86_64/egg/ovirtsdk4/service.py", line 220, in callback
  File "build/bdist.linux-x86_64/egg/ovirtsdk4/service.py", line 121, in _check_fault
  File "build/bdist.linux-x86_64/egg/ovirtsdk4/service.py", line 307, in _internal_read_body
  File "build/bdist.linux-x86_64/egg/ovirtsdk4/__init__.py", line 796, in check_xml_content_type
    
  File "build/bdist.linux-x86_64/egg/ovirtsdk4/__init__.py", line 836, in _check_content_type
    
ovirtsdk4.Error: The response content type 'text/html;charset=UTF-8' isn't the expected XML

engine.log:
2017-10-25 17:28:34,539+03 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (default task-26) [] Operation Failed: [Cannot transfer Virtual Disk. The disk disk-2 is plugged to non-Down VMs: golden_env_mixed_virtio_1_0]

server.log:
2017-10-25 17:28:34,539+03 ERROR [io.undertow.request] (default task-26) UT005023: Exception handling request to /ovirt-engine/api/v4/imagetransfers: java.lang.RuntimeException: org.jboss.resteasy.spi.UnhandledException: java.lang.IllegalStateException: Failed to find or invoke API method. The failure is in auto-generated code and indicates a bug in the JAX-RS intrafaces generation process

Expected results:
The following output:
./download_disk.py 
Traceback (most recent call last):
  File "./download_disk.py", line 70, in <module>
    direction=types.ImageTransferDirection.DOWNLOAD,
  File "/usr/lib64/python2.7/site-packages/ovirtsdk4/services.py", line 12362, in add
    self._check_fault(response)
  File "/usr/lib64/python2.7/site-packages/ovirtsdk4/service.py", line 98, in _check_fault
    Service._raise_error(response, fault)
  File "/usr/lib64/python2.7/site-packages/ovirtsdk4/service.py", line 71, in _raise_error
    raise Error(msg)
ovirtsdk4.Error: Fault reason is "Operation Failed". Fault detail is "[Cannot ${action} Storage: The following disks are locked: test-vm-1_Disk1. Please try again in a few minutes.]". HTTP response code is 409.

or something of that sort..

Additional info:
Download disk for a floating disk or a disk that is attached to a vm thats not running works fine.

Comment 1 Juan Hernández 2017-10-25 15:19:24 UTC
The reason for this is that we aren't handling correctly the error in the code that detects API method signatures. This is strictly infra, not storage.

Comment 2 Ori Liel 2017-11-01 11:25:55 UTC
Patch posted: 

  https://gerrit.ovirt.org/#/c/83469/

Comment 3 Radim Hrazdil 2017-11-16 10:09:02 UTC
Verified that attempt to download disk attached to a running VM fails with HTTP response code 404 instead of unexpected XML.

Comment 4 Sandro Bonazzola 2017-12-20 10:46:56 UTC
This bugzilla is included in oVirt 4.2.0 release, published on Dec 20th 2017.

Since the problem described in this bug report should be
resolved in oVirt 4.2.0 release, published on Dec 20th 2017, it has been closed with a resolution of CURRENT RELEASE.

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