[openstack-dev] [cinder] Consider using Explicit type casts on filters

Huang Zhiteng winston.d at gmail.com
Tue Jun 2 02:02:50 UTC 2015


Not a DB expert but looks like a valid bug.  Do you mind file a bug on this?

On Mon, Jun 1, 2015 at 5:43 PM, Vasco Rodrigues <v at vvro.net> wrote:

> 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
>
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>



-- 
Regards
Huang Zhiteng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20150601/3dcf5d05/attachment.html>


More information about the OpenStack-dev mailing list