Bug 1411119

Summary: [REST-API] Image import from Glance repository fails on 'IO exception'
Product: [oVirt] ovirt-engine Reporter: Elad <ebenahar>
Component: RestAPIAssignee: Juan Hernández <juan.hernandez>
Status: CLOSED WONTFIX QA Contact: Pavel Stehlik <pstehlik>
Severity: low Docs Contact:
Priority: low    
Version: 4.0.6.3CC: bugs, ebenahar, mgoldboi, oourfali
Target Milestone: ---Keywords: Regression
Target Release: ---Flags: sbonazzo: ovirt-4.2-
mgoldboi: blocker-
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-09-12 09:39:55 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:
Attachments:
Description Flags
engine.log, server.log
none
logs-9.1.17 none

Description Elad 2017-01-08 14:38:47 UTC
Created attachment 1238394 [details]
engine.log, server.log

Description of problem:
Image import from Glance repository fails on 'IO exception' via REST API



Version-Release number of selected component (if applicable):
rhevm-4.0.6.3-0.1.el7ev.noarch

How reproducible:
Always

Steps to Reproduce:
1. URL:
https://<engine_addr>/ovirt-engine/api/storagedomains/%Glance_image_repository_ID%/images/%Image_ID%/import

Request body:

    <async>false</async>
    <cluster>
        <name>CLUSTER_NAME</name>
    </cluster>
    <disk>
        <name>DISK_NAME</name>
    </disk>
    <grace_period>
        <expiry>10</expiry>
    </grace_period>
    <import_as_template>false</import_as_template>
    <storage_domain>
        <name>SD_NAME</name>
    </storage_domain>
</action>

3.


Actual results:
Response body:

"
Internal Server Error
"


Engine.log:

2017-01-08 16:28:51,285 ERROR [org.ovirt.engine.api.restapi.resource.validation.IOExceptionMapper] (default task-11) [] IO exception while processing "POST" request for path "/storagedomains
/ebc4064d-bdbe-4c43-b790-1108656d6def/images/91721c23-b39e-4eee-bf67-c3c80cf0032e/import"
2017-01-08 16:28:51,285 ERROR [org.ovirt.engine.api.restapi.resource.validation.IOExceptionMapper] (default task-11) [] Exception: java.io.IOException: javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"async"). Expected elements are <{}action>,<{}affinity_group>,<{}affinity_groups>,<{}affinity_label>,<{}affinity_labels>,<{}agent>,<{}agent_configuration>,<{}agent_configurations>,<{}agents>,<{}api>,<{}api_summaries>,<{}api_summary>,<{}api_summary_item>,<{}api_summary_items>,<{}apis>,<{}application>,<{}applications>,<{}authorized_key>,<{}authorized_keys>,<{}balance>,<{}balances>,<{}bios>,<{}bioss>,<{}block_statistic>,<{}block_statistics>,<{}body>,<{}bonding>,<{}bondings>,<{}bookmark>,<{}bookmarks>,<{}boot>,<{}boot_menu>,<{}boot_menus>,<{}boots>,<{}brick>,<{}brick_memoryinfo>,<{}brick_profile_detail>,<{}brick_profile_details>,<{}bricks>,<{}cdrom>,<{}cdroms>,<{}certificate>,<{}certificates>,<{}cloud_init>,<{}cloud_inits>,<{}cluster>,<{}cluster_level>,<{}cluster_levels>,<{}clusters>,<{}configuration>,<{}configurations>,<{}console>,<{}consoles>
.
.
.
.
        at org.ovirt.engine.api.restapi.xml.JAXBProvider.readFrom(JAXBProvider.java:199) [restapi-jaxrs.jar:]
        at org.ovirt.engine.api.restapi.xml.JAXBProvider.readFrom(JAXBProvider.java:161) [restapi-jaxrs.jar:]
        at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.readFrom(AbstractReaderInterceptorContext.java:61) [resteasy-jaxrs.jar:3.0.18.Final-redhat-1]
        at org.jboss.resteasy.core.interception.ServerReaderInterceptorContext.readFrom(ServerReaderInterceptorContext.java:60) [resteasy-jaxrs.jar:3.0.18.Final-redhat-1]
.
.
.
        at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:743)
        at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:262)
        at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:257)


Expected results:
Import from Glance via REST API should work

Additional info:
engine.log, server.log

Comment 1 Yaniv Kaul 2017-01-09 07:19:08 UTC
Elad - your server.log has many exceptions. Can you provide a reproduction on a clean environment? Does that happen with v3, v4 or both APIs?

Comment 2 Juan Hernández 2017-01-09 15:34:25 UTC
I miss an "<action>" at the beginning of the request body, and that seems to be what the server is complaining about. Please add that, and check again.

Comment 3 Elad 2017-01-09 15:37:02 UTC
Created attachment 1238814 [details]
logs-9.1.17

This doesn't reproduce all the time and seems to happen only with v4.

It seems to be reproduced while the hypervisors have connectivity issues with the storage.


Attaching new logs from second occurrence. 

v4 attempt:

017-01-09 17:29:44,007 ERROR [org.ovirt.engine.api.v3.V3IOExceptionMapper] (default task-10) [] IO exception while processing "POST" request for path "/storagedomains/ebc4064d-bdbe-4c43-b79
0-1108656d6def/images/91721c23-b39e-4eee-bf67-c3c80cf0032e/import"


v3 attempt:

2017-01-09 17:31:28,690 INFO  [org.ovirt.engine.core.bll.storage.repoimage.ImportRepoImageCommand] (default task-6) [6384bef] Running command: ImportRepoImageCommand Task handler: ImportRepoImageCreateTaskHandler internal: false. Entities affected :  ID: e89cda99-66b2-4f23-b0ee-8195c13c6ed9 Type: StorageAction group CREATE_DISK with role type USER,  ID: ebc4064d-bdbe-4c43-b790-1108656d6def Type: StorageAction group ACCESS_IMAGE_STORAGE with role type USER

Comment 4 Elad 2017-01-09 15:39:30 UTC
(In reply to Juan Hernández from comment #2)
> I miss an "<action>" at the beginning of the request body, and that seems to
> be what the server is complaining about. Please add that, and check again.

You're right. With V4, if <action> is not passed, engine throws the exception. 
With v3 I get "Request syntactically incorrect. See the description below for the correct usage"

Comment 5 Juan Hernández 2017-01-09 15:41:17 UTC
OK, so this is about improving the error response. Thanks Elad.

Comment 6 Red Hat Bugzilla Rules Engine 2017-01-09 15:41:21 UTC
This bug report has Keywords: Regression or TestBlocker.
Since no regressions or test blockers are allowed between releases, it is also being identified as a blocker for this release. Please resolve ASAP.

Comment 7 Oved Ourfali 2017-09-12 09:39:55 UTC
Doesn't seem important enough to prioritize.
Closing as wontfix.