From b531c48ae8806495cd277a42c8384d775a6e6a54 Mon Sep 17 00:00:00 2001 From: fandehui Date: Thu, 28 Dec 2023 09:50:05 +0800 Subject: [PATCH] simarray._block_rounding: Use integer division This was causing problems for py2 vs. py3 code. Always use integer division. Signed-off-by: fandehui --- libstoragemgmt.spec | 6 +++- ..._block_rounding-Use-integer-division.patch | 29 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 simarray._block_rounding-Use-integer-division.patch diff --git a/libstoragemgmt.spec b/libstoragemgmt.spec index 6606803..1dda135 100644 --- a/libstoragemgmt.spec +++ b/libstoragemgmt.spec @@ -2,7 +2,7 @@ %define with_python2 0 Name: libstoragemgmt Version: 1.8.0 -Release: 6 +Release: 7 Summary: Storage array management library License: LGPLv2+ URL: https://github.com/libstorage/libstoragemgmt @@ -10,6 +10,7 @@ Source0: https://github.com/libstorage/libstoragemgmt/releases/download/%{versio Patch1: 0001-change-run-dir.patch Patch2: 0002-fix-bugfix-when-exec-lsmd-help-attach-daemon.patch +Patch3: simarray._block_rounding-Use-integer-division.patch BuildRequires: gcc gcc-c++ autoconf automake libtool libxml2-devel check-devel perl-interpreter BuildRequires: openssl-devel glib2-devel systemd bash-completion libconfig-devel systemd-devel @@ -371,6 +372,9 @@ fi %{_mandir}/man*/* %changelog +* Thu Dec 28 2023 fandehui - 1.8.0-7 +- simarray._block_rounding: Use integer division + * Tue Jul 27 2021 yannglongkang - 1.8.0-6 - fix bugfix when exec lsmd help attach daemon diff --git a/simarray._block_rounding-Use-integer-division.patch b/simarray._block_rounding-Use-integer-division.patch new file mode 100644 index 0000000..c6dbd5a --- /dev/null +++ b/simarray._block_rounding-Use-integer-division.patch @@ -0,0 +1,29 @@ +From 2ba3527ae5dc345ee91797c6445bb7fe009b02e3 Mon Sep 17 00:00:00 2001 +From: Tony Asleson +Date: Thu, 23 May 2019 14:35:51 -0500 +Subject: [PATCH] simarray._block_rounding: Use integer division + +This was causing problems for py2 vs. py3 code. Always use integer +division. + +Signed-off-by: Tony Asleson +--- + plugin/sim/simarray.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/plugin/sim/simarray.py b/plugin/sim/simarray.py +index 6f0a582..bc7817b 100644 +--- a/plugin/sim/simarray.py ++++ b/plugin/sim/simarray.py +@@ -1268,7 +1268,7 @@ def _check_pool_free_space(self, sim_pool_id, size_bytes): + + @staticmethod + def _block_rounding(size_bytes): +- return (size_bytes + BackStore.BLK_SIZE - 1) / \ ++ return (size_bytes + BackStore.BLK_SIZE - 1) // \ + BackStore.BLK_SIZE * BackStore.BLK_SIZE + + def sim_vol_create(self, name, size_bytes, sim_pool_id, is_hw_raid_vol=0): +-- +2.27.0 + -- Gitee