From 25705b75099de310df1c7508664ea84ba9e7313b Mon Sep 17 00:00:00 2001 From: Chi Lo Date: Sat, 9 Mar 2019 23:32:19 -0800 Subject: [PATCH] Added hyperthread isolation option to flavor series. Change-Id: I71cf5b9d7e19045ac1a7b441f3570fce1e4e5558 --- .../flavor_manager/fms_rest/data/wsme/models.py | 16 ++++++++++++++++ .../fms_rest/logic/flavor_logic.py | 2 ++ 2 files changed, 18 insertions(+) diff --git a/orm/services/flavor_manager/fms_rest/data/wsme/models.py b/orm/services/flavor_manager/fms_rest/data/wsme/models.py index a8b5ddb4..03f48c3f 100755 --- a/orm/services/flavor_manager/fms_rest/data/wsme/models.py +++ b/orm/services/flavor_manager/fms_rest/data/wsme/models.py @@ -493,6 +493,22 @@ class Flavor(Model): if option_pci: requested_options.extend(option_pci) + # Evaluate thread options + if 'valid_options_thread' in series_metadata: + valid_thread = [x for x in + series_metadata['valid_options_thread'].split(',')] + + option_thread = [n for n in valid_thread if n in + self.options.keys() and + self.options[n].lower() == 'true' and + self.visibility.lower() == 'private'] + + if option_thread: + es = db_models.FlavorExtraSpec( + key_name_value=series_metadata['es_thread_policy']) + extra_spec_needed.append(es) + requested_options.extend(option_thread) + # Evalulate mixed options assorted_opts = [] for mixed_key, mixed_value in mixed_options.items(): diff --git a/orm/services/flavor_manager/fms_rest/logic/flavor_logic.py b/orm/services/flavor_manager/fms_rest/logic/flavor_logic.py index 1d4ca2d2..fafd58ad 100755 --- a/orm/services/flavor_manager/fms_rest/logic/flavor_logic.py +++ b/orm/services/flavor_manager/fms_rest/logic/flavor_logic.py @@ -954,6 +954,8 @@ def calculate_name(flavor): if 'i2' in options and 'n0' not in options: options.remove('i2') + if 't0' in options and flavor.flavor.visibility.lower() != 'private': + options.remove('t0') if options: name += '.'