From ee175bd6b40743268a341cc748dca50f58951c4a Mon Sep 17 00:00:00 2001 From: Pranav Date: Tue, 2 Jun 2020 19:19:52 +0530 Subject: [Libfix] Fix get_bricks_to_bring_offline_from_replicated_volume Finding the offline brick limit using ceil returns incorrect value. E.g., For replica count 3, ceil(3/2) returns 2, and the subsequent method uses this value to bring down 2 out of 3 available bricks, resulting in IO and many other failures. Fix: Change ceil to floor. Also change the '/' operator to '//' for py2/3 compatibility Change-Id: I3ee10647bb037a3efe95d1b04e0864cf61e2499e Signed-off-by: Pranav --- glustolibs-gluster/glustolibs/gluster/brick_libs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'glustolibs-gluster/glustolibs/gluster') diff --git a/glustolibs-gluster/glustolibs/gluster/brick_libs.py b/glustolibs-gluster/glustolibs/gluster/brick_libs.py index 8c77a79a0..d1aa02146 100644 --- a/glustolibs-gluster/glustolibs/gluster/brick_libs.py +++ b/glustolibs-gluster/glustolibs/gluster/brick_libs.py @@ -17,7 +17,7 @@ """ Description: Module for gluster brick related helper functions. """ import random -from math import ceil +from math import floor import time from glusto.core import Glusto as g from glustolibs.gluster.brickmux_ops import is_brick_mux_enabled @@ -806,7 +806,7 @@ def get_bricks_to_bring_offline_from_replicated_volume(subvols_list, offline_bricks_limit = int(replica_count) - int(quorum_count) elif 'auto' in quorum_type: - offline_bricks_limit = ceil(int(replica_count) / 2) + offline_bricks_limit = floor(int(replica_count) // 2) elif quorum_type is None: offline_bricks_limit = int(replica_count) - 1 -- cgit