diff options
-rw-r--r-- | conductor/conductor/data/service.py | 3 | ||||
-rw-r--r-- | conductor/conductor/solver/optimizer/constraints/hpa.py | 11 | ||||
-rw-r--r-- | conductor/conductor/tests/unit/solver/test_hpa.py | 6 |
3 files changed, 10 insertions, 10 deletions
diff --git a/conductor/conductor/data/service.py b/conductor/conductor/data/service.py index 5912963..f4e3aac 100644 --- a/conductor/conductor/data/service.py +++ b/conductor/conductor/data/service.py @@ -454,10 +454,9 @@ class DataEndpoint(object): # exists. This is an invalid condition. if candidate.get("flavor_map") and candidate["flavor_map"].get( label_name): - error = True LOG.error(_LE("Flavor mapping for label name {} already" "exists").format(label_name)) - return {'response': None, 'error': error} + continue # RPC call to inventory provider for matching hpa capabilities results = self.ip_ext_manager.map_method( diff --git a/conductor/conductor/solver/optimizer/constraints/hpa.py b/conductor/conductor/solver/optimizer/constraints/hpa.py index 9ef37df..98d95d9 100644 --- a/conductor/conductor/solver/optimizer/constraints/hpa.py +++ b/conductor/conductor/solver/optimizer/constraints/hpa.py @@ -59,10 +59,11 @@ class HPA(constraint.Constraint): response = (cei.get_candidates_with_hpa(label_name, _candidate_list, flavorProperties)) - if response: - _candidate_list = response - else: - LOG.error(_LE("Flavor mapping for label name {} already" - "exists").format(label_name)) + _candidate_list = response + if not response: + LOG.error(_LE("No matching candidates for HPA exists").format( + label_name)) + break + # No need to continue. return _candidate_list diff --git a/conductor/conductor/tests/unit/solver/test_hpa.py b/conductor/conductor/tests/unit/solver/test_hpa.py index c9bbbbc..3964c06 100644 --- a/conductor/conductor/tests/unit/solver/test_hpa.py +++ b/conductor/conductor/tests/unit/solver/test_hpa.py @@ -77,9 +77,9 @@ class TestHPA(unittest.TestCase): client_mock.call.return_value = None request_mock.cei = cei.ConstraintEngineInterface(client_mock) - self.assertEqual(self.candidate_list, - self.hpa.solve(mock_decision_path, - self.candidate_list, request_mock)) + self.assertEqual(None, self.hpa.solve(mock_decision_path, + self.candidate_list, + request_mock)) client_mock.call.side_effect = [hpa_candidate_list_1, hpa_candidate_list_2] |