From b02e147e35ebec6da669fb125d51062b82f46af4 Mon Sep 17 00:00:00 2001 From: Arthy Loganathan Date: Mon, 11 Sep 2017 15:05:31 +0530 Subject: glustolibs: Handled the case to honour mounts option in config.yml if it is specified Change-Id: Icb47d923860bbd2c1c70d2f7c23965a5368afa52 Signed-off-by: Arthy Loganathan --- .../glustolibs/gluster/gluster_base_class.py | 27 +++++++++++++++------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'glustolibs-gluster/glustolibs/gluster') diff --git a/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py b/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py index 5aba6c637..e191f005d 100644 --- a/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py +++ b/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py @@ -290,23 +290,34 @@ class GlusterBaseClass(unittest.TestCase): continue else: temp_mount['volname'] = cls.volname - if ('server' not in temp_mount or - (not temp_mount['server'])): + if ('server' not in mount or + (not mount['server'])): temp_mount['server'] = cls.mnode - if ('mountpoint' not in temp_mount or - (not temp_mount['mountpoint'])): + else: + temp_mount['server'] = mount['server'] + if ('mountpoint' not in mount or + (not mount['mountpoint'])): temp_mount['mountpoint'] = (os.path.join( "/mnt", '_'.join([cls.volname, cls.mount_type]))) - if ('client' not in temp_mount or - (not temp_mount['client'])): + else: + temp_mount['mountpoint'] = mount['mountpoint'] + if ('client' not in mount or + (not mount['client'])): temp_mount['client'] = ( cls.all_clients_info[ random.choice( cls.all_clients_info.keys())] ) + else: + temp_mount['client'] = mount['client'] + if 'options' in mount and mount['options']: + temp_mount['options'] = mount['options'] + else: + temp_mount['options'] = '' cls.mounts_dict_list.append(temp_mount) found_mount = True + if not found_mount: for client in cls.all_clients_info.keys(): mount = { @@ -503,7 +514,7 @@ class GlusterVolumeBaseClass(GlusterBaseClass): g.log.info("Get mounts Info:") log_mounts_info(cls.mounts) else: - g.log.info("Not Mouting the volume as 'mount_vol' option is " + g.log.info("Not Mounting the volume as 'mount_vol' option is " "set to %s", mount_vol) @classmethod @@ -527,7 +538,7 @@ class GlusterVolumeBaseClass(GlusterBaseClass): else: g.log.info("Successful in unmounting volume on all clients") else: - g.log.info("Not Unmouting the Volume as 'umount_vol' is set " + g.log.info("Not Unmounting the Volume as 'umount_vol' is set " "to %s", umount_vol) # Cleanup volume -- cgit