diff options
author | 2021-02-11 16:58:39 +0300 | |
---|---|---|
committer | 2021-02-11 17:04:36 +0300 | |
commit | 849357bb9ca1d27993c9e96b93156ec69b3ac3a9 (patch) | |
tree | 16fc193c87fe5b1ec0554bd151be01e02815cd0d /VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py | |
parent | 4ada3cbcdb56c79abd0bb34eef5dede6c36fbe82 (diff) |
Add support for native Kubernetes CPU Manager0.0.1
For Kubernetes environment core ids in the config and test files are relative and
automatically remapped to the allowed cores allocated for container.
There is no change to the baremetal or VM environment.
Signed-off-by: Yury Kylulin <yury.kylulin@intel.com>
Change-Id: I63e499723e8213de1b05d4175eb3eddc4492ccf5
Diffstat (limited to 'VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py')
-rw-r--r-- | VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py index eb611bf6..074d4f7e 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py @@ -81,6 +81,24 @@ class RapidGeneratorMachine(RapidMachine): return (self.machine_params['gencores'] + self.machine_params['latcores']) + def remap_all_cpus(self): + """Convert relative cpu ids for different parameters (gencores, latcores) + """ + super().remap_all_cpus() + + if self.cpu_mapping is None: + return + + if 'gencores' in self.machine_params.keys(): + cpus_remapped = super().remap_cpus(self.machine_params['gencores']) + RapidLog.debug('{} ({}): gencores {} remapped to {}'.format(self.name, self.ip, self.machine_params['gencores'], cpus_remapped)) + self.machine_params['gencores'] = cpus_remapped + + if 'latcores' in self.machine_params.keys(): + cpus_remapped = super().remap_cpus(self.machine_params['latcores']) + RapidLog.debug('{} ({}): latcores {} remapped to {}'.format(self.name, self.ip, self.machine_params['latcores'], cpus_remapped)) + self.machine_params['latcores'] = cpus_remapped + def generate_lua(self, vim, prox_config_file): appendix = 'gencores="%s"\n'% ','.join(map(str, self.machine_params['gencores'])) @@ -109,6 +127,8 @@ class RapidGeneratorMachine(RapidMachine): # Start the generator with the -e option so that the cores don't # start automatically super().start_prox('-e') + if self.vim in ['kubernetes']: + self.remap_all_cpus() def set_generator_speed(self, speed): # The assumption is that we only use task 0 for generating |