aboutsummaryrefslogtreecommitdiffstats
path: root/extras/vpp_config
diff options
context:
space:
mode:
authorjdenisco <jdenisco@cisco.com>2019-04-05 12:25:50 -0400
committerjdenisco <jdenisco@cisco.com>2019-04-09 12:55:20 -0400
commitaf86c6396b36968a081cc1ed5a9f5ee37ff544fa (patch)
tree9e8dedac1117352465b9960e126b75e00834127a /extras/vpp_config
parent26e035bfcda580a8ce06df7498ca30e0a39b45ef (diff)
Fix some python3, cleanup cpu allocation
Change-Id: I97cecc964f341720d8c4894656637082db5886d7 Signed-off-by: jdenisco <jdenisco@cisco.com>
Diffstat (limited to 'extras/vpp_config')
-rw-r--r--extras/vpp_config/setup.py2
-rwxr-xr-xextras/vpp_config/vpp_config.py13
-rw-r--r--extras/vpp_config/vpplib/AutoConfig.py38
3 files changed, 34 insertions, 19 deletions
diff --git a/extras/vpp_config/setup.py b/extras/vpp_config/setup.py
index c8d12ef7ef4..f04669f7e42 100644
--- a/extras/vpp_config/setup.py
+++ b/extras/vpp_config/setup.py
@@ -1,7 +1,7 @@
from setuptools import setup
setup(name="vpp_config",
- version="19.01.3",
+ version="19.01.4",
author="John DeNisco",
author_email="jdenisco@cisco.com",
description="VPP Configuration Utility",
diff --git a/extras/vpp_config/vpp_config.py b/extras/vpp_config/vpp_config.py
index 1f792014074..0ff40f161b5 100755
--- a/extras/vpp_config/vpp_config.py
+++ b/extras/vpp_config/vpp_config.py
@@ -341,12 +341,6 @@ def autoconfig_dryrun(ask_questions=True):
"""
- vutil = VPPUtil()
- pkgs = vutil.get_installed_vpp_pkgs()
- if len(pkgs) == 0:
- print ("\nVPP is not installed, please install VPP.")
- return
-
acfg = AutoConfig(rootdir, VPP_AUTO_CONFIGURATION_FILE, clean=True)
# Stop VPP on each node
@@ -371,6 +365,13 @@ def autoconfig_dryrun(ask_questions=True):
else:
acfg.update_interfaces_config()
+ # If there are no interfaces, just return
+ for i in nodes.items():
+ node = i[1]
+ if not acfg.has_interfaces(node):
+ print("\nThere are no VPP interfaces configured, please configure at least 1.")
+ return
+
# Modify CPU
acfg.modify_cpu(ask_questions)
diff --git a/extras/vpp_config/vpplib/AutoConfig.py b/extras/vpp_config/vpplib/AutoConfig.py
index da00b2878eb..6fd6eeea096 100644
--- a/extras/vpp_config/vpplib/AutoConfig.py
+++ b/extras/vpp_config/vpplib/AutoConfig.py
@@ -572,7 +572,7 @@ class AutoConfig(object):
# then we shouldn't get workers
total_workers_node = 0
if len(ports_per_numa):
- total_workers_node = total_vpp_cpus / len(ports_per_numa)
+ total_workers_node = total_vpp_cpus // len(ports_per_numa)
total_main = 0
if reserve_vpp_main_core:
total_main = 1
@@ -953,7 +953,9 @@ class AutoConfig(object):
print("Then to improve performance start reserving cores and "
"adding queues as needed.")
- max_vpp_cpus = 4
+ # Leave 1 for the general system
+ total_cpus -= 1
+ max_vpp_cpus = min(total_cpus, 4)
total_vpp_cpus = 0
if max_vpp_cpus > 0:
question = "\nHow many core(s) shall we reserve for " \
@@ -961,15 +963,16 @@ class AutoConfig(object):
total_vpp_cpus = self._ask_user_range(question, 0, max_vpp_cpus, 0)
node['cpu']['total_vpp_cpus'] = total_vpp_cpus
- max_other_cores = (total_cpus - total_vpp_cpus) / 2
- question = 'How many core(s) do you want to reserve for ' \
- 'processes other than VPP? [0-{}][0]? '. \
- format(str(max_other_cores))
- total_other_cpus = self._ask_user_range(
- question, 0, max_other_cores, 0)
- node['cpu']['total_other_cpus'] = total_other_cpus
+ total_other_cpus = 0
+ max_other_cores = total_cpus - total_vpp_cpus
+ if max_other_cores > 0:
+ question = 'How many core(s) do you want to reserve for ' \
+ 'processes other than VPP? [0-{}][0]? '. \
+ format(str(max_other_cores))
+ total_other_cpus = self._ask_user_range(question, 0, max_other_cores, 0)
+ node['cpu']['total_other_cpus'] = total_other_cpus
- max_main_cpus = max_vpp_cpus + 1 - total_vpp_cpus
+ max_main_cpus = total_cpus - total_vpp_cpus - total_other_cpus
reserve_vpp_main_core = False
if max_main_cpus > 0:
question = "Should we reserve 1 core for the VPP Main thread? "
@@ -1034,7 +1037,7 @@ class AutoConfig(object):
node['cpu']['cpus_per_node'] = cpus_per_node
# Ask the user some questions
- if ask_questions and total_cpus >= 8:
+ if ask_questions and total_cpus >= 4:
self._modify_cpu_questions(node, total_cpus, numa_nodes)
# Populate the interfaces with the numa node
@@ -1485,13 +1488,24 @@ class AutoConfig(object):
hpg.show_huge_pages()
@staticmethod
+ def has_interfaces(node):
+ """
+ Check for interfaces, return tru if there is at least one
+
+ :returns: boolean
+ """
+ if 'interfaces' in node and len(node['interfaces']):
+ return True
+ else:
+ return False
+
+ @staticmethod
def min_system_resources(node):
"""
Check the system for basic minimum resources, return true if
there is enough.
:returns: boolean
- :rtype: dict
"""
min_sys_res = True