remove unnecessary short cut in placement

When both the compute node resource provider and the shared
resource provider have inventory in the same resource class,
AllocationCandidates.get_by_filters didn't return an
AllocationRequest including the shared resource provider.

To fix the bug, we at first remove the shortcut in the logic to
consider sharing providers even if the non-sharing provider can
satisfy the resource request for itself.

Change-Id: Ibd509c5a59407da1db46c6c12b82f8707f655466
Partial-Bug: #1724613
Related-Bug: #1731072
This commit is contained in:
Tetsuro Nakamura 2018-03-12 08:38:24 +09:00
parent ac51b5beda
commit ecb09b29b7
1 changed files with 0 additions and 25 deletions

View File

@ -3327,31 +3327,6 @@ def _alloc_candidates_with_shared(ctx, requested_resources, required_traits,
ns_prov_traits = set(prov_traits.get(ns_rp_id, []))
missing_traits = set(required_traits) - ns_prov_traits
# Determine if the non-sharing provider actually has all the
# resources requested. If not, we need to add an AllocationRequest
# alternative containing this resource for each sharing provider.
# NOTE(jaypipes): If a provider has inventory for a resource class and
# ALSO has that resource class shared with it, we currently ALWAYS take
# the non-shared inventory.
# See: https://bugs.launchpad.net/nova/+bug/1724613
has_all = len(shared_resources) == 0
if has_all:
# If this resource provider has all the requested resources, then
# require that it must also have ALL required traits.
# TODO(jaypipes): This is kind of buggy behaviour. We should be
# able to consider permutations of non-sharing providers that have
# all the resources but have missing required traits with sharing
# providers that have those missing traits.
if missing_traits:
LOG.debug('Excluding non-sharing provider %s: it has all '
'resources but is missing traits (%s).',
ns_rp_uuid, ', '.join(missing_traits))
continue
req = _allocation_request_for_provider(ctx, requested_resources,
ns_rp_uuid)
alloc_requests.append(req)
continue
has_none = len(ns_resources) == 0
if has_none:
# This resource provider doesn't actually provide any requested