Public bug reported:

Very rarely (so rarely in fact that it only seems to happen when test
order is much different from the norm) some unit tests which encounter
the resource_class_cache can fail as follows:

http://logs.openstack.org/49/540049/2/check/openstack-tox-
py27/176a6b3/testr_results.html.gz

-=-=-
ft1.1: 
nova.tests.unit.cmd.test_status.TestUpgradeCheckResourceProviders.test_check_resource_providers_no_compute_rps_one_compute_StringException:
 pythonlogging:'': {{{2018-02-02 11:30:00,443 WARNING [oslo_config.cfg] Config 
option key_manager.api_class  is deprecated. Use option key_manager.backend 
instead.}}}

Traceback (most recent call last):
  File "nova/tests/unit/cmd/test_status.py", line 588, in 
test_check_resource_providers_no_compute_rps_one_compute
    self._create_resource_provider(FAKE_IP_POOL_INVENTORY)
  File "nova/tests/unit/cmd/test_status.py", line 561, in 
_create_resource_provider
    rp.set_inventory(inv_list)
  File "nova/api/openstack/placement/objects/resource_provider.py", line 737, 
in set_inventory
    exceeded = _set_inventory(self._context, self, inv_list)
  File 
"/home/zuul/src/git.openstack.org/openstack/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py",
 line 986, in wrapper
    return fn(*args, **kwargs)
  File "nova/api/openstack/placement/objects/resource_provider.py", line 372, 
in _set_inventory
    _add_inventory_to_provider(context, rp, inv_list, to_add)
  File "nova/api/openstack/placement/objects/resource_provider.py", line 201, 
in _add_inventory_to_provider
    if inv_record.capacity <= 0:
AttributeError: 'NoneType' object has no attribute 'capacity'
-=-=-

The find() method on InventoryList can return None if that cache is bad.

This can be resolved (apparently) by resetting the _RC_CACHE between
test runs in the same way that _TRAITS_SYNCED is reset, in nova/test.py:

-        # Reset the traits sync flag
-        objects.resource_provider._TRAITS_SYNCED = False
+        # Reset the traits sync flag and rc cache
+        resource_provider._TRAITS_SYNCED = False
+        resource_provider._RC_CACHE = None

** Affects: nova
     Importance: Undecided
         Status: New


** Tags: placement scheduler

-- 
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/1747003

Title:
  A bad _RC_CACHE can rarely cause unit tests to fail

Status in OpenStack Compute (nova):
  New

Bug description:
  Very rarely (so rarely in fact that it only seems to happen when test
  order is much different from the norm) some unit tests which encounter
  the resource_class_cache can fail as follows:

  http://logs.openstack.org/49/540049/2/check/openstack-tox-
  py27/176a6b3/testr_results.html.gz

  -=-=-
  ft1.1: 
nova.tests.unit.cmd.test_status.TestUpgradeCheckResourceProviders.test_check_resource_providers_no_compute_rps_one_compute_StringException:
 pythonlogging:'': {{{2018-02-02 11:30:00,443 WARNING [oslo_config.cfg] Config 
option key_manager.api_class  is deprecated. Use option key_manager.backend 
instead.}}}

  Traceback (most recent call last):
    File "nova/tests/unit/cmd/test_status.py", line 588, in 
test_check_resource_providers_no_compute_rps_one_compute
      self._create_resource_provider(FAKE_IP_POOL_INVENTORY)
    File "nova/tests/unit/cmd/test_status.py", line 561, in 
_create_resource_provider
      rp.set_inventory(inv_list)
    File "nova/api/openstack/placement/objects/resource_provider.py", line 737, 
in set_inventory
      exceeded = _set_inventory(self._context, self, inv_list)
    File 
"/home/zuul/src/git.openstack.org/openstack/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py",
 line 986, in wrapper
      return fn(*args, **kwargs)
    File "nova/api/openstack/placement/objects/resource_provider.py", line 372, 
in _set_inventory
      _add_inventory_to_provider(context, rp, inv_list, to_add)
    File "nova/api/openstack/placement/objects/resource_provider.py", line 201, 
in _add_inventory_to_provider
      if inv_record.capacity <= 0:
  AttributeError: 'NoneType' object has no attribute 'capacity'
  -=-=-

  The find() method on InventoryList can return None if that cache is
  bad.

  This can be resolved (apparently) by resetting the _RC_CACHE between
  test runs in the same way that _TRAITS_SYNCED is reset, in
  nova/test.py:

  -        # Reset the traits sync flag
  -        objects.resource_provider._TRAITS_SYNCED = False
  +        # Reset the traits sync flag and rc cache
  +        resource_provider._TRAITS_SYNCED = False
  +        resource_provider._RC_CACHE = None

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1747003/+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

Reply via email to