Public bug reported: The /reshaper API is willing to accept an empty dictionary for the inventories attribute of a resource provider. This is intended to mean "clear all the inventory".
However, the backend transformer code is not prepared to handle this: File "nova/api/openstack/placement/handlers/reshaper.py", line 103, in reshape rp_obj.reshape(context, inventory_by_rp, allocation_objects) File "/mnt/share/cdentsrc/nova/.tox/functional/local/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py", line 993, in wrapper return fn(*args, **kwargs) File "nova/api/openstack/placement/objects/resource_provider.py", line 4087, in reshape rp = new_inv_list[0].resource_provider File "/mnt/share/cdentsrc/nova/.tox/functional/local/lib/python2.7/site-packages/oslo_versionedobjects/base.py", line 829, in __getitem__ return self.objects[index] IndexError: list index out of range This happening because 'new_inv_list' can be empty at for rp_uuid, new_inv_list in inventories.items(): LOG.debug("reshaping: *interim* inventory replacement for provider %s", rp_uuid) rp = new_inv_list[0].resource_provider If the length of new_inv_list is zero we need to do nothing for this iteration though the loop. Then a few lines later at for rp_uuid, new_inv_list in inventories.items(): LOG.debug("reshaping: *final* inventory replacement for provider %s", rp_uuid) # TODO(efried): If we wanted this to be more efficient, we could keep # track of providers for which all inventories are being deleted in the # above loop and just do those and skip the rest, since they're already # in their final form. new_inv_list[0].resource_provider.set_inventory(new_inv_list) We have the same IndexError problem and need to behave differently. A thing we might do is instead of using the resource_provider object on the (maybe not there) inventory objects, is create a new object: we have the rp_uuid. ** Affects: nova Importance: Medium Status: Confirmed ** Tags: placement -- 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/1783130 Title: placement reshaper doesn't clearing all inventories for a resource provider Status in OpenStack Compute (nova): Confirmed Bug description: The /reshaper API is willing to accept an empty dictionary for the inventories attribute of a resource provider. This is intended to mean "clear all the inventory". However, the backend transformer code is not prepared to handle this: File "nova/api/openstack/placement/handlers/reshaper.py", line 103, in reshape rp_obj.reshape(context, inventory_by_rp, allocation_objects) File "/mnt/share/cdentsrc/nova/.tox/functional/local/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py", line 993, in wrapper return fn(*args, **kwargs) File "nova/api/openstack/placement/objects/resource_provider.py", line 4087, in reshape rp = new_inv_list[0].resource_provider File "/mnt/share/cdentsrc/nova/.tox/functional/local/lib/python2.7/site-packages/oslo_versionedobjects/base.py", line 829, in __getitem__ return self.objects[index] IndexError: list index out of range This happening because 'new_inv_list' can be empty at for rp_uuid, new_inv_list in inventories.items(): LOG.debug("reshaping: *interim* inventory replacement for provider %s", rp_uuid) rp = new_inv_list[0].resource_provider If the length of new_inv_list is zero we need to do nothing for this iteration though the loop. Then a few lines later at for rp_uuid, new_inv_list in inventories.items(): LOG.debug("reshaping: *final* inventory replacement for provider %s", rp_uuid) # TODO(efried): If we wanted this to be more efficient, we could keep # track of providers for which all inventories are being deleted in the # above loop and just do those and skip the rest, since they're already # in their final form. new_inv_list[0].resource_provider.set_inventory(new_inv_list) We have the same IndexError problem and need to behave differently. A thing we might do is instead of using the resource_provider object on the (maybe not there) inventory objects, is create a new object: we have the rp_uuid. To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1783130/+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