Glance client fails with v2 API / Failed validating 'Type' in schema[u'properties'][u'ramdisk_id']

Bug #1447193 reported by Jorge Niedbalski
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Glance Client
Fix Released
High
Jorge Niedbalski
python-glanceclient (Ubuntu)
Fix Released
Undecided
Jorge Niedbalski

Bug Description

[Environment]

- OpenStack Kilo
- Ubuntu Trusty 14.04
ii python-glanceclient 1:0.15.0-0ubuntu1~cloud0 all Client library for Openstack glance server.

[Reproduction]

- The image was correctly created with No ramdisk_id, kernel_id using a glance v1 only( no v2 enabled )

1) nova boot --flavor m1.small --image base-image --key-name keypair --availability-zone nova --security-groups default snapshot-bug

2) nova image-create snapshot-bug snapshot-bug-instance

- After enabling glance v2 api ( enable_v2_api = True on glance-api.conf) and create endpoints i tried to list images

$ glance --os-image-api-version 2 image-list
None is not of type u'string'

Failed validating u'type' in schema[u'properties'][u'ramdisk_id']:
    {u'description': u'ID of image stored in Glance that should be used as the ramdisk when booting an AMI-style image.',
     u'is_base': False,
     u'pattern': u'^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$',
     u'type': u'string'}

On instance[u'ramdisk_id']:
    None

summary: - Glance client fails with v2 API / Failed validating 'Type'
+ Glance client fails with v2 API / Failed validating 'Type' in
+ schema[u'properties'][u'ramdisk_id']
description: updated
Changed in python-glanceclient:
assignee: nobody → Jorge Niedbalski (niedbalski)
Revision history for this message
Stuart McLaren (stuart-mclaren) wrote :

Hi Jorge,

Thanks for your bug report.

I haven't been able to reproduce this (I suspect I'm missing a step).

I'm running the latest server code and using a 0.15.0 client version.

 $ ./tools/with_venv.sh glance image-create --disk-format raw --container-format bare --name thisisnull < /etc/fstab
 +------------------+--------------------------------------+
 | Property | Value |
 +------------------+--------------------------------------+
 | checksum | 398759a311bf25c6f1d67e753bb24dae |
 | container_format | bare |
 | created_at | 2015-04-22T17:17:03.000000 |
 | deleted | False |
 | deleted_at | None |
 | disk_format | raw |
 | id | f4326763-6c0c-4fcb-bbf9-33b5a3bcab92 |
 | is_public | False |
 | min_disk | 0 |
 | min_ram | 0 |
 | name | thisisnull |
 | owner | f1cd0225bd464bc2a3ebf136b13e04d1 |
 | protected | False |
 | size | 106 |
 | status | active |
 | updated_at | 2015-04-22T17:17:03.000000 |
 | virtual_size | None |
+------------------+--------------------------------------+

 $ ./tools/with_venv.sh glance --os-image-api-version 2 image-list

 +--------------------------------------+---------------------------------+
 | ID | Name |
 +--------------------------------------+---------------------------------+
 | f4326763-6c0c-4fcb-bbf9-33b5a3bcab92 | thisisnull |
 | 45dd2ab7-9c8c-4221-a91f-996bc1be74a1 | thisisnull |
 | 3a798bd6-7501-4aec-811e-7cf1aec3af27 | cirros-0.3.2-x86_64-uec |
 | eae31938-c19e-438f-ba28-96c3d479f663 | cirros-0.3.2-x86_64-uec-ramdisk |
 | 80878678-2c15-410a-a7e3-febf3e96e92c | cirros-0.3.2-x86_64-uec-kernel |
 +--------------------------------------+---------------------------------+

Is this related to upgrade in some way? Eg was the server initially running juno when the image was created?

Thanks.

description: updated
Revision history for this message
Jorge Niedbalski (niedbalski) wrote :

Hello Stuart,

I updated the description with a better explanation about how to reproduce this issue.

Thanks.

Revision history for this message
Stuart McLaren (stuart-mclaren) wrote :

Jorge,

Thanks for the extra info -- very helpful:

$ ./tools/with_venv.sh glance --os-image-api-version 2 image-list
venv develop-inst-nodeps: /mnt/sam/git/python-glanceclient
venv runtests: PYTHONHASHSEED='0'
venv runtests: commands[0] | glance --os-image-api-version 2 image-list
None is not of type u'string'

Failed validating u'type' in schema[u'properties'][u'ramdisk_id']:
    {u'description': u'ID of image stored in Glance that should be used as the ramdisk when booting an AMI-style image.',
     u'is_base': False,
     u'pattern': u'^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$',
     u'type': u'string'}

On instance[u'ramdisk_id']:
    None

This seems to work ok with a newer client:

 $ glance --version
 0.17.1

 $ glance --os-image-api-version 2 image-list
 +--------------------------------------+---------------------------------+
 | ID | Name |
 +--------------------------------------+---------------------------------+
 | 125730a9-4b34-40da-9f42-af7cf80ba9a2 | cirros-0.3.2-x86_64-uec |
 | e9f7e691-1c19-453e-a85e-76471c058193 | cirros-0.3.2-x86_64-uec-kernel |
 | 39beaaf0-daf4-4c89-9029-370206d7d763 | cirros-0.3.2-x86_64-uec-ramdisk |
 | 55c8e633-6dd2-4477-9a81-3ce0756f362e | debian |
 | e7d74ffe-63c0-46ea-9943-8ddf01fcf369 | debian-snap1 |
 | 7577dad5-b623-42c5-98e2-357c46c8723f | snap1 |
 +--------------------------------------+---------------------------------+

I'm going to close based on it being a client issue that has been fixed.

Changed in python-glanceclient:
status: New → Fix Released
Revision history for this message
Samuel Matzek (smatzek) wrote :

This is not fixed and I'm seeing it with a recent version of stable/kilo.

The description reproduction steps don't accurately reproduce. These steps do:

# glance --os-image-api-version 1 image-list
+----+------+-------------+------------------+------+--------+
| ID | Name | Disk Format | Container Format | Size | Status |
+----+------+-------------+------------------+------+--------+
+----+------+-------------+------------------+------+--------+

# glance --os-image-api-version 1 image-create --name test --disk-format raw --container-format bare --property ramdisk_id= --property kernel_id= --file ./junkfile
+-----------------------+--------------------------------------+
| Property | Value |
+-----------------------+--------------------------------------+
| Property 'kernel_id' | None |
| Property 'ramdisk_id' | None |
| checksum | 0632d04c8ec91b3c8c4ea5ae1e38908a |
| container_format | bare |
| created_at | 2015-06-05T20:03:54.817722 |
| deleted | False |
| deleted_at | None |
| disk_format | raw |
| id | 1438711d-2e4d-47f3-a092-d7da541c2451 |
| is_public | False |
| min_disk | 0 |
| min_ram | 0 |
| name | test |
| owner | 963177847ec149c9b84f488140c737cd |
| protected | False |
| size | 5 |
| status | active |
| updated_at | 2015-06-05T20:03:55.411470 |
| virtual_size | None |
+-----------------------+--------------------------------------+

# glance --os-image-api-version 2 image-list
None is not of type u'string'

Failed validating u'type' in schema[u'properties'][u'ramdisk_id']:
    {u'description': u'ID of image stored in Glance that should be used as the ramdisk when booting an AMI-style image.',
     u'is_base': False,
     u'pattern': u'^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$',
     u'type': u'string'}

On instance[u'ramdisk_id']:
    None

The proposed fix https://review.openstack.org/#/c/176379/2 fixes the problem.

All VM snapshot images created by libvirt KVM driver in Nova that did not have ramdisk or kernel_id values will exhibit this behavior and they will fail to boot/spawn/deploy when Nova moves to use Glance v2.

Image using the rbd ephemeral snapshot code, https://review.openstack.org/#/c/125963/, are already exhibiting the failure behavior because this spawn path uses a Glance v2 show call to get image locations.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in python-glanceclient (Ubuntu):
status: New → Confirmed
Revision history for this message
Samuel Matzek (smatzek) wrote :

I forgot to add that I'm using 0.17.1 client:
# glance --version
0.17.1

Revision history for this message
Kevin Fox (kevpn) wrote :

Just upgraded a cloud from juno to kilo. (It started out life on icehouse).

On a centos6 box (only supports icehouse glance client python-glanceclient-0.12.0-1.el6.noarch) I see this:
  File "/etc/ansible/hosts/openstack_inventory.py", line 69, in do_tenant
    for i in gt.images.list():
  File "/usr/lib/python2.6/site-packages/glanceclient/v2/images.py", line 75, in list
    yield self.model(**image)
  File "/usr/lib/python2.6/site-packages/warlock/core.py", line 32, in __init__
    base_class.__init__(self, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/warlock/model.py", line 34, in __init__
    raise ValueError(str(exc))
ValueError: None is not of type u'string'

Failed validating u'type' in schema[u'properties'][u'ramdisk_id']:
    {u'description': u'ID of image stored in Glance that should be used as the ramdisk when booting an AMI-style image.',
     u'is_base': False,
     u'pattern': u'^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$',
     u'type': u'string'}

On instance[u'ramdisk_id']:
    None

I'd call this a regression with the v2 api somehow...

Revision history for this message
Kevin Fox (kevpn) wrote :

Tried the fix from:
https://review.openstack.org/#/c/176379/3

It made it farther but still fails:
  File "/etc/ansible/hosts/openstack_inventory.py", line 69, in do_tenant
    for i in gt.images.list():
  File "/usr/lib/python2.6/site-packages/glanceclient/v2/images.py", line 75, in list
    yield self.model(**image)
  File "/usr/lib/python2.6/site-packages/warlock/core.py", line 32, in __init__
    base_class.__init__(self, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/warlock/model.py", line 34, in __init__
    raise ValueError(str(exc))
ValueError: None is not of type u'string'

Failed validating u'type' in schema[u'additionalProperties']:
    {u'type': u'string'}

On instance[u'description']:
    None

Revision history for this message
Kevin Fox (kevpn) wrote :

With the patch, and manually running this in the database:
update image_properties set value='' where name='description' and value is null;

then the icehouse glance client does work.

Louis Taylor (kragniz)
Changed in python-glanceclient:
importance: Undecided → High
Changed in python-glanceclient (Ubuntu):
status: Confirmed → Fix Released
assignee: nobody → Jorge Niedbalski (niedbalski)
Revision history for this message
Cyril Roelandt (cyril-roelandt) wrote :

Isn't this backport of the patch enough to fix the issue on kilo : https://review.openstack.org/#/c/205432/ ?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.