[openstack-dev] [nova] [bug] "nova server-group-list" doesn't show any members
Vishvananda Ishaya
vishvananda at gmail.com
Mon Mar 31 21:56:04 UTC 2014
On Mar 27, 2014, at 4:38 PM, Chris Friesen <chris.friesen at windriver.com> wrote:
> On 03/27/2014 04:47 PM, Chris Friesen wrote:
>
>> Interestingly, unit test
>> nova.tests.api.openstack.compute.contrib.test_server_groups.ServerGroupTest.test_display_members
>> passes just fine, and it seems to be running the same sqlalchemy code.
>>
>> Is this a case where sqlite behaves differently from mysql?
>
> Sorry to keep replying to myself, but this might actually hit us other places.
>
> Down in db/sqlalchemy/api.py we end up calling
>
>
> query = query.filter(column_attr.op(db_regexp_op)('None’))
Sqlalchemy handles mapping None to NULL in many cases, so it appears that the problem is that we are passing
None as a string here?
Vish
>
>
> When using mysql, it looks like a regexp comparison of the string 'None' against a NULL field fails to match.
>
> Since sqlite doesn't have its own regexp function we provide one in openstack/common/db/sqlalchemy/session.py. In the buggy case we end up calling it as regexp('None', None), where the types are "unicode" and "NoneType". However, we end up converting the second arg to text type before calling reg.search() on it, so it matches.
>
> Chris
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140331/b2e445a1/attachment.pgp>
More information about the OpenStack-dev
mailing list