[openstack-dev] [cinder] Consider using Explicit type casts on filters
Vasco Rodrigues
v at vvro.net
Tue Jun 2 00:43:02 UTC 2015
Running Cinder on postgresql, i get the following error:
2015-06-02 01:21:27.471 32698 DEBUG cinder.api.v2.volumes
[req-a0a15e07-2a86-4f98-a371-2f7203706b9f
e8bd9bfef65c4def9d3977993c56b9b0 9dbebc529a0a469cb4574c3f9c0d86f7 - - -]
Could not evaluate value 1, assuming string _get_volumes
/usr/lib/python2.7/dist-packages/cinder/api/v2/volumes.py:238
2015-06-02 01:21:27.471 32698 DEBUG cinder.volume.api
[req-a0a15e07-2a86-4f98-a371-2f7203706b9f
e8bd9bfef65c4def9d3977993c56b9b0 9dbebc529a0a469cb4574c3f9c0d86f7 - - -]
Searching by: MultiDict([(u'status', u'available'), (u'bootable', 1)]).
get_all /usr/lib/python2.7/dist-packages/cinder/volume/api.py:421
2015-06-02 01:21:27.486 32698 ERROR oslo_db.sqlalchemy.exc_filters
[req-a0a15e07-2a86-4f98-a371-2f7203706b9f
e8bd9bfef65c4def9d3977993c56b9b0 9dbebc529a0a469cb4574c3f9c0d86f7 - - -]
DBAPIError exception wrapped from (psycopg2.ProgrammingError) operator
does not exist: boolean = integer
LINE 3: ...volumes.status = 'available' AND volumes.bootable = 1 AND vo...
^
HINT: No operator matches the given name and argument type(s). You
might need to add explicit type casts.
I think it's because postgresql doesn't allow comparing integer to boolean.
Which I fixed by adding:
if 'bootable' in filters:
filters['bootable'] = bool(filters['bootable'])
to VolumeController._get_volumes
Regards,
Vasco Rodrigues
More information about the OpenStack-dev
mailing list