From e8ae2afd612ef7fd08b7d855c48c78fe54b34ec4 Mon Sep 17 00:00:00 2001 From: Ze Gan Date: Thu, 30 Nov 2023 11:07:35 +0800 Subject: [PATCH] [featured]: Add database services for DPU (#84) According to the dpu number to start corresponding database container instances. Signed-off-by: Ze Gan --- scripts/featured | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/featured b/scripts/featured index d66e8b10..39782377 100644 --- a/scripts/featured +++ b/scripts/featured @@ -79,6 +79,7 @@ class Feature(object): self.delayed = safe_eval(feature_cfg.get('delayed', 'False')) self.has_global_scope = safe_eval(feature_cfg.get('has_global_scope', 'True')) self.has_per_asic_scope = safe_eval(self._get_feature_table_key_render_value(feature_cfg.get('has_per_asic_scope', 'False'), device_config or {}, ['True', 'False'])) + self.has_per_dpu_scope = safe_eval(feature_cfg.get('has_per_dpu_scope', 'False')) def _get_feature_table_key_render_value(self, configuration, device_config, expected_values): """ Returns the target value for the feature by rendering the configuration as J2 template. @@ -131,6 +132,7 @@ class FeatureHandler(object): self._device_running_config = device_info.get_device_runtime_metadata() self.ns_cfg_db = {} self.ns_feature_state_tbl = {} + self.num_dpus = device_info.get_num_dpus() # Initlaize Global config that loads all database*.json if self.is_multi_npu: @@ -364,7 +366,9 @@ class FeatureHandler(object): feature_names = ( ([feature.name] if feature.has_global_scope or not self.is_multi_npu else []) + ([(feature.name + '@' + str(asic_inst)) for asic_inst in range(device_info.get_num_npus()) - if self.is_multi_npu and (all_instance or feature.has_per_asic_scope)]) + if self.is_multi_npu and (all_instance or feature.has_per_asic_scope)]) + + ([(feature.name + '@' + device_info.DPU_NAME_PREFIX + str(dpu_inst)) for dpu_inst in range(self.num_dpus) + if all_instance or feature.has_per_dpu_scope]) ) if not feature_names: