From f7f8b46c6d15a26576db0066efe8a93ab07f0a63 Mon Sep 17 00:00:00 2001 From: ShwethaHP Date: Thu, 3 Aug 2017 05:33:27 +0530 Subject: Set volume options on all the volume types Providing a section in the config file to set volume options that can be applicable to any volume type created. The glusterbase class also reads the volume_options if provided in config file and set it on all the volumes being created. These volume options will be overwritten if there are any volume options specified while defining the volumes under 'volumes' section. Change-Id: I0003312251b4f8b151c9ba5c71d1b6a8884cc85e Signed-off-by: ShwethaHP --- glustolibs-gluster/glustolibs/gluster/gluster_base_class.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'glustolibs-gluster') diff --git a/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py b/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py index 09946d739..ee7a23f3c 100644 --- a/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py +++ b/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py @@ -204,6 +204,13 @@ class GlusterBaseClass(unittest.TestCase): } } + # Default volume options which is applicable for all the volumes + cls.volume_options = {} + if ('volume_options' in g.config['gluster'] and + g.config['gluster']['volume_options']): + cls.volume_options = ( + g.config['gluster']['volume_options']) + # Get the volume configuration. cls.volume = {} if cls.volume_type: @@ -241,7 +248,7 @@ class GlusterBaseClass(unittest.TestCase): # Set volume options if 'options' not in cls.volume: - cls.volume['options'] = {} + cls.volume['options'] = cls.volume_options # Define Volume Useful Variables. cls.volname = cls.volume['name'] -- cgit