You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by "Everett Toews (JIRA)" <ji...@apache.org> on 2015/01/20 15:30:35 UTC

[jira] [Closed] (JCLOUDS-807) org.jclouds.openstack.nova.v2_0.features.ImageApi.listInDetail may fail for some Images with structured metadata

     [ https://issues.apache.org/jira/browse/JCLOUDS-807?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Everett Toews closed JCLOUDS-807.
---------------------------------
    Resolution: Duplicate

We're getting close to a fix!

https://github.com/jclouds/jclouds/pull/626

> org.jclouds.openstack.nova.v2_0.features.ImageApi.listInDetail may fail for some Images with structured metadata
> ----------------------------------------------------------------------------------------------------------------
>
>                 Key: JCLOUDS-807
>                 URL: https://issues.apache.org/jira/browse/JCLOUDS-807
>             Project: jclouds
>          Issue Type: Bug
>          Components: jclouds-labs-openstack
>    Affects Versions: 1.8.0, 2.0.0
>            Reporter: Pierre Souchay
>
> In our environment (Openstack Icehouse), the list of images with details may return some structured data in metadata, for instance :
> {code}
> "metadata": {
>     "block_device_mapping": [
>         {
>             "guest_format": null,
>             "boot_index": 0,
>             "no_device": null,
>             "volume_id": null,
>             "volume_size": null,
>             "disk_bus": "virtio",
>             "image_id": null,
>             "source_type": "snapshot",
>             "device_type": "disk",
>             "snapshot_id": "ce746121-7829-4818-bf5b-2b86d48b5ce0",
>             "destination_type": "volume",
>             "delete_on_termination": null
>         },
>         {
>             "guest_format": null,
>             "boot_index": null,
>             "no_device": null,
>             "volume_id": null,
>             "volume_size": null,
>             "disk_bus": null,
>             "image_id": null,
>             "source_type": "snapshot",
>             "device_type": null,
>             "snapshot_id": "a659cb24-c84e-472b-8ec2-9e4af8211d08",
>             "destination_type": "volume",
>             "delete_on_termination": null
>         }
>     ],
>     "container_format": "bare"
>     [...]
> }
> {code}
> In that case, the deserialization code fails with the following message "com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_ARRAY ..." since the class org.jclouds.openstack.nova.v2_0.domain.Image contains metadata as a Map<String, String> but block_device_mapping is an array of objects instead of a String.
> This issue seems present in 1.8.x and 2.0.0
> A modification of the test case jclouds/apis/openstack-nova/src/test/resources/image_details.json explains the problem :
> put:
> {code}
> "metadata": {
>             "ImageType": "Gold",
>             "ImageVersion": "1.5",
>             "block_device_mapping": [{"guest_format": null, "boot_index": 0, "no_device": null, "volume_id": null, "volume_size": null, "disk_bus": "virtio", "image_id": null, "source_type": "snapshot", "device_type": "disk", "snapshot_id": "ce746121-7829-4818-bf5b-2b86d48b5ce0", "destination_type": "volume", "delete_on_termination": null}, {"guest_format": null, "boot_index": null, "no_device": null, "volume_id": null, "volume_size": null, "disk_bus": null, "image_id": null, "source_type": "snapshot", "device_type": null, "snapshot_id": "a659cb24-c84e-472b-8ec2-9e4af8211d08", "destination_type": "volume", "delete_on_termination": null}]
>         },
> {code}
> instead of 
> {code}
> "metadata": {
>             "ImageType": "Gold",
>             "ImageVersion": "1.5"
> }
> {code}
> The message is then:
> {code}
> testGetImageWhenResponseIs2xx(org.jclouds.openstack.nova.v2_0.features.ImageApiExpectTest)  Time elapsed: 0.006 sec  <<< FAILURE!
> java.lang.IllegalStateException: Expected a string but was BEGIN_ARRAY at line 16 column 38 path $.image.metadata.
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)