From fe19f169a5acce08e15d373d2839a7f75c281749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Degr=C3=A9mont?= <1502778+degremont@users.noreply.github.com> Date: Fri, 26 Jul 2024 09:35:35 +0200 Subject: [PATCH] Ticket #216: fix floor division operators (#222) Fix for Python 3 support. Originally from stanford-rc@1e80cc3 Signed-off-by: Stephane Thiell --- lib/Shine/Commands/Fsck.py | 4 ++-- lib/Shine/Commands/Tune.py | 4 ++-- lib/Shine/Lustre/Actions/Format.py | 2 +- lib/Shine/Lustre/Actions/Fsck.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Shine/Commands/Fsck.py b/lib/Shine/Commands/Fsck.py index 49c3f6c..2f0bc02 100644 --- a/lib/Shine/Commands/Fsck.py +++ b/lib/Shine/Commands/Fsck.py @@ -54,7 +54,7 @@ def action_start(self, node, action, comp): def action_progress(self, node, action, comp, result): self._comps[comp] = result.progress - self._current = sum(self._comps.values()) / len(self._comps) + self._current = sum(self._comps.values()) // len(self._comps) header = self.command.NAME.capitalize() sys.stdout.write("%s in progress: %d %%\r" % (header, self._current)) sys.stdout.flush() @@ -75,7 +75,7 @@ def action_start(self, node, action, comp): def action_progress(self, node, action, comp, result): self._comps[comp] = result.progress - self._current = sum(self._comps.values()) / len(self._comps) + self._current = sum(self._comps.values()) // len(self._comps) header = self.command.NAME.capitalize() sys.stdout.write("%s in progress: %d %%\r" % (header, self._current)) sys.stdout.flush() diff --git a/lib/Shine/Commands/Tune.py b/lib/Shine/Commands/Tune.py index 389c1ff..92c9f87 100644 --- a/lib/Shine/Commands/Tune.py +++ b/lib/Shine/Commands/Tune.py @@ -167,7 +167,7 @@ def _add_quota_tuning(cls, tunings, fs_conf): tunings.create_parameter_alias("quota_btune_oss", path) # Convert the values to the right units - quota_btune = str(int(quota_btune) * int(quota_bunit) / 100) + quota_btune = str(int(quota_btune) * int(quota_bunit) // 100) # Create the quota tuning parameters with the right values tunings.create_parameter('quota_btune_mds', quota_btune, ['mds']) @@ -196,7 +196,7 @@ def _add_quota_tuning(cls, tunings, fs_conf): tunings.create_parameter_alias("quota_itune_oss", path) # Convert the values to the right units - quota_itune = str(int(quota_itune) * int(quota_iunit) / 100) + quota_itune = str(int(quota_itune) * int(quota_iunit) // 100) # Create the quota tuning parameters with the right values tunings.create_parameter('quota_itune_mds', quota_itune, ['mds']) diff --git a/lib/Shine/Lustre/Actions/Format.py b/lib/Shine/Lustre/Actions/Format.py index 544c6a3..e9d96a0 100644 --- a/lib/Shine/Lustre/Actions/Format.py +++ b/lib/Shine/Lustre/Actions/Format.py @@ -225,7 +225,7 @@ def _prepare_cmd(self): # loop back devices if not self.comp.dev_isblk: - command.append('--device-size=%d' % (self.comp.dev_size / 1024)) + command.append('--device-size=%d' % (self.comp.dev_size // 1024)) command.append(self.comp.dev) diff --git a/lib/Shine/Lustre/Actions/Fsck.py b/lib/Shine/Lustre/Actions/Fsck.py index 1646431..2ab6a11 100644 --- a/lib/Shine/Lustre/Actions/Fsck.py +++ b/lib/Shine/Lustre/Actions/Fsck.py @@ -46,7 +46,7 @@ def __init__(self, passid, current, total): @property def progress(self): """Current fsck command progression value, between 1 and 100.""" - return ((self.pass_id - 1 + self.pass_progress) / self._NB_PASSES) * 100 + return ((self.pass_id - 1 + self.pass_progress) // self._NB_PASSES) * 100 class Fsck(FSAction): """