diff --git a/control/server.py b/control/server.py index e7b8df29..d6c47d84 100644 --- a/control/server.py +++ b/control/server.py @@ -58,6 +58,20 @@ def int_to_bitmask(n): """Converts an integer n to a bitmask string""" return f"0x{hex((1 << n) - 1)[2:].upper()}" +def cpumask_set(args): + """Check if reactor cpu mask is set in command line args""" + + # Check if "-m" or "--cpumask" is in the arguments + if "-m" in args or "--cpumask" in args: + return True + + # Check for the presence of "-m=" or "--cpumask=" + for arg in args: + if arg.startswith('-m=') or arg.startswith('--cpumask='): + return True + + return False + class GatewayServer: """Runs SPDK and receives client requests for the gateway service. @@ -384,7 +398,7 @@ def _start_spdk(self, omap_state): # If not provided in configuration, # calculate cpu mask available for spdk reactors - if '-m' not in cmd and '--cpumask' not in cmd: + if not cpumask_set(cmd): cpu_mask = f"-m {int_to_bitmask(min(4, os.cpu_count()))}" self.logger.info(f"SPDK autodetecting cpu_mask: {cpu_mask}") cmd += shlex.split(cpu_mask) diff --git a/spdk b/spdk index 0d9430fa..cd16195a 160000 --- a/spdk +++ b/spdk @@ -1 +1 @@ -Subproject commit 0d9430fab9b368761b13dc73a65b0ed13d6c6bc6 +Subproject commit cd16195a3dc914ea445e90b9cc8ba3211e17b267