Skip to content

Commit f46aee0

Browse files
committed
scylla-node: start: do not preserve smp and memory passed via env or cmd_line
If a test wants to preserve memory and/or smp across node restarts, it should use the methods that were intended for this: set_smp and set_mem_mb_per_cpu. Preserving those implicitly when passed to start was not intended. Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
1 parent 1e9a0cc commit f46aee0

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

ccmlib/scylla_node.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -688,22 +688,23 @@ def start(self, join_ring=True, no_wait=False, verbose=False,
688688
# Lets search for default overrides in SCYLLA_EXT_OPTS
689689
env_args = process_opts(os.getenv('SCYLLA_EXT_OPTS', "").split())
690690

691+
smp = self._smp
692+
memory_in_mb = None
693+
691694
# precalculate self._mem_mb_per_cpu if --memory is given in SCYLLA_EXT_OPTS
692695
# and it wasn't set explicitly by the test
693696
if not self._mem_mb_set_during_test and '--memory' in env_args:
694-
memory = self.parse_size(env_args['--memory'][0])
695-
smp = int(env_args['--smp'][0]) if '--smp' in env_args else self._smp
696-
self._mem_mb_per_cpu = int((memory / smp) // MB)
697+
memory_in_mb = self.parse_size(env_args['--memory'][0]) // MB
697698

698699
cmd_args = process_opts(jvm_args)
699700

700701
# use '--memory' in jmv_args if mem_mb_per_cpu was not set by the test
701702
if not self._mem_mb_set_during_test and '--memory' in cmd_args:
702-
self._memory = self.parse_size(cmd_args['--memory'][0])
703+
memory_in_mb = self.parse_size(cmd_args['--memory'][0]) // MB
703704

704705
# use '--smp' in jvm_args if was not set by the test
705706
if not self._smp_set_during_test and '--smp' in cmd_args:
706-
self._smp = int(cmd_args['--smp'][0])
707+
smp = int(cmd_args['--smp'][0])
707708

708709
ext_args = env_args
709710
ext_args.update(cmd_args)
@@ -721,12 +722,12 @@ def start(self, join_ring=True, no_wait=False, verbose=False,
721722

722723
# calculate memory from smp * mem_mb_per_cpu
723724
# if not given in jvm_args
724-
if not self._memory:
725-
self._memory = int(self._smp * self._mem_mb_per_cpu * MB)
725+
if not memory_in_mb:
726+
memory_in_mb = smp * self._mem_mb_per_cpu
726727

727728
assert '--smp' not in args and '--memory' not in args, args
728-
args += ['--smp', str(self._smp)]
729-
args += ['--memory', f"{int(self._memory // MB)}M"]
729+
args += ['--smp', str(smp)]
730+
args += ['--memory', f"{memory_in_mb}M"]
730731

731732
if '--developer-mode' not in args:
732733
args += ['--developer-mode', 'true']

0 commit comments

Comments
 (0)