summaryrefslogtreecommitdiffstats
path: root/glustolibs-gluster/glustolibs/gluster
diff options
context:
space:
mode:
authorsayaleeraut <saraut@redhat.com>2019-11-27 19:21:11 +0530
committerBala Konda Reddy M <bmekala@redhat.com>2019-11-29 09:53:31 +0000
commitcab20968a517933bb1da084fb00a48a5448079f9 (patch)
tree8a8af79f0281d83ed0b1dcaacffbc5ea29fb7b6c /glustolibs-gluster/glustolibs/gluster
parent7478c9fafaebeab1054509fc92b2767d80c60c4d (diff)
[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 <saraut@redhat.com>
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster')
-rw-r--r--glustolibs-gluster/glustolibs/gluster/volume_libs.py37
1 files changed, 36 insertions, 1 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/volume_libs.py b/glustolibs-gluster/glustolibs/gluster/volume_libs.py
index 784e616..36e1fc1 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. <http://www.redhat.com>
+# Copyright (C) 2015-2019 Red Hat, Inc. <http://www.redhat.com>
#
# 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