Reviewed: https://review.openstack.org/471973 Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=b1647af2906db7eedc93063557497aa6204255a6 Submitter: Jenkins Branch: master
commit b1647af2906db7eedc93063557497aa6204255a6 Author: melanie witt <melwi...@gmail.com> Date: Wed Jun 7 23:58:25 2017 +0000 Default to 0 when merging values in limit check When merging project_values and user_values after taking the symmetric difference of their keys, we should use a default value of 0 for the .get(key) calls because a default value of None will not take precedence over 0 if 0 is the value in project_values or user_values. In the buggy case, we end up with a merged value of None instead of 0 because: 'None or 0' is 0 but '0 or None' is None. Closes-Bug: #1696605 Change-Id: I54a3a52cf5e9b7826dad37c6d1e053ba92cd4fd9 ** Changed in: nova Status: In Progress => Fix Released -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1696605 Title: TypeError: unorderable types: int() < NoneType() possible during quota limit check Status in OpenStack Compute (nova): Fix Released Bug description: Saw this on a recent py35 unit test run [1]: Traceback (most recent call last): File "/home/jenkins/workspace/gate-nova-python35/nova/tests/unit/network/test_manager.py", line 1234, in test_allocate_floating_ip self.network.allocate_floating_ip(ctxt, ctxt.project_id) File "/home/jenkins/workspace/gate-nova-python35/nova/network/floating_ips.py", line 223, in allocate_floating_ip project_id) File "/home/jenkins/workspace/gate-nova-python35/.tox/py35/lib/python3.5/site-packages/oslo_versionedobjects/base.py", line 184, in wrapper result = fn(cls, context, *args, **kwargs) File "/home/jenkins/workspace/gate-nova-python35/nova/objects/quotas.py", line 201, in check_deltas cls.limit_check_project_and_user(context, **check_kwargs) File "/home/jenkins/workspace/gate-nova-python35/.tox/py35/lib/python3.5/site-packages/oslo_versionedobjects/base.py", line 184, in wrapper result = fn(cls, context, *args, **kwargs) File "/home/jenkins/workspace/gate-nova-python35/nova/objects/quotas.py", line 136, in limit_check_project_and_user project_id=project_id, user_id=user_id) File "/home/jenkins/workspace/gate-nova-python35/nova/quota.py", line 1639, in limit_check_project_and_user user_values=user_values, project_id=project_id, user_id=user_id) File "/home/jenkins/workspace/gate-nova-python35/nova/quota.py", line 628, in limit_check_project_and_user overs = [key for key, val in merged_values.items() File "/home/jenkins/workspace/gate-nova-python35/nova/quota.py", line 629, in <listcomp> if merged_quotas[key] >= 0 and merged_quotas[key] < val] TypeError: unorderable types: int() < NoneType() The problem is some logic that tries to .get(key) a value from one of two dicts that contains the key [2] and if the found value is 0, it won't take precedence over a default not found value of None. In the case where None is picked, we end up with a merged value of None, which blows up (thankfully) in Python 3. [1] http://logs.openstack.org/42/446242/18/check/gate-nova-python35/fdf57fc/testr_results.html.gz [2] https://github.com/openstack/nova/blob/c7afbb9/nova/quota.py#L613-L614 To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1696605/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp