From cab20968a517933bb1da084fb00a48a5448079f9 Mon Sep 17 00:00:00 2001 From: sayaleeraut Date: Wed, 27 Nov 2019 19:21:11 +0530 Subject: [lib]-Adding support for arbiter volumes in setup_volume() Adding support for arbiter and distributed-arbiter volume types as it was not present earlier in setup_volume(). Change-Id: I836e4865bb2066478d5f08254f37f115b3a1aac5 Signed-off-by: sayaleeraut --- .../glustolibs/gluster/volume_libs.py | 37 +++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'glustolibs-gluster/glustolibs/gluster/volume_libs.py') diff --git a/glustolibs-gluster/glustolibs/gluster/volume_libs.py b/glustolibs-gluster/glustolibs/gluster/volume_libs.py index 784e61697..36e1fc10c 100644 --- a/glustolibs-gluster/glustolibs/gluster/volume_libs.py +++ b/glustolibs-gluster/glustolibs/gluster/volume_libs.py @@ -1,4 +1,4 @@ -# Copyright (C) 2015-2016 Red Hat, Inc. +# Copyright (C) 2015-2019 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -221,6 +221,41 @@ def setup_volume(mnode, all_servers_info, volume_config, force=False): return False number_of_bricks = (kwargs['dist_count'] * kwargs['disperse_count']) + + elif volume_type == 'arbiter': + if 'replica_count' in volume_config.get('voltype'): + kwargs['replica_count'] = (volume_config['voltype'] + ['replica_count']) + else: + g.log.error("Replica count not specified in the volume config") + return False + if 'arbiter_count' in volume_config.get('voltype'): + kwargs['arbiter_count'] = (volume_config['voltype'] + ['arbiter_count']) + else: + g.log.error("Arbiter count not specified in the volume config") + return False + number_of_bricks = kwargs['replica_count'] + elif volume_type == 'distributed-arbiter': + if 'dist_count' in volume_config.get('voltype'): + kwargs['dist_count'] = (volume_config['voltype']['dist_count']) + else: + g.log.error("Distribute Count not specified in the volume config") + return False + if 'replica_count' in volume_config.get('voltype'): + kwargs['replica_count'] = (volume_config['voltype'] + ['replica_count']) + else: + g.log.error("Replica count not specified in the volume config") + return False + if 'arbiter_count' in volume_config.get('voltype'): + kwargs['arbiter_count'] = (volume_config['voltype'] + ['arbiter_count']) + else: + g.log.error("Arbiter count not specified in the volume config") + return False + number_of_bricks = (kwargs['dist_count'] * kwargs['replica_count']) + else: g.log.error("Invalid volume type defined in config") return False -- cgit