diff options
author | Dileep Ranganathan <dileep.ranganathan@intel.com> | 2018-03-19 06:11:19 -0700 |
---|---|---|
committer | Dileep Ranganathan <dileep.ranganathan@intel.com> | 2018-03-25 05:53:06 -0700 |
commit | fbafa4fc9aa5a130870ce0cacaba90a9384303b4 (patch) | |
tree | 6e31e10c5125de437e2cca53d1e5d16c546fc426 /conductor | |
parent | 3437fc2b299bf73a525bbb30e9241af14c62bd57 (diff) |
Add flavor label mapping to Homing response
Added flavors to the recommendation JSON response from HAS
Change-Id: I7f993dba59d7a07866a2383567c75efe960e601a
Issue-ID: OPTFRA-182
Signed-off-by: Dileep Ranganathan <dileep.ranganathan@intel.com>
Diffstat (limited to 'conductor')
-rw-r--r-- | conductor/conductor/solver/service.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/conductor/conductor/solver/service.py b/conductor/conductor/solver/service.py index f0bdb81..e539acd 100644 --- a/conductor/conductor/solver/service.py +++ b/conductor/conductor/solver/service.py @@ -17,23 +17,22 @@ # ------------------------------------------------------------------------- # -import cotyledon -import time import socket -from oslo_config import cfg -from oslo_log import log +import time +import cotyledon +from conductor import messaging +from conductor import service from conductor.common.models import plan from conductor.common.music import api from conductor.common.music import messaging as music_messaging from conductor.common.music.model import base from conductor.i18n import _LE, _LI -from conductor import messaging -from conductor import service from conductor.solver.optimizer import optimizer from conductor.solver.request import parser from conductor.solver.utils import constraint_engine_interface as cei - +from oslo_config import cfg +from oslo_log import log # To use oslo.log in services: # @@ -347,6 +346,11 @@ class SolverService(cotyledon.Service): rec["attributes"]["host_id"] = resource.get("host_id") rec["candidate"]["host_id"] = resource.get("host_id") + if rec["candidate"]["inventory_type"] == "cloud": + if resource.get("flavor_map"): + rec["attributes"]["flavors"] = resource.get( + "flavor_map") + # TODO(snarayanan): Add total value to recommendations? # msg = "--- total value of decision = {}" # LOG.debug(msg.format(_best_path.total_value)) |