placement/placement/objects
Chris Dent 81937773f5 Stabilize AllocationRequest hash
A set of AllocationRequest objects is extended in _merge_candidates,
controlled by the hash of the AllocationRequest, which is based on
a list of AllocationRequestResource objects.

It turns out that this hash can be different depending on the ordering
of the members of the list, with different behaviors in Python 2 and 3.
Therefore, a stable sort is needed to ensure the stability of the hash.

It's quite likely that a sort could have been done elsewhere, but there
are at least two places where resource_requests are added, with
different attributes available for sorting, so this contained
implementation was done instead.

Tests are added that confirms the expected behavior.

Note that the expected behavior will change when we add suffix
mappings to allocation requests. Whereas now
'test_nested_result_count_isolate' gets winnowed to 2 results because
the following are treated as duplicates

   [('cn1', orc.VCPU, 2),
    ('cn1_numa0_pf0', orc.SRIOV_NET_VF, 1),
    ('cn1_numa1_pf1', orc.SRIOV_NET_VF, 1)],
   [('cn1', orc.VCPU, 2),
    ('cn1_numa0_pf0', orc.SRIOV_NET_VF, 1),
    ('cn1_numa1_pf1', orc.SRIOV_NET_VF, 1)],

they are in fact slightly different: one set has pf0 satisfying group
_NET1 and pf1 _NET2, the other vice versa. With mappings available
we presumably want to expose this difference, resulting in more...
results.

An interesting note: The original bug report was that python 2.7 was
varying across 3 values, sometimes right, but mostly wrong and 3.7
was always right. Turns out that 3.7 was consistently wrong, and 2.7
was mostly right, but not always.

Change-Id: I4fce243659d5c429dc3d48f07888e38bd0aed5d4
Story: 2005822
Task: 33579
2019-06-07 15:01:38 +00:00
..
__init__.py Move the placement code to the base 2018-09-04 10:31:23 -05:00
allocation.py Add explicit short-circuit in get_all_by_consumer_id 2019-03-06 16:38:49 +00:00
allocation_candidate.py Stabilize AllocationRequest hash 2019-06-07 15:01:38 +00:00
consumer.py Inline Consumer.increment_generation() 2019-03-04 14:41:31 +00:00
inventory.py Remove InventoryList class 2019-03-13 21:24:34 +00:00
project.py Don't use OVO in Project object 2019-02-20 09:50:38 +00:00
research_context.py Reuse cache result for sharing providers capacity 2019-05-29 15:22:38 -05:00
reshaper.py Remove InventoryList class 2019-03-13 21:24:34 +00:00
resource_class.py Remove use of oslo.i18n and translation 2019-03-25 16:59:21 +00:00
resource_provider.py Cache provider ids in requested aggregates 2019-05-29 15:22:38 -05:00
rp_candidates.py Prepare for negative member queryparam 2 2019-03-29 05:14:03 +00:00
trait.py Remove use of oslo.i18n and translation 2019-03-25 16:59:21 +00:00
usage.py Use native list for lists of Usage 2019-03-04 14:37:11 +00:00
user.py Don't use OVO in User object 2019-02-20 09:50:38 +00:00