diff options
author | Peter Mikus <pmikus@cisco.com> | 2019-01-28 13:51:41 +0000 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2019-01-28 13:51:41 +0000 |
commit | 15648d7c4f98cc90a406519362b0d7f548893859 (patch) | |
tree | 29a34bb9ff4937b59da220d171c7d348faabcd06 /resources/libraries/python/CpuUtils.py | |
parent | 75e2e7bbbfc1da40f8c742870ec12204846c9bf9 (diff) |
FIX: CPU util for NF
- Fix detecting total allocable CPUs for NFs
Change-Id: If3345518befb887655d3e162551c49df3163ed92
Signed-off-by: Peter Mikus <pmikus@cisco.com>
Diffstat (limited to 'resources/libraries/python/CpuUtils.py')
-rw-r--r-- | resources/libraries/python/CpuUtils.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/resources/libraries/python/CpuUtils.py b/resources/libraries/python/CpuUtils.py index aa1bd79419..57bf7fdb71 100644 --- a/resources/libraries/python/CpuUtils.py +++ b/resources/libraries/python/CpuUtils.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 Cisco and/or its affiliates. +# Copyright (c) 2019 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -268,7 +268,10 @@ class CpuUtils(object): dt_req = ((kwargs['chains'] * kwargs['nodeness']) + kwargs['dtcr'] - 1)\ / kwargs['dtcr'] - if kwargs['skip_cnt'] + mt_req + dt_req > cpu_list_len: + cpu_req = kwargs['skip_cnt'] + mt_req + dt_req + if smt_used and cpu_req > cpu_list_len / CpuUtils.NR_OF_THREADS: + raise RuntimeError("Not enough CPU cores available for placement!") + elif not smt_used and cpu_req > cpu_list_len: raise RuntimeError("Not enough CPU cores available for placement!") offset = (kwargs['node_id'] - 1) + (kwargs['chain_id'] - 1)\ |