From 1e835f6c6b53cd01b6e64741407b064193b2458d Mon Sep 17 00:00:00 2001 From: srijan-sivakumar Date: Fri, 4 Dec 2020 11:51:58 +0530 Subject: [LibFix] Optimizing setup_volume api. Currently the setup volume API is calling the get_volume_info to obtain the volume information to check if the said volume already exists. Internally the get_volume_info would have to parse the complete xml dump received for volume info. Instead of that one can invoke the get_volume_list which would mean reduced effort put into parsing the output received as volume name is the only important factor in this check inside setup_volume. Change-Id: I024d42fe471bf26ac85dd3108d6f123cd56a0766 Signed-off-by: srijan-sivakumar --- glustolibs-gluster/glustolibs/gluster/volume_libs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glustolibs-gluster/glustolibs/gluster/volume_libs.py b/glustolibs-gluster/glustolibs/gluster/volume_libs.py index 376ac5089..87e70ca8c 100644 --- a/glustolibs-gluster/glustolibs/gluster/volume_libs.py +++ b/glustolibs-gluster/glustolibs/gluster/volume_libs.py @@ -124,8 +124,8 @@ def setup_volume(mnode, all_servers_info, volume_config, multi_vol=False, return False # Check if the volume already exists - volinfo = get_volume_info(mnode=mnode) - if volinfo is not None and volname in volinfo.keys(): + vollist = get_volume_list(mnode=mnode) + if vollist is not None and volname in vollist: g.log.info("volume %s already exists. Returning...", volname) return True -- cgit