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

Vasco Rodrigues v at vvro.net
Tue Jun 2 13:08:18 UTC 2015


Done

Regards,
Vasco Rodrigues

On 02-06-2015 03:02, Huang Zhiteng wrote:
> 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
> <mailto: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://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe>
>     http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>
>
>
> -- 
> Regards
> Huang Zhiteng
>
>
> __________________________________________________________________________
> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20150602/dfde19db/attachment.html>


More information about the OpenStack-dev mailing list