← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1788631] Re: KeyError: 'used' security_group_rule quota missing 'used' key

 

** Changed in: charm-neutron-api
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Dashboard (Horizon).
https://bugs.launchpad.net/bugs/1788631

Title:
  KeyError: 'used' security_group_rule quota missing 'used' key

Status in OpenStack neutron-api charm:
  Fix Released
Status in OpenStack Dashboard (Horizon):
  In Progress

Bug description:
  On rocky rc1, after attempting to log in to the dashboard I hit:

  Internal Server Error: /horizon/project/
  Traceback (most recent call last):
    File "/usr/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 41, in inner
      response = get_response(request)
    ...
    File "/usr/lib/python2.7/dist-packages/openstack_dashboard/usage/views.py", line 163, in _process_chart_section
      used = self.usage.limits[key]['used']
      KeyError: 'used'

  Full traceback: https://paste.ubuntu.com/p/RcMCjWs8HG/

  From openstack_dashboard/usage/views.py:

      def _process_chart_section(self, chart_defs):
          charts = []
          for t in chart_defs:
              if t.quota_key not in self.usage.limits:
                  continue
              key = t.quota_key
              used = self.usage.limits[key]['used']	# <--- KeyError
              quota = self.usage.limits[key]['quota']

  Further debugging shows we're failing on key='security_group_rule'

  chart_def=ChartDef(quota_key='security_group_rule', label=u'Security Group Rules', used_phrase=None, filters=None)
  self.usage.limits[key]={'quota': 100}

  Notice there's no 'used' key in self.usage.limits. Compare that vs
  'security_group' which has:

  chart_def=ChartDef(quota_key='security_group', label=u'Security Groups', used_phrase=None, filters=None)
  self.usage.limits[key]={'available': 9, 'used': 1, 'quota': 10}

  From openstack_dashboard/usage/quotas.py:

      def tally(self, name, value):
          """Adds to the "used" metric for the given quota."""
          value = value or 0  # Protection against None.
          # Start at 0 if this is the first value.
          if 'used' not in self.usages[name]:
              self.usages[name]['used'] = 0

  I haven't confirmed but it seems that tally does the initialization of
  the 'used' key and for some reason that's not happening.

To manage notifications about this bug go to:
https://bugs.launchpad.net/charm-neutron-api/+bug/1788631/+subscriptions


References