diff options
Diffstat (limited to 'glustolibs-gluster')
| -rw-r--r-- | glustolibs-gluster/glustolibs/gluster/brick_libs.py | 298 | ||||
| -rw-r--r-- | glustolibs-gluster/glustolibs/gluster/gluster_base_class.py | 2 | ||||
| -rw-r--r-- | glustolibs-gluster/glustolibs/gluster/tiering_ops.py | 1023 | ||||
| -rw-r--r-- | glustolibs-gluster/glustolibs/gluster/volume_libs.py | 817 | ||||
| -rw-r--r-- | glustolibs-gluster/glustolibs/gluster/volume_ops.py | 159 | 
5 files changed, 161 insertions, 2138 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/brick_libs.py b/glustolibs-gluster/glustolibs/gluster/brick_libs.py index d1aa02146..5c056ef34 100644 --- a/glustolibs-gluster/glustolibs/gluster/brick_libs.py +++ b/glustolibs-gluster/glustolibs/gluster/brick_libs.py @@ -22,7 +22,7 @@ import time  from glusto.core import Glusto as g  from glustolibs.gluster.brickmux_ops import is_brick_mux_enabled  from glustolibs.gluster.volume_ops import (get_volume_info, get_volume_status) -from glustolibs.gluster.volume_libs import (get_subvols, is_tiered_volume, +from glustolibs.gluster.volume_libs import (get_subvols,                                              get_client_quorum_info,                                              get_volume_type_info)  from glustolibs.gluster.lib_utils import (get_extended_attributes_info) @@ -30,8 +30,6 @@ from glustolibs.gluster.lib_utils import (get_extended_attributes_info)  def get_all_bricks(mnode, volname):      """Get list of all the bricks of the specified volume. -        If the volume is 'Tier' volume, the list will contain both -        'hot tier' and 'cold tier' bricks.      Args:          mnode (str): Node on which command has to be executed @@ -46,19 +44,7 @@ def get_all_bricks(mnode, volname):          g.log.error("Unable to get the volinfo of %s.", volname)          return None -    if 'Tier' in volinfo[volname]['typeStr']: -        # Get bricks from hot-tier in case of Tier volume -        hot_tier_bricks = get_hot_tier_bricks(mnode, volname) -        if hot_tier_bricks is None: -            return None -        # Get cold-tier bricks in case of Tier volume -        cold_tier_bricks = get_cold_tier_bricks(mnode, volname) -        if cold_tier_bricks is None: -            return None - -        return hot_tier_bricks + cold_tier_bricks - -    # Get bricks from a non Tier volume +    # Get bricks from a volume      all_bricks = []      if 'bricks' in volinfo[volname]:          if 'brick' in volinfo[volname]['bricks']: @@ -77,88 +63,6 @@ def get_all_bricks(mnode, volname):      return None -def get_hot_tier_bricks(mnode, volname): -    """Get list of hot-tier bricks of the specified volume - -    Args: -        mnode (str): Node on which command has to be executed -        volname (str): Name of the volume - -    Returns: -        list : List of hot-tier bricks of the volume on Success. -        NoneType: None on failure. -    """ -    volinfo = get_volume_info(mnode, volname) -    if volinfo is None: -        g.log.error("Unable to get the volinfo of %s.", volname) -        return None - -    if 'Tier' not in volinfo[volname]['typeStr']: -        g.log.error("Volume %s is not a tiered volume", volname) -        return None - -    hot_tier_bricks = [] -    if 'bricks' in volinfo[volname]: -        if 'hotBricks' in volinfo[volname]['bricks']: -            if 'brick' in volinfo[volname]['bricks']['hotBricks']: -                for brick in volinfo[volname]['bricks']['hotBricks']['brick']: -                    if 'name' in brick: -                        hot_tier_bricks.append(brick['name']) -                    else: -                        g.log.error("brick %s doesn't have the key 'name' " -                                    "for the volume: %s", brick, volname) -                        return None -            else: -                g.log.error("Bricks not found in hotBricks section of volume " -                            "info for the volume %s", volname) -                return None -        return hot_tier_bricks -    else: -        g.log.error("Bricks not found for the volume %s", volname) -        return None - - -def get_cold_tier_bricks(mnode, volname): -    """Get list of cold-tier bricks of the specified volume - -    Args: -        mnode (str): Node on which command has to be executed -        volname (str): Name of the volume - -    Returns: -        list : List of cold-tier bricks of the volume on Success. -        NoneType: None on failure. -    """ -    volinfo = get_volume_info(mnode, volname) -    if volinfo is None: -        g.log.error("Unable to get the volinfo of %s.", volname) -        return None - -    if 'Tier' not in volinfo[volname]['typeStr']: -        g.log.error("Volume %s is not a tiered volume", volname) -        return None - -    cold_tier_bricks = [] -    if 'bricks' in volinfo[volname]: -        if 'coldBricks' in volinfo[volname]['bricks']: -            if 'brick' in volinfo[volname]['bricks']['coldBricks']: -                for brick in volinfo[volname]['bricks']['coldBricks']['brick']: -                    if 'name' in brick: -                        cold_tier_bricks.append(brick['name']) -                    else: -                        g.log.error("brick %s doesn't have the key 'name' " -                                    "for the volume: %s", brick, volname) -                        return None -            else: -                g.log.error("Bricks not found in coldBricks section of volume " -                            "info for the volume %s", volname) -                return None -        return cold_tier_bricks -    else: -        g.log.error("Bricks not found for the volume %s", volname) -        return None - -  def bring_bricks_offline(volname, bricks_list,                           bring_bricks_offline_methods=None):      """Bring the bricks specified in the bricks_list offline. @@ -505,41 +409,29 @@ def select_bricks_to_bring_offline(mnode, volname):              being empty list.              Example:                  brick_to_bring_offline = { -                    'is_tier': False, -                    'hot_tier_bricks': [], -                    'cold_tier_bricks': [],                      'volume_bricks': []                      }      """      # Defaulting the values to empty list      bricks_to_bring_offline = { -        'is_tier': False, -        'hot_tier_bricks': [], -        'cold_tier_bricks': [],          'volume_bricks': [] -        } +    }      volinfo = get_volume_info(mnode, volname)      if volinfo is None:          g.log.error("Unable to get the volume info for volume %s", volname)          return bricks_to_bring_offline -    if is_tiered_volume(mnode, volname): -        bricks_to_bring_offline['is_tier'] = True -        # Select bricks from tiered volume. -        bricks_to_bring_offline = ( -            select_tier_volume_bricks_to_bring_offline(mnode, volname)) -    else: -        # Select bricks from non-tiered volume. -        volume_bricks = select_volume_bricks_to_bring_offline(mnode, volname) -        bricks_to_bring_offline['volume_bricks'] = volume_bricks +    # Select bricks from the volume. +    volume_bricks = select_volume_bricks_to_bring_offline(mnode, volname) +    bricks_to_bring_offline['volume_bricks'] = volume_bricks      return bricks_to_bring_offline  def select_volume_bricks_to_bring_offline(mnode, volname):      """Randomly selects bricks to bring offline without affecting the cluster -    from a non-tiered volume. +    from a volume.      Args:          mnode (str): Node on which commands will be executed. @@ -547,14 +439,10 @@ def select_volume_bricks_to_bring_offline(mnode, volname):      Returns:          list: On success returns list of bricks that can be brough offline. -            If volume doesn't exist or is a tiered volume returns empty list +            If volume doesn't exist returns empty list      """      volume_bricks_to_bring_offline = [] -    # Check if volume is tiered -    if is_tiered_volume(mnode, volname): -        return volume_bricks_to_bring_offline -      # get volume type      volume_type_info = get_volume_type_info(mnode, volname)      volume_type = volume_type_info['volume_type_info']['typeStr'] @@ -599,162 +487,6 @@ def select_volume_bricks_to_bring_offline(mnode, volname):      return volume_bricks_to_bring_offline -def select_tier_volume_bricks_to_bring_offline(mnode, volname): -    """Randomly selects bricks to bring offline without affecting the cluster -    from a tiered volume. - -    Args: -        mnode (str): Node on which commands will be executed. -        volname (str): Name of the volume. - -    Returns: -        dict: On success returns dict. Value of each key is list of bricks to -            bring offline. -            If volume doesn't exist or is not a tiered volume returns dict -            with value of each item being empty list. -            Example: -                brick_to_bring_offline = { -                    'hot_tier_bricks': [], -                    'cold_tier_bricks': [], -                    } -    """ -    # Defaulting the values to empty list -    bricks_to_bring_offline = { -        'hot_tier_bricks': [], -        'cold_tier_bricks': [], -        } - -    volinfo = get_volume_info(mnode, volname) -    if volinfo is None: -        g.log.error("Unable to get the volume info for volume %s", volname) -        return bricks_to_bring_offline - -    if is_tiered_volume(mnode, volname): -        # Select bricks from both hot tier and cold tier. -        hot_tier_bricks = (select_hot_tier_bricks_to_bring_offline -                           (mnode, volname)) -        cold_tier_bricks = (select_cold_tier_bricks_to_bring_offline -                            (mnode, volname)) -        bricks_to_bring_offline['hot_tier_bricks'] = hot_tier_bricks -        bricks_to_bring_offline['cold_tier_bricks'] = cold_tier_bricks -    return bricks_to_bring_offline - - -def select_hot_tier_bricks_to_bring_offline(mnode, volname): -    """Randomly selects bricks to bring offline without affecting the cluster -    from a hot tier. - -    Args: -        mnode (str): Node on which commands will be executed. -        volname (str): Name of the volume. - -    Returns: -        list: On success returns list of bricks that can be brough offline -            from hot tier. If volume doesn't exist or is a non tiered volume -            returns empty list. -    """ -    hot_tier_bricks_to_bring_offline = [] - -    # Check if volume is tiered -    if not is_tiered_volume(mnode, volname): -        return hot_tier_bricks_to_bring_offline - -    # get volume type -    volume_type_info = get_volume_type_info(mnode, volname) -    hot_tier_type = volume_type_info['hot_tier_type_info']['hotBrickType'] - -    # get subvols -    subvols_dict = get_subvols(mnode, volname) -    hot_tier_subvols = subvols_dict['hot_tier_subvols'] - -    # select bricks from distribute volume -    if hot_tier_type == 'Distribute': -        hot_tier_bricks_to_bring_offline = [] - -    # select bricks from replicated, distributed-replicated volume -    if (hot_tier_type == 'Replicate' or -            hot_tier_type == 'Distributed-Replicate'): -        # Get replica count -        hot_tier_replica_count = (volume_type_info -                                  ['hot_tier_type_info']['hotreplicaCount']) - -        # Get quorum info -        quorum_info = get_client_quorum_info(mnode, volname) -        hot_tier_quorum_info = quorum_info['hot_tier_quorum_info'] - -        # Get list of bricks to bring offline -        hot_tier_bricks_to_bring_offline = ( -            get_bricks_to_bring_offline_from_replicated_volume( -                hot_tier_subvols, hot_tier_replica_count, -                hot_tier_quorum_info)) - -    return hot_tier_bricks_to_bring_offline - - -def select_cold_tier_bricks_to_bring_offline(mnode, volname): -    """Randomly selects bricks to bring offline without affecting the cluster -    from a cold tier. - -    Args: -        mnode (str): Node on which commands will be executed. -        volname (str): Name of the volume. - -    Returns: -        list: On success returns list of bricks that can be brough offline -            from cold tier. If volume doesn't exist or is a non tiered volume -            returns empty list. -    """ -    cold_tier_bricks_to_bring_offline = [] - -    # Check if volume is tiered -    if not is_tiered_volume(mnode, volname): -        return cold_tier_bricks_to_bring_offline - -    # get volume type -    volume_type_info = get_volume_type_info(mnode, volname) -    cold_tier_type = volume_type_info['cold_tier_type_info']['coldBrickType'] - -    # get subvols -    subvols_dict = get_subvols(mnode, volname) -    cold_tier_subvols = subvols_dict['cold_tier_subvols'] - -    # select bricks from distribute volume -    if cold_tier_type == 'Distribute': -        cold_tier_bricks_to_bring_offline = [] - -    # select bricks from replicated, distributed-replicated volume -    elif (cold_tier_type == 'Replicate' or -          cold_tier_type == 'Distributed-Replicate'): -        # Get replica count -        cold_tier_replica_count = (volume_type_info['cold_tier_type_info'] -                                   ['coldreplicaCount']) - -        # Get quorum info -        quorum_info = get_client_quorum_info(mnode, volname) -        cold_tier_quorum_info = quorum_info['cold_tier_quorum_info'] - -        # Get list of bricks to bring offline -        cold_tier_bricks_to_bring_offline = ( -            get_bricks_to_bring_offline_from_replicated_volume( -                cold_tier_subvols, cold_tier_replica_count, -                cold_tier_quorum_info)) - -    # select bricks from Disperse, Distribured-Disperse volume -    elif (cold_tier_type == 'Disperse' or -          cold_tier_type == 'Distributed-Disperse'): - -        # Get redundancy count -        cold_tier_redundancy_count = (volume_type_info['cold_tier_type_info'] -                                      ['coldredundancyCount']) - -        # Get list of bricks to bring offline -        cold_tier_bricks_to_bring_offline = ( -            get_bricks_to_bring_offline_from_disperse_volume( -                cold_tier_subvols, cold_tier_redundancy_count)) - -    return cold_tier_bricks_to_bring_offline - -  def get_bricks_to_bring_offline_from_replicated_volume(subvols_list,                                                         replica_count,                                                         quorum_info): @@ -762,13 +494,10 @@ def get_bricks_to_bring_offline_from_replicated_volume(subvols_list,          for a replicated volume.      Args: -        subvols_list: list of subvols. It can be volume_subvols, -            hot_tier_subvols or cold_tier_subvols. +        subvols_list: list of subvols.              For example:                  subvols = volume_libs.get_subvols(mnode, volname)                  volume_subvols = subvols_dict['volume_subvols'] -                hot_tier_subvols = subvols_dict['hot_tier_subvols'] -                cold_tier_subvols = subvols_dict['cold_tier_subvols']          replica_count: Replica count of a Replicate or Distributed-Replicate              volume.          quorum_info: dict containing quorum info of the volume. The dict should @@ -777,8 +506,6 @@ def get_bricks_to_bring_offline_from_replicated_volume(subvols_list,              For example:                  quorum_dict = get_client_quorum_info(mnode, volname)                  volume_quorum_info = quorum_info['volume_quorum_info'] -                hot_tier_quorum_info = quorum_info['hot_tier_quorum_info'] -                cold_tier_quorum_info = quorum_info['cold_tier_quorum_info']      Returns:          list: List of bricks that can be brought offline without affecting the @@ -836,18 +563,15 @@ def get_bricks_to_bring_offline_from_disperse_volume(subvols_list,          for a disperse volume.      Args: -        subvols_list: list of subvols. It can be volume_subvols, -            hot_tier_subvols or cold_tier_subvols. +        subvols_list: list of subvols.              For example:                  subvols = volume_libs.get_subvols(mnode, volname)                  volume_subvols = subvols_dict['volume_subvols'] -                hot_tier_subvols = subvols_dict['hot_tier_subvols'] -                cold_tier_subvols = subvols_dict['cold_tier_subvols']          redundancy_count: Redundancy count of a Disperse or              Distributed-Disperse volume.      Returns: -        list: List of bricks that can be brought offline without affecting  the +        list: List of bricks that can be brought offline without affecting the              cluster.On any failure return empty list.      """      list_of_bricks_to_bring_offline = [] diff --git a/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py b/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py index 4a66db99b..aa6aca669 100644 --- a/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py +++ b/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py @@ -330,7 +330,7 @@ class GlusterBaseClass(TestCase):      def setup_volume(cls, volume_create_force=False, only_volume_create=False):          """Setup the volume:              - Create the volume, Start volume, Set volume -            options, enable snapshot/quota/tier if specified in the config +            options, enable snapshot/quota if specified in the config              file.              - Wait for volume processes to be online              - Export volume as NFS/SMB share if mount_type is NFS or SMB diff --git a/glustolibs-gluster/glustolibs/gluster/tiering_ops.py b/glustolibs-gluster/glustolibs/gluster/tiering_ops.py deleted file mode 100644 index 357b3d471..000000000 --- a/glustolibs-gluster/glustolibs/gluster/tiering_ops.py +++ /dev/null @@ -1,1023 +0,0 @@ -#!/usr/bin/env python -#  Copyright (C) 2015-2016  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 -#  the Free Software Foundation; either version 2 of the License, or -#  any later version. -# -#  This program is distributed in the hope that it will be useful, -#  but WITHOUT ANY WARRANTY; without even the implied warranty of -#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -#  GNU General Public License for more details. -# -#  You should have received a copy of the GNU General Public License along -#  with this program; if not, write to the Free Software Foundation, Inc., -#  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -""" -    Description: Library for gluster tiering operations. -""" - -import re -import time -from glusto.core import Glusto as g -from glustolibs.gluster.peer_ops import peer_probe_servers -from glustolibs.gluster.gluster_init import start_glusterd -from glustolibs.gluster.lib_utils import list_files - -try: -    import xml.etree.cElementTree as etree -except ImportError: -    import xml.etree.ElementTree as etree - - -def add_extra_servers_to_cluster(mnode, extra_servers): -    """Adds the given extra servers to cluster - -    Args: -        mnode (str): Node on which cmd has to be executed. -        extra_servers (str|list) : A server|list of extra servers to be -            attached to cluster - -    Returns: -        bool: True, if extra servers are attached to cluster -              False, otherwise - -    Example: -        add_extra_servers_to_cluster("abc.com", ['peer_node1','peer_node2']) -    """ - -    if not isinstance(extra_servers, list): -        extra_servers = [extra_servers] - -    ret = start_glusterd(servers=extra_servers) -    if not ret: -        g.log.error("glusterd did not start in peer nodes") -        return False - -    ret = peer_probe_servers(mnode, servers=extra_servers) -    if not ret: -        g.log.error("Unable to do peer probe on extra server machines") -        return False - -    return True - - -def tier_attach(mnode, volname, num_bricks_to_add, extra_servers, -                extra_servers_info, replica=1, force=False): -    """Attaches tier to the volume - -    Args: -        mnode (str): Node on which cmd has to be executed. -        volname (str): volume name -        num_bricks_to_add (str): number of bricks to be added as hot tier -        extra_servers (str|list): from this server|these servers, -            hot tier will be added to volume -        extra_servers_info (dict): dict of server info of each extra servers - -    Kwargs: -        replica (str): replica count of the hot tier -        force (bool): If this option is set to True, then attach tier -            will get executed with force option. If it is set to False, -            then attach tier will get executed without force option - -    Returns: -        tuple: Tuple containing three elements (ret, out, err). -            The first element 'ret' is of type 'int' and is the return value -            of command execution. - -            The second element 'out' is of type 'str' and is the stdout value -            of the command execution. - -            The third element 'err' is of type 'str' and is the stderr value -            of the command execution. - -    Example: -        tier_attach("abc.com", testvol, '2', ['extra_server1','extra_server2'], -                    extra_server_info) -    """ -    if not isinstance(extra_servers, list): -        extra_servers = [extra_servers] - -    replica = int(replica) -    repc = '' -    if replica != 1: -        repc = "replica %d" % replica - -    frce = '' -    if force: -        frce = 'force' - -    num_bricks_to_add = int(num_bricks_to_add) - -    from glustolibs.gluster.lib_utils import form_bricks_list -    bricks_list = form_bricks_list(mnode, volname, num_bricks_to_add, -                                   extra_servers[:], extra_servers_info) -    if bricks_list is None: -        g.log.error("number of bricks required are greater than " -                    "unused bricks") -        return (-1, '', '') - -    bricks_path = ' '.join(bricks_list) -    bricks_path = [re.sub(r"(.*\/\S+\_)brick(\d+)", r"\1tier\2", item) -                   for item in bricks_path.split() if item] -    tier_bricks_path = " ".join(bricks_path) -    cmd = ("gluster volume tier %s attach %s %s %s --mode=script" -           % (volname, repc, tier_bricks_path, frce)) - -    return g.run(mnode, cmd) - - -def tier_start(mnode, volname, force=False): -    """Starts the tier volume - -    Args: -        mnode (str): Node on which cmd has to be executed. -        volname (str): volume name - -    Kwargs: -        force (bool): If this option is set to True, then attach tier -            will get executed with force option. If it is set to False, -            then attach tier will get executed without force option -    Returns: -        tuple: Tuple containing three elements (ret, out, err). -            The first element 'ret' is of type 'int' and is the return value -            of command execution. - -            The second element 'out' is of type 'str' and is the stdout value -            of the command execution. - -            The third element 'err' is of type 'str' and is the stderr value -            of the command execution. - -    Example: -        tier_start("abc.com", testvol) -    """ - -    frce = '' -    if force: -        frce = 'force' - -    cmd = ("gluster volume tier %s start %s --mode=script" -           % (volname, frce)) -    return g.run(mnode, cmd) - - -def tier_status(mnode, volname): -    """executes tier status command - -    Args: -        mnode (str): Node on which cmd has to be executed. -        volname (str): volume name - -    Returns: -        tuple: Tuple containing three elements (ret, out, err). -            The first element 'ret' is of type 'int' and is the return value -            of command execution. - -            The second element 'out' is of type 'str' and is the stdout value -            of the command execution. - -            The third element 'err' is of type 'str' and is the stderr value -            of the command execution. - -    Example: -        tier_status("abc.com", testvol) -    """ - -    cmd = "gluster volume tier %s status" % volname -    ret = g.run(mnode, cmd) - -    return ret - - -def get_tier_status(mnode, volname): -    """Parse the output of 'gluster tier status' command. - -    Args: -        mnode (str): Node on which command has to be executed. -        volname (str): volume name - -    Returns: -        NoneType: None if command execution fails, parse errors. -        dict: dict on success. - -    Examples: -        >>> get_tier_status('abc.lab.eng.xyz.com', 'testvol') -        {'node': [{'promotedFiles': '0', 'demotedFiles': '0', 'nodeName': -        'localhost', 'statusStr': 'in progress'}, {'promotedFiles': '0', -        'demotedFiles': '0', 'nodeName': '10.70.47.16', 'statusStr': -        'in progress'}], 'task-id': '2ed28cbd-4246-493a-87b8-1fdcce313b34', -        'nodeCount': '4', 'op': '7'} -    """ - -    cmd = "gluster volume tier %s status --xml" % volname -    ret, out, _ = g.run(mnode, cmd) -    if ret != 0: -        g.log.error("Failed to execute 'tier status' on node %s. " -                    "Hence failed to get tier status.", mnode) -        return None - -    try: -        root = etree.XML(out) -    except etree.ParseError: -        g.log.error("Failed to parse the gluster tier status xml output.") -        return None - -    tier_status = {} -    tier_status["node"] = [] -    for info in root.findall("volRebalance"): -        for element in info.getchildren(): -            if element.tag == "node": -                status_info = {} -                for elmt in element.getchildren(): -                    status_info[elmt.tag] = elmt.text -                tier_status[element.tag].append(status_info) -            else: -                tier_status[element.tag] = element.text -    return tier_status - - -def tier_detach_start(mnode, volname): -    """starts detaching tier on given volume - -    Args: -        mnode (str): Node on which cmd has to be executed. -        volname (str): volume name - -    Returns: -        tuple: Tuple containing three elements (ret, out, err). -            The first element 'ret' is of type 'int' and is the return value -            of command execution. - -            The second element 'out' is of type 'str' and is the stdout value -            of the command execution. - -            The third element 'err' is of type 'str' and is the stderr value -            of the command execution. - -    Example: -        tier_detach_start("abc.com", testvol) - -    """ - -    cmd = "gluster volume tier %s detach start --mode=script" % volname -    return g.run(mnode, cmd) - - -def tier_detach_status(mnode, volname): -    """executes detach tier status on given volume - -    Args: -        mnode (str): Node on which cmd has to be executed. -        volname (str): volume name - -    Returns: -        tuple: Tuple containing three elements (ret, out, err). -            The first element 'ret' is of type 'int' and is the return value -            of command execution. - -            The second element 'out' is of type 'str' and is the stdout value -            of the command execution. - -            The third element 'err' is of type 'str' and is the stderr value -            of the command execution. - -    Example: -        tier_detach_status("abc.com", testvol) - -    """ - -    cmd = "gluster volume tier %s detach status --mode=script" % volname -    return g.run(mnode, cmd) - - -def tier_detach_stop(mnode, volname): -    """stops detaching tier on given volume - -    Args: -        mnode (str): Node on which cmd has to be executed. -        volname (str): volume name - -    Returns: -        tuple: Tuple containing three elements (ret, out, err). -            The first element 'ret' is of type 'int' and is the return value -            of command execution. - -            The second element 'out' is of type 'str' and is the stdout value -            of the command execution. - -            The third element 'err' is of type 'str' and is the stderr value -            of the command execution. - -    Example: -        tier_detach_stop("abc.com", testvol) - -    """ - -    cmd = "gluster volume tier %s detach stop --mode=script" % volname -    return g.run(mnode, cmd) - - -def tier_detach_commit(mnode, volname): -    """commits detach tier on given volume - -    Args: -        mnode (str): Node on which cmd has to be executed. -        volname (str): volume name - -    Returns: -        tuple: Tuple containing three elements (ret, out, err). -            The first element 'ret' is of type 'int' and is the return value -            of command execution. - -            The second element 'out' is of type 'str' and is the stdout value -            of the command execution. - -            The third element 'err' is of type 'str' and is the stderr value -            of the command execution. - -    Example: -        tier_detach_commit("abc.com", testvol) - -    """ - -    cmd = "gluster volume tier %s detach commit --mode=script" % volname -    return g.run(mnode, cmd) - - -def tier_detach_force(mnode, volname): -    """detaches tier forcefully on given volume - -    Args: -        mnode (str): Node on which cmd has to be executed. -        volname (str): volume name - -    Returns: -        tuple: Tuple containing three elements (ret, out, err). -            The first element 'ret' is of type 'int' and is the return value -            of command execution. - -            The second element 'out' is of type 'str' and is the stdout value -            of the command execution. - -            The third element 'err' is of type 'str' and is the stderr value -            of the command execution. - -    Example: -        tier_detach_force("abc.com", testvol) - -    """ - -    cmd = "gluster volume tier %s detach force --mode=script" % volname -    return g.run(mnode, cmd) - - -def get_detach_tier_status(mnode, volname): -    """Parse the output of 'gluster volume tier detach status' command. - -    Args: -        mnode (str): Node on which command has to be executed. -        volname (str): volume name - -    Returns: -        NoneType: None if command execution fails, parse errors. -        dict: dict on success. - -    Examples: -        >>> get_detach_tier_status('abc.lab.eng.xyz.com', "testvol") -        {'node': [{'files': '0', 'status': '3', 'lookups': '1', 'skipped': '0', -        'nodeName': 'localhost', 'failures': '0', 'runtime': '0.00', 'id': -        '11336017-9561-4e88-9ac3-a94d4b403340', 'statusStr': 'completed', -        'size': '0'}, {'files': '0', 'status': '3', 'lookups': '0', 'skipped': -        '0', 'nodeName': '10.70.47.16', 'failures': '0', 'runtime': '0.00', -        'id': 'a2b88b10-eba2-4f97-add2-8dc37df08b27', 'statusStr': 'completed', -        'size': '0'}], 'nodeCount': '4', 'aggregate': {'files': '0', 'status': -        '3', 'lookups': '1', 'skipped': '0', 'failures': '0', 'runtime': '0.0', -        'statusStr': 'completed', 'size': '0'}} -    """ - -    cmd = "gluster volume tier %s detach status --xml" % volname -    ret, out, _ = g.run(mnode, cmd) -    if ret != 0: -        g.log.error("Failed to execute 'detach tier status' on node %s. " -                    "Hence failed to get detach tier status.", mnode) -        return None - -    try: -        root = etree.XML(out) -    except etree.ParseError: -        g.log.error("Failed to parse the detach tier status xml output.") -        return None - -    tier_status = {} -    tier_status["node"] = [] -    for info in root.findall("volDetachTier"): -        for element in info.getchildren(): -            if element.tag == "node": -                status_info = {} -                for elmt in element.getchildren(): -                    status_info[elmt.tag] = elmt.text -                tier_status[element.tag].append(status_info) -            elif element.tag == "aggregate": -                status_info = {} -                for elmt in element.getchildren(): -                    status_info[elmt.tag] = elmt.text -                tier_status[element.tag] = status_info -            else: -                tier_status[element.tag] = element.text -    return tier_status - - -def tier_detach_start_and_get_taskid(mnode, volname): -    """Parse the output of 'gluster volume tier detach start' command. - -    Args: -        mnode (str): Node on which command has to be executed. -        volname (str): volume name - -    Returns: -        NoneType: None if command execution fails, parse errors. -        dict: dict on success. - -    Examples: -        >>> tier_detach_start_and_get_taskid('abc.lab.eng.xyz.com', -                                             "testvol") -        {'task-id': '8020835c-ff0d-4ea1-9f07-62dd067e92d4'} -    """ - -    cmd = "gluster volume tier %s detach start --xml" % volname -    ret, out, _ = g.run(mnode, cmd) -    if ret != 0: -        g.log.error("Failed to execute 'detach tier start' on node %s. " -                    "Hence failed to parse the detach tier start.", mnode) -        return None - -    try: -        root = etree.XML(out) -    except etree.ParseError: -        g.log.error("Failed to parse the gluster detach tier " -                    "start xml output.") -        return None - -    tier_status = {} -    for info in root.findall("volDetachTier"): -        for element in info.getchildren(): -            tier_status[element.tag] = element.text -    return tier_status - - -def tier_detach_stop_and_get_status(mnode, volname): -    """Parse the output of 'gluster volume tier detach stop' command. - -    Args: -        mnode (str): Node on which command has to be executed. -        volname (str): volume name - -    Returns: -        NoneType: None if command execution fails, parse errors. -        dict: dict on success. - -    Examples: -        >>> tier_detach_stop_and_get_status('abc.lab.eng.xyz.com', -                                            "testvol") -        {'node': [{'files': '0', 'status': '3', 'lookups': '1', 'skipped': '0', -        'nodeName': 'localhost', 'failures': '0', 'runtime': '0.00', 'id': -        '11336017-9561-4e88-9ac3-a94d4b403340', 'statusStr': 'completed', -        'size': '0'}, {'files': '0', 'status': '3', 'lookups': '0', 'skipped': -        '0', 'nodeName': '10.70.47.16', 'failures': '0', 'runtime': '0.00', -        'id': 'a2b88b12-eba2-4f97-add2-8dc37df08b27', 'statusStr': 'completed', -        'size': '0'}], 'nodeCount': '4', 'aggregate': {'files': '0', 'status': -        '3', 'lookups': '1', 'skipped': '0', 'failures': '0', 'runtime': '0.0', -        'statusStr': 'completed', 'size': '0'}} -    """ - -    cmd = "gluster volume tier %s detach stop --xml" % volname -    ret, out, _ = g.run(mnode, cmd) -    if ret != 0: -        g.log.error("Failed to execute 'tier start' on node %s. " -                    "Hence failed to parse the tier start.", mnode) -        return None - -    try: -        root = etree.XML(out) -    except etree.ParseError: -        g.log.error("Failed to parse the gluster detach tier stop" -                    " xml output.") -        return None - -    tier_status = {} -    tier_status["node"] = [] -    for info in root.findall("volDetachTier"): -        for element in info.getchildren(): -            if element.tag == "node": -                status_info = {} -                for elmt in element.getchildren(): -                    status_info[elmt.tag] = elmt.text -                tier_status[element.tag].append(status_info) -            elif element.tag == "aggregate": -                status_info = {} -                for elmt in element.getchildren(): -                    status_info[elmt.tag] = elmt.text -                tier_status[element.tag] = status_info -            else: -                tier_status[element.tag] = element.text -    return tier_status - - -def wait_for_detach_tier_to_complete(mnode, volname, timeout=300): -    """Waits for the detach tier to complete - -    Args: -        mnode (str): Node on which command has to be executed. -        volname (str): volume name - -    Kwargs: -        timeout (int): timeout value to wait for detach tier to complete - -    Returns: -        True on success, False otherwise - -    Examples: -        >>> wait_for_detach_tier_to_complete(mnode, "testvol") -    """ - -    count = 0 -    flag = 0 -    while (count < timeout): -        status_info = get_detach_tier_status(mnode, volname) -        if status_info is None: -            return False - -        status = status_info['aggregate']['statusStr'] -        if status == 'completed': -            flag = 1 -            break - -        time.sleep(10) -        count = count + 10 -    if not flag: -        g.log.error("detach tier is not completed") -        return False -    else: -        g.log.info("detach tier is successfully completed") -    return True - - -def get_files_from_hot_tier(mnode, volname): -    """Lists files from hot tier for the given volume - -    Args: -        mnode (str): Node on which command has to be executed. -        volname (str): volume name - -    Returns: -        Emptylist: if there are no files in hot tier. -        list: list of files in hot tier on success. - -    Examples: -        >>>get_files_from_hot_tier(mnode, "testvol") -    """ - -    files = [] -    from glustolibs.gluster.volume_libs import get_subvols -    subvols = get_subvols(mnode, volname) -    for subvol in subvols['hot_tier_subvols']: -        info = subvol[0].split(':') -        file_list = list_files(info[0], info[1]) -        for file in file_list: -            if ".glusterfs" not in file: -                files.append(file) - -    return files - - -def get_files_from_cold_tier(mnode, volname): -    """Lists files from cold tier for the given volume - -    Args: -        mnode (str): Node on which command has to be executed. -        volname (str): volume name - -    Returns: -        Emptylist: if there are no files in cold tier. -        list: list of files in cold tier on success. - -    Examples: -        >>>get_files_from_hot_tier("testvol") -    """ - -    files = [] -    from glustolibs.gluster.volume_libs import get_subvols -    subvols = get_subvols(mnode, volname) -    for subvol in subvols['cold_tier_subvols']: -        info = subvol[0].split(':') -        file_list = list_files(info[0], info[1]) -        for file in file_list: -            if ".glusterfs" not in file: -                files.append(file) - -    return files - - -def get_tier_promote_frequency(mnode, volname): -    """Gets tier promote frequency value for given volume. - -    Args: -        mnode (str): Node on which command has to be executed. -        volname (str): volume name - -    Returns: -        NoneType: None if command execution fails, parse errors. -        str: promote frequency value on success. - -    Examples: -        >>>get_tier_promote_frequency("abc.com", "testvol") -    """ - -    from glustolibs.gluster.volume_ops import get_volume_options -    vol_options = get_volume_options(mnode, volname) -    if vol_options is None: -        g.log.error("Failed to get volume options") -        return None - -    return vol_options['cluster.tier-promote-frequency'] - - -def get_tier_demote_frequency(mnode, volname): -    """Gets tier demote frequency value for given volume. - -    Args: -        mnode (str): Node on which command has to be executed. -        volname (str): volume name - -    Returns: -        NoneType: None if command execution fails, parse errors. -        str: demote frequency value on success. - -    Examples: -        >>>get_tier_demote_frequency("abc.com", "testvol") -    """ - -    from glustolibs.gluster.volume_ops import get_volume_options -    vol_options = get_volume_options(mnode, volname) -    if vol_options is None: -        g.log.error("Failed to get volume options") -        return None - -    return vol_options['cluster.tier-demote-frequency'] - - -def get_tier_mode(mnode, volname): -    """Gets tier mode for given volume. - -    Args: -        mnode (str): Node on which command has to be executed. -        volname (str): volume name - -    Returns: -        NoneType: None if command execution fails, parse errors. -        str: tier mode on success. - -    Examples: -        >>>get_tier_mode("testvol") -    """ - -    from glustolibs.gluster.volume_ops import get_volume_options -    vol_options = get_volume_options(mnode, volname) -    if vol_options is None: -        g.log.error("Failed to get volume options") -        return None - -    return vol_options['cluster.tier-mode'] - - -def get_tier_max_mb(mnode, volname): -    """Gets tier max mb for given volume. - -    Args: -        mnode (str): Node on which command has to be executed. -        volname (str): volume name - -    Returns: -        NoneType: None if command execution fails, parse errors. -        str: tier max mb on success. - -    Examples: -        >>>get_tier_max_mb("abc.com", "testvol") -    """ - -    from glustolibs.gluster.volume_ops import get_volume_options -    vol_options = get_volume_options(mnode, volname) -    if vol_options is None: -        g.log.error("Failed to get volume options") -        return None - -    return vol_options['cluster.tier-max-mb'] - - -def get_tier_max_files(mnode, volname): -    """Gets tier max files for given volume. - -    Args: -        mnode (str): Node on which command has to be executed. -        volname (str): volume name - -    Returns: -        NoneType: None if command execution fails, parse errors. -        str: tier max files on success. - -    Examples: -        >>>get_tier_max_files("abc.com", "testvol") -    """ - -    from glustolibs.gluster.volume_ops import get_volume_options -    vol_options = get_volume_options(mnode, volname) -    if vol_options is None: -        g.log.error("Failed to get volume options") -        return None - -    return vol_options['cluster.tier-max-files'] - - -def get_tier_watermark_high_limit(mnode, volname): -    """Gets tier watermark high limit for given volume. - -    Args: -        mnode (str): Node on which command has to be executed. -        volname (str): volume name - -    Returns: -        NoneType: None if command execution fails, parse errors. -        str: tier watermark high limit on success. - -    Examples: -        >>>get_tier_watermark_high_limit(mnode, "testvol") -    """ - -    from glustolibs.gluster.volume_ops import get_volume_options -    vol_options = get_volume_options(mnode, volname) -    if vol_options is None: -        g.log.error("Failed to get volume options") -        return None - -    return vol_options['cluster.watermark-hi'] - - -def get_tier_watermark_low_limit(mnode, volname): -    """Gets tier watermark low limit for given volume. - -    Args: -        mnode (str): Node on which command has to be executed. -        volname (str): volume name - -    Returns: -        NoneType: None if command execution fails, parse errors. -        str: tier watermark low limit on success. - -    Examples: -        >>>get_tier_watermark_low_limit("abc.com", "testvol") -    """ - -    from glustolibs.gluster.volume_ops import get_volume_options -    vol_options = get_volume_options(mnode, volname) -    if vol_options is None: -        g.log.error("Failed to get volume options") -        return None - -    return vol_options['cluster.watermark-low'] - - -def set_tier_promote_frequency(mnode, volname, value): -    """Sets tier promote frequency value for given volume. - -    Args: -        mnode (str): Node on which command has to be executed. -        volname (str): volume name -        value (str): promote frequency value - -    Returns: -        bool: True on success, False Otherwise - -    Examples: -        >>>set_tier_promote_frequency("abc.com", "testvol", '1000') -    """ - -    option = {'cluster.tier-promote-frequency': value} - -    from glustolibs.gluster.volume_ops import set_volume_options -    if not set_volume_options(mnode, volname, -                              options=option): -        g.log.error("Failed to set promote frequency to %s" -                    % value) -        return False - -    return True - - -def set_tier_demote_frequency(mnode, volname, value): -    """Sets tier demote frequency value for given volume. - -    Args: -        mnode (str): Node on which command has to be executed. -        volname (str): volume name -        value (str): demote frequency value - -    Returns: -        bool: True on success, False Otherwise - -    Examples: -        >>>set_tier_demote_frequency("abc.com", "testvol", "500") -    """ - -    option = {'cluster.tier-demote-frequency': value} - -    from glustolibs.gluster.volume_ops import set_volume_options -    if not set_volume_options(mnode, volname, -                              options=option): -        g.log.error("Failed to set demote frequency to %s" -                    % value) -        return False - -    return True - - -def set_tier_mode(mnode, volname, value): -    """Sets tier mode for given volume. - -    Args: -        mnode (str): Node on which command has to be executed. -        volname (str): volume name -        value (str): tier mode value - -    Returns: -        bool: True on success, False Otherwise - -    Examples: -        >>>set_tier_mode("abc.com", "testvol", "cache") -    """ - -    option = {'cluster.tier-mode': value} - -    from glustolibs.gluster.volume_ops import set_volume_options -    if not set_volume_options(mnode, volname, -                              options=option): -        g.log.error("Failed to set tier mode to %s" -                    % value) -        return False - -    return True - - -def set_tier_max_mb(mnode, volname, value): -    """Sets tier max mb for given volume. - -    Args: -        mnode (str): Node on which command has to be executed. -        volname (str): volume name -        value (str): tier mode value - -    Returns: -        bool: True on success, False Otherwise - -    Examples: -        >>>set_tier_max_mb("abc.com", "testvol", "50") -    """ - -    option = {'cluster.tier-max-mb': value} - -    from glustolibs.gluster.volume_ops import set_volume_options -    if not set_volume_options(mnode, volname, -                              options=option): -        g.log.error("Failed to set tier max mb to %s" -                    % value) -        return False - -    return True - - -def set_tier_max_files(mnode, volname, value): -    """Sets tier max files for given volume. - -    Args: -        mnode (str): Node on which command has to be executed. -        volname (str): volume name -        value (str): tier mode value - -    Returns: -        bool: True on success, False Otherwise - -    Examples: -        >>>set_tier_max_files("abc.com", "testvol", "10") -    """ - -    option = {'cluster.tier-max-files': value} - -    from glustolibs.gluster.volume_ops import set_volume_options -    if not set_volume_options(mnode, volname, -                              options=option): -        g.log.error("Failed to set tier max files to %s" -                    % value) -        return False - -    return True - - -def set_tier_watermark_high_limit(mnode, volname, value): -    """Sets tier watermark high limit for given volume. - -    Args: -        mnode (str): Node on which command has to be executed. -        volname (str): volume name -        value (str): tier mode value - -    Returns: -        bool: True on success, False Otherwise - -    Examples: -        >>>set_tier_watermark_high_limit("abc.com", "testvol", "95") -    """ - -    option = {'cluster.watermark-hi': value} - -    from glustolibs.gluster.volume_ops import set_volume_options -    if not set_volume_options(mnode, volname, -                              options=option): -        g.log.error("Failed to set tier watermark high limit to %s" -                    % value) -        return False - -    return True - - -def set_tier_watermark_low_limit(mnode, volname, value): -    """Sets tier watermark low limit for given volume. - -    Args: -        mnode (str): Node on which command has to be executed. -        volname (str): volume name -        value (str): tier mode value - -    Returns: -        bool: True on success, False Otherwise - -    Examples: -        >>>set_tier_watermark_low_limit("abc.com", "testvol", "40") -    """ - -    option = {'cluster.watermark-low': value} - -    from glustolibs.gluster.volume_ops import set_volume_options -    if not set_volume_options(mnode, volname, -                              options=option): -        g.log.error("Failed to set tier watermark low limit to %s" -                    % value) -        return False - -    return True - - -def get_tier_pid(mnode, volname): -    """Gets tier pid for given volume. - -    Args: -        mnode (str): Node on which command has to be executed. -        volname (str): volume name - -    Returns: -        NoneType: None if command execution fails, parse errors. -        str: pid of tier process on success. - -    Examples: -        >>>get_tier_pid("abc.xyz.com", "testvol") -    """ - -    cmd = ("ps -ef | grep -v grep | grep '/var/log/glusterfs/%s-tier.log' |" -           "awk '{print $2}'" % volname) -    ret, out, err = g.run(mnode, cmd) -    if ret != 0: -        g.log.error("Failed to execute 'ps' cmd") -        return None - -    return out.strip("\n") - - -def is_tier_process_running(mnode, volname): -    """Checks whether tier process is running - -    Args: -        mnode (str): Node on which command has to be executed. -        volname (str): volume name - -    Returns: -        True on success, False otherwise - -    Examples: -        >>>is_tier_process_running("abc.xyz.com", "testvol") -    """ - -    pid = get_tier_pid(mnode, volname) -    if pid == '': -        return False -    return True diff --git a/glustolibs-gluster/glustolibs/gluster/volume_libs.py b/glustolibs-gluster/glustolibs/gluster/volume_libs.py index 272a11570..0505edfce 100644 --- a/glustolibs-gluster/glustolibs/gluster/volume_libs.py +++ b/glustolibs-gluster/glustolibs/gluster/volume_libs.py @@ -31,9 +31,6 @@ from glustolibs.gluster.volume_ops import (volume_create, volume_start,                                             volume_info, volume_status,                                             get_volume_options,                                             get_volume_list) -from glustolibs.gluster.tiering_ops import (add_extra_servers_to_cluster, -                                            tier_attach, -                                            is_tier_process_running)  from glustolibs.gluster.quota_ops import (quota_enable, quota_limit_usage,                                            is_quota_enabled)  from glustolibs.gluster.uss_ops import enable_uss, is_uss_enabled @@ -101,11 +98,6 @@ def setup_volume(mnode, all_servers_info, volume_config, multi_vol=False,                                            'size': '100GB'},                            'enable': False},                  'uss': {'enable': False}, -                'tier': {'create_tier': True, -                         'tier_type': {'type': 'distributed-replicated', -                                  'replica_count': 2, -                                  'dist_count': 2, -                                  'transport': 'tcp'}},                  'options': {'performance.readdir-ahead': True}                  }      Kwargs: @@ -323,68 +315,6 @@ def setup_volume(mnode, all_servers_info, volume_config, multi_vol=False,          g.log.error("volume start %s failed", volname)          return False -    # Create Tier volume -    if ('tier' in volume_config and 'create_tier' in volume_config['tier'] and -            volume_config['tier']['create_tier']): -        # get servers info for tier attach -        if ('extra_servers' in volume_config and -                volume_config['extra_servers']): -            extra_servers = volume_config['extra_servers'] -            ret = add_extra_servers_to_cluster(mnode, extra_servers) -            if not ret: -                return False -        else: -            extra_servers = volume_config['servers'] - -        # get the tier volume type -        if 'tier_type' in volume_config['tier']: -            if 'type' in volume_config['tier']['tier_type']: -                tier_volume_type = volume_config['tier']['tier_type']['type'] -                dist = rep = 1 -                if tier_volume_type == 'distributed': -                    if 'dist_count' in volume_config['tier']['tier_type']: -                        dist = (volume_config['tier']['tier_type'] -                                ['dist_count']) - -                elif tier_volume_type == 'replicated': -                    if 'replica_count' in volume_config['tier']['tier_type']: -                        rep = (volume_config['tier']['tier_type'] -                               ['replica_count']) - -                elif tier_volume_type == 'distributed-replicated': -                    if 'dist_count' in volume_config['tier']['tier_type']: -                        dist = (volume_config['tier']['tier_type'] -                                ['dist_count']) -                    if 'replica_count' in volume_config['tier']['tier_type']: -                        rep = (volume_config['tier']['tier_type'] -                               ['replica_count']) -        else: -            tier_volume_type = 'distributed' -            dist = 1 -            rep = 1 -        number_of_bricks = dist * rep - -        # Attach Tier -        ret, _, _ = tier_attach(mnode=mnode, volname=volname, -                                extra_servers=extra_servers, -                                extra_servers_info=all_servers_info, -                                num_bricks_to_add=number_of_bricks, -                                replica=rep) -        if ret != 0: -            g.log.error("Unable to attach tier") -            return False - -        time.sleep(30) -        # Check if tier is running -        _rc = True -        for server in extra_servers: -            ret = is_tier_process_running(server, volname) -            if not ret: -                g.log.error("Tier process not running on %s", server) -                _rc = False -        if not _rc: -            return False -      # Enable Quota      if ('quota' in volume_config and 'enable' in volume_config['quota'] and              volume_config['quota']['enable']): @@ -646,77 +576,11 @@ def get_subvols(mnode, volname):          get_subvols("abc.xyz.com", "testvol")      """ -    subvols = { -        'is_tier': False, -        'hot_tier_subvols': [], -        'cold_tier_subvols': [], -        'volume_subvols': [] -        } +    subvols = {'volume_subvols': []} +      volinfo = get_volume_info(mnode, volname)      if volinfo is not None:          voltype = volinfo[volname]['typeStr'] -        if voltype == 'Tier': -            # Set is_tier to True -            subvols['is_tier'] = True - -            # Get hot tier subvols -            hot_tier_type = (volinfo[volname]["bricks"] -                             ['hotBricks']['hotBrickType']) -            tmp = volinfo[volname]["bricks"]['hotBricks']["brick"] -            hot_tier_bricks = [x["name"] for x in tmp if "name" in x] -            if hot_tier_type == 'Distribute': -                for brick in hot_tier_bricks: -                    subvols['hot_tier_subvols'].append([brick]) - -            elif (hot_tier_type == 'Replicate' or -                  hot_tier_type == 'Distributed-Replicate'): -                rep_count = int( -                    (volinfo[volname]["bricks"]['hotBricks'] -                     ['numberOfBricks']).split("=", 1)[0].split("x")[1].strip() -                    ) -                subvol_list = ( -                    [hot_tier_bricks[i:i + rep_count] -                     for i in range(0, len(hot_tier_bricks), rep_count)]) -                subvols['hot_tier_subvols'] = subvol_list - -            # Get cold tier subvols -            cold_tier_type = (volinfo[volname]["bricks"]['coldBricks'] -                              ['coldBrickType']) -            tmp = volinfo[volname]["bricks"]['coldBricks']["brick"] -            cold_tier_bricks = [x["name"] for x in tmp if "name" in x] - -            # Distribute volume -            if cold_tier_type == 'Distribute': -                for brick in cold_tier_bricks: -                    subvols['cold_tier_subvols'].append([brick]) - -            # Replicate or Distribute-Replicate volume -            elif (cold_tier_type == 'Replicate' or -                  cold_tier_type == 'Distributed-Replicate'): -                rep_count = int( -                    (volinfo[volname]["bricks"]['coldBricks'] -                     ['numberOfBricks']).split("=", 1)[0].split("x")[1].strip() -                    ) -                subvol_list = ( -                    [cold_tier_bricks[i:i + rep_count] -                     for i in range(0, len(cold_tier_bricks), rep_count)]) -                subvols['cold_tier_subvols'] = subvol_list - -            # Disperse or Distribute-Disperse volume -            elif (cold_tier_type == 'Disperse' or -                  cold_tier_type == 'Distributed-Disperse'): -                disp_count = sum( -                    [int(nums) for nums in ( -                        (volinfo[volname]["bricks"]['coldBricks'] -                         ['numberOfBricks']).split("x", 1)[1]. -                        strip().split("=")[0].strip().strip("()"). -                        split()) if nums.isdigit()]) -                subvol_list = [cold_tier_bricks[i:i + disp_count] -                               for i in range(0, len(cold_tier_bricks), -                                              disp_count)] -                subvols['cold_tier_subvols'] = subvol_list -            return subvols -          tmp = volinfo[volname]["bricks"]["brick"]          bricks = [x["name"] for x in tmp if "name" in x]          if voltype == 'Replicate' or voltype == 'Distributed-Replicate': @@ -737,29 +601,6 @@ def get_subvols(mnode, volname):      return subvols -def is_tiered_volume(mnode, volname): -    """Check if volume is tiered volume. - -    Args: -        mnode (str): Node on which commands are executed. -        volname (str): Name of the volume. - -    Returns: -        bool : True if the volume is tiered volume. False otherwise -        NoneType: None if volume does not exist. -    """ -    volinfo = get_volume_info(mnode, volname) -    if volinfo is None: -        g.log.error("Unable to get the volume info for volume %s", volname) -        return None - -    voltype = volinfo[volname]['typeStr'] -    if voltype == 'Tier': -        return True -    else: -        return False - -  def is_distribute_volume(mnode, volname):      """Check if volume is a plain distributed volume @@ -776,20 +617,10 @@ def is_distribute_volume(mnode, volname):          g.log.error("Unable to check if the volume %s is distribute", volname)          return False -    if volume_type_info['is_tier']: -        hot_tier_type = (volume_type_info['hot_tier_type_info'] -                         ['hotBrickType']) -        cold_tier_type = (volume_type_info['cold_tier_type_info'] -                          ['coldBrickType']) -        if hot_tier_type == 'Distribute' and cold_tier_type == 'Distribute': -            return True -        else: -            return False +    if volume_type_info['volume_type_info']['typeStr'] == 'Distribute': +        return True      else: -        if volume_type_info['volume_type_info']['typeStr'] == 'Distribute': -            return True -        else: -            return False +        return False  def get_volume_type_info(mnode, volname): @@ -803,9 +634,6 @@ def get_volume_type_info(mnode, volname):          dict : Dict containing the keys, values defining the volume type:              Example:                  volume_type_info = { -                    'is_tier': False, -                    'hot_tier_type_info': {}, -                    'cold_tier_type_info': {},                      'volume_type_info': {                          'typeStr': 'Disperse',                          'replicaCount': '1', @@ -817,18 +645,6 @@ def get_volume_type_info(mnode, volname):                      }                  volume_type_info = { -                    'is_tier': True, -                    'hot_tier_type_info': { -                        'hotBrickType': 'Distribute', -                        'hotreplicaCount': '1' -                        }, -                    'cold_tier_type_info': { -                        'coldBrickType': 'Disperse', -                        'coldreplicaCount': '1', -                        'coldarbiterCount': '0', -                        'colddisperseCount': '3', -                        'numberOfBricks':1 -                        },                      'volume_type_info': {} @@ -839,138 +655,26 @@ def get_volume_type_info(mnode, volname):          g.log.error("Unable to get the volume info for volume %s", volname)          return None -    volume_type_info = { -        'is_tier': False, -        'hot_tier_type_info': {}, -        'cold_tier_type_info': {}, -        'volume_type_info': {} -        } - -    voltype = volinfo[volname]['typeStr'] -    if voltype == 'Tier': -        volume_type_info['is_tier'] = True - -        hot_tier_type_info = get_hot_tier_type_info(mnode, volname) -        volume_type_info['hot_tier_type_info'] = hot_tier_type_info - -        cold_tier_type_info = get_cold_tier_type_info(mnode, volname) -        volume_type_info['cold_tier_type_info'] = cold_tier_type_info - -    else: -        non_tiered_volume_type_info = { -            'typeStr': '', -            'replicaCount': '', -            'arbiterCount': '', -            'stripeCount': '', -            'disperseCount': '', -            'redundancyCount': '' -            } -        for key in non_tiered_volume_type_info.keys(): -            if key in volinfo[volname]: -                non_tiered_volume_type_info[key] = volinfo[volname][key] -            else: -                g.log.error("Unable to find key '%s' in the volume info for " -                            "the volume %s", key, volname) -                non_tiered_volume_type_info[key] = None -        volume_type_info['volume_type_info'] = non_tiered_volume_type_info - -    return volume_type_info - - -def get_cold_tier_type_info(mnode, volname): -    """Returns cold tier type information for the specified volume. - -    Args: -        mnode (str): Node on which commands are executed. -        volname (str): Name of the volume. - -    Returns: -        dict : Dict containing the keys, values defining the cold tier type: -            Example: -                cold_tier_type_info = { -                    'coldBrickType': 'Disperse', -                    'coldreplicaCount': '1', -                    'coldarbiterCount': '0', -                    'colddisperseCount': '3', -                    'numberOfBricks': '3' -                    } -        NoneType: None if volume does not exist or is not a tiered volume or -            any other key errors. -    """ -    volinfo = get_volume_info(mnode, volname) -    if volinfo is None: -        g.log.error("Unable to get the volume info for volume %s", volname) -        return None - -    if not is_tiered_volume(mnode, volname): -        g.log.error("Volume %s is not a tiered volume", volname) -        return None - -    cold_tier_type_info = { -        'coldBrickType': '', -        'coldreplicaCount': '', -        'coldarbiterCount': '', -        'colddisperseCount': '', -        'numberOfBricks': '' -        } -    for key in cold_tier_type_info.keys(): -        if key in volinfo[volname]['bricks']['coldBricks']: -            cold_tier_type_info[key] = (volinfo[volname]['bricks'] -                                        ['coldBricks'][key]) +    volume_type_info = {'volume_type_info': {}} + +    all_volume_type_info = { +        'typeStr': '', +        'replicaCount': '', +        'arbiterCount': '', +        'stripeCount': '', +        'disperseCount': '', +        'redundancyCount': '' +    } +    for key in all_volume_type_info.keys(): +        if key in volinfo[volname]: +            all_volume_type_info[key] = volinfo[volname][key]          else: -            g.log.error("Unable to find key '%s' in the volume info for the " -                        "volume %s", key, volname) -            return None - -    if 'Disperse' in cold_tier_type_info['coldBrickType']: -        redundancy_count = (cold_tier_type_info['numberOfBricks']. -                            split("x", 1)[1].strip(). -                            split("=")[0].strip().strip("()").split()[2]) -        cold_tier_type_info['coldredundancyCount'] = redundancy_count +            g.log.error("Unable to find key '%s' in the volume info for " +                        "the volume %s", key, volname) +            all_volume_type_info[key] = None +    volume_type_info['volume_type_info'] = all_volume_type_info -    return cold_tier_type_info - - -def get_hot_tier_type_info(mnode, volname): -    """Returns hot tier type information for the specified volume. - -    Args: -        mnode (str): Node on which commands are executed. -        volname (str): Name of the volume. - -    Returns: -        dict : Dict containing the keys, values defining the hot tier type: -            Example: -                hot_tier_type_info = { -                    'hotBrickType': 'Distribute', -                    'hotreplicaCount': '1' -                    } -        NoneType: None if volume does not exist or is not a tiered volume or -            any other key errors. -    """ -    volinfo = get_volume_info(mnode, volname) -    if volinfo is None: -        g.log.error("Unable to get the volume info for volume %s", volname) -        return None - -    if not is_tiered_volume(mnode, volname): -        g.log.error("Volume %s is not a tiered volume", volname) -        return None - -    hot_tier_type_info = { -        'hotBrickType': '', -        'hotreplicaCount': '' -        } -    for key in hot_tier_type_info.keys(): -        if key in volinfo[volname]['bricks']['hotBricks']: -            hot_tier_type_info[key] = (volinfo[volname]['bricks']['hotBricks'] -                                       [key]) -        else: -            g.log.error("Unable to find key '%s' in the volume info for the " -                        "volume %s", key, volname) -            return None - -    return hot_tier_type_info +    return volume_type_info  def get_num_of_bricks_per_subvol(mnode, volname): @@ -985,86 +689,21 @@ def get_num_of_bricks_per_subvol(mnode, volname):                  number of bricks per subvol                  Example:                      num_of_bricks_per_subvol = { -                        'is_tier': False, -                        'hot_tier_num_of_bricks_per_subvol': None, -                        'cold_tier_num_of_bricks_per_subvol': None,                          'volume_num_of_bricks_per_subvol': 2                          } -                    num_of_bricks_per_subvol = { -                        'is_tier': True, -                        'hot_tier_num_of_bricks_per_subvol': 3, -                        'cold_tier_num_of_bricks_per_subvol': 2, -                        'volume_num_of_bricks_per_subvol': None -                        } - -        NoneType: None if volume does not exist or is a tiered volume. +        NoneType: None if volume does not exist.      """ -    bricks_per_subvol_dict = { -        'is_tier': False, -        'hot_tier_num_of_bricks_per_subvol': None, -        'cold_tier_num_of_bricks_per_subvol': None, -        'volume_num_of_bricks_per_subvol': None -        } +    bricks_per_subvol_dict = {'volume_num_of_bricks_per_subvol': None}      subvols_dict = get_subvols(mnode, volname)      if subvols_dict['volume_subvols']:          bricks_per_subvol_dict['volume_num_of_bricks_per_subvol'] = (              len(subvols_dict['volume_subvols'][0])) -    else: -        if (subvols_dict['hot_tier_subvols'] and -                subvols_dict['cold_tier_subvols']): -            bricks_per_subvol_dict['is_tier'] = True -            bricks_per_subvol_dict['hot_tier_num_of_bricks_per_subvol'] = ( -                len(subvols_dict['hot_tier_subvols'][0])) -            bricks_per_subvol_dict['cold_tier_num_of_bricks_per_subvol'] = ( -                len(subvols_dict['cold_tier_subvols'][0]))      return bricks_per_subvol_dict -def get_cold_tier_num_of_bricks_per_subvol(mnode, volname): -    """Returns number of bricks per subvol in cold tier - -    Args: -        mnode (str): Node on which commands are executed. -        volname (str): Name of the volume. - -    Returns: -        int : Number of bricks per subvol on cold tier. -        NoneType: None if volume does not exist or not a tiered volume. -    """ -    if not is_tiered_volume(mnode, volname): -        g.log.error("Volume %s is not a tiered volume", volname) -        return None -    subvols_dict = get_subvols(mnode, volname) -    if subvols_dict['cold_tier_subvols']: -        return len(subvols_dict['cold_tier_subvols'][0]) -    else: -        return None - - -def get_hot_tier_num_of_bricks_per_subvol(mnode, volname): -    """Returns number of bricks per subvol in hot tier - -    Args: -        mnode (str): Node on which commands are executed. -        volname (str): Name of the volume. - -    Returns: -        int : Number of bricks per subvol on hot tier. -        NoneType: None if volume does not exist or not a tiered volume. -    """ -    if not is_tiered_volume(mnode, volname): -        g.log.error("Volume %s is not a tiered volume", volname) -        return None -    subvols_dict = get_subvols(mnode, volname) -    if subvols_dict['hot_tier_subvols']: -        return len(subvols_dict['hot_tier_subvols'][0]) -    else: -        return None - -  def get_replica_count(mnode, volname):      """Get the replica count of the volume @@ -1076,17 +715,8 @@ def get_replica_count(mnode, volname):          dict : Dict contain keys, values defining Replica count of the volume.              Example:                  replica_count_info = { -                    'is_tier': False, -                    'hot_tier_replica_count': None, -                    'cold_tier_replica_count': None,                      'volume_replica_count': 3                      } -                replica_count_info = { -                    'is_tier': True, -                    'hot_tier_replica_count': 2, -                    'cold_tier_replica_count': 3, -                    'volume_replica_count': None -                    }          NoneType: None if it is parse failure.      """      vol_type_info = get_volume_type_info(mnode, volname) @@ -1095,69 +725,14 @@ def get_replica_count(mnode, volname):                      volname)          return None -    replica_count_info = { -        'is_tier': False, -        'hot_tier_replica_count': None, -        'cold_tier_replica_count': None, -        'volume_replica_count': None -        } +    replica_count_info = {'volume_replica_count': None} -    replica_count_info['is_tier'] = vol_type_info['is_tier'] -    if replica_count_info['is_tier']: -        replica_count_info['hot_tier_replica_count'] = ( -            vol_type_info['hot_tier_type_info']['hotreplicaCount']) -        replica_count_info['cold_tier_replica_count'] = ( -            vol_type_info['cold_tier_type_info']['coldreplicaCount']) - -    else: -        replica_count_info['volume_replica_count'] = ( -            vol_type_info['volume_type_info']['replicaCount']) +    replica_count_info['volume_replica_count'] = ( +        vol_type_info['volume_type_info']['replicaCount'])      return replica_count_info -def get_cold_tier_replica_count(mnode, volname): -    """Get the replica count of cold tier. - -    Args: -        mnode (str): Node on which commands are executed. -        volname (str): Name of the volume. - -    Returns: -        int : Replica count of the cold tier. -        NoneType: None if volume does not exist or not a tiered volume. -    """ -    is_tier = is_tiered_volume(mnode, volname) -    if not is_tier: -        return None -    else: -        volinfo = get_volume_info(mnode, volname) -        cold_tier_replica_count = (volinfo[volname]["bricks"]['coldBricks'] -                                   ['coldreplicaCount']) -        return cold_tier_replica_count - - -def get_hot_tier_replica_count(mnode, volname): -    """Get the replica count of hot tier. - -    Args: -        mnode (str): Node on which commands are executed. -        volname (str): Name of the volume. - -    Returns: -        int : Replica count of the hot tier. -        NoneType: None if volume does not exist or not a tiered volume. -    """ -    is_tier = is_tiered_volume(mnode, volname) -    if not is_tier: -        return None -    else: -        volinfo = get_volume_info(mnode, volname) -        hot_tier_replica_count = (volinfo[volname]["bricks"]['hotBricks'] -                                  ['hotreplicaCount']) -        return hot_tier_replica_count - -  def get_disperse_count(mnode, volname):      """Get the disperse count of the volume @@ -1169,15 +744,8 @@ def get_disperse_count(mnode, volname):          dict : Dict contain keys, values defining Disperse count of the volume.              Example:                  disperse_count_info = { -                    'is_tier': False, -                    'cold_tier_disperse_count': None,                      'volume_disperse_count': 3                      } -                disperse_count_info = { -                    'is_tier': True, -                    'cold_tier_disperse_count': 3, -                    'volume_disperse_count': None -                    }          None: If it is non dispersed volume.      """      vol_type_info = get_volume_type_info(mnode, volname) @@ -1186,45 +754,14 @@ def get_disperse_count(mnode, volname):                      volname)          return None -    disperse_count_info = { -        'is_tier': False, -        'cold_tier_disperse_count': None, -        'volume_disperse_count': None -        } - -    disperse_count_info['is_tier'] = vol_type_info['is_tier'] -    if disperse_count_info['is_tier']: -        disperse_count_info['cold_tier_disperse_count'] = ( -            vol_type_info['cold_tier_type_info']['colddisperseCount']) +    disperse_count_info = {'volume_disperse_count': None} -    else: -        disperse_count_info['volume_disperse_count'] = ( +    disperse_count_info['volume_disperse_count'] = (              vol_type_info['volume_type_info']['disperseCount'])      return disperse_count_info -def get_cold_tier_disperse_count(mnode, volname): -    """Get the disperse count of cold tier. - -    Args: -        mnode (str): Node on which commands are executed. -        volname (str): Name of the volume. - -    Returns: -        int : disperse count of the cold tier. -        NoneType: None if volume does not exist or not a tiered volume. -    """ -    is_tier = is_tiered_volume(mnode, volname) -    if not is_tier: -        return None -    else: -        volinfo = get_volume_info(mnode, volname) -        cold_tier_disperse_count = (volinfo[volname]["bricks"]['coldBricks'] -                                    ['colddisperseCount']) -        return cold_tier_disperse_count - -  def enable_and_validate_volume_options(mnode, volname, volume_options_list,                                         time_delay=5):      """Enable the volume option and validate whether the option has be @@ -1271,7 +808,6 @@ def enable_and_validate_volume_options(mnode, volname, volume_options_list,  def form_bricks_list_to_add_brick(mnode, volname, servers, all_servers_info, -                                  add_to_hot_tier=False,                                    **kwargs):      """Forms list of bricks to add-bricks to the volume. @@ -1294,9 +830,6 @@ def form_bricks_list_to_add_brick(mnode, volname, servers, all_servers_info,                      }                  }      Kwargs: -        add_to_hot_tier (bool): True If bricks are to be added to hot_tier. -            False otherwise. Defaults to False. -          The keys, values in kwargs are:              - replica_count : (int)|None.                Increase the current_replica_count by replica_count @@ -1335,19 +868,8 @@ def form_bricks_list_to_add_brick(mnode, volname, servers, all_servers_info,          bricks_per_subvol_dict = get_num_of_bricks_per_subvol(mnode, volname)          # Get number of bricks to add. -        if bricks_per_subvol_dict['is_tier']: -            if add_to_hot_tier: -                num_of_bricks_per_subvol = ( -                    bricks_per_subvol_dict['hot_tier_num_of_bricks_per_subvol'] -                    ) -            else: -                num_of_bricks_per_subvol = ( -                    bricks_per_subvol_dict -                    ['cold_tier_num_of_bricks_per_subvol'] -                    ) -        else: -            num_of_bricks_per_subvol = ( -                bricks_per_subvol_dict['volume_num_of_bricks_per_subvol']) +        num_of_bricks_per_subvol = ( +            bricks_per_subvol_dict['volume_num_of_bricks_per_subvol'])          if num_of_bricks_per_subvol is None:              g.log.error("Number of bricks per subvol is None. " @@ -1363,15 +885,7 @@ def form_bricks_list_to_add_brick(mnode, volname, servers, all_servers_info,      if replica_count:          # Get Subvols          subvols_info = get_subvols(mnode, volname) - -        # Calculate number of bricks to add -        if subvols_info['is_tier']: -            if add_to_hot_tier: -                num_of_subvols = len(subvols_info['hot_tier_subvols']) -            else: -                num_of_subvols = len(subvols_info['cold_tier_subvols']) -        else: -            num_of_subvols = len(subvols_info['volume_subvols']) +        num_of_subvols = len(subvols_info['volume_subvols'])          if num_of_subvols == 0:              g.log.error("No Sub-Volumes available for the volume %s." @@ -1409,7 +923,7 @@ def form_bricks_list_to_add_brick(mnode, volname, servers, all_servers_info,  def expand_volume(mnode, volname, servers, all_servers_info, force=False, -                  add_to_hot_tier=False, **kwargs): +                  **kwargs):      """Forms list of bricks to add and adds those bricks to the volume.      Args: @@ -1435,9 +949,6 @@ def expand_volume(mnode, volname, servers, all_servers_info, force=False,              will get executed with force option. If it is set to False,              then add-brick command will get executed without force option -        add_to_hot_tier (bool): True If bricks are to be added to hot_tier. -            False otherwise. Defaults to False. -          **kwargs              The keys, values in kwargs are:                  - replica_count : (int)|None. @@ -1449,11 +960,9 @@ def expand_volume(mnode, volname, servers, all_servers_info, force=False,          bool: True of expanding volumes is successful.              False otherwise. -    NOTE: adding bricks to hot tier is yet to be added in this function.      """      bricks_list = form_bricks_list_to_add_brick(mnode, volname, servers, -                                                all_servers_info, -                                                add_to_hot_tier, **kwargs) +                                                all_servers_info, **kwargs)      if not bricks_list:          g.log.info("Unable to get bricks list to add-bricks. " @@ -1465,17 +974,8 @@ def expand_volume(mnode, volname, servers, all_servers_info, force=False,          # Get replica count info.          replica_count_info = get_replica_count(mnode, volname) - -        if is_tiered_volume(mnode, volname): -            if add_to_hot_tier: -                current_replica_count = ( -                    int(replica_count_info['hot_tier_replica_count'])) -            else: -                current_replica_count = ( -                    int(replica_count_info['cold_tier_replica_count'])) -        else: -            current_replica_count = ( -                int(replica_count_info['volume_replica_count'])) +        current_replica_count = ( +            int(replica_count_info['volume_replica_count']))          kwargs['replica_count'] = current_replica_count + replica_count @@ -1491,8 +991,7 @@ def expand_volume(mnode, volname, servers, all_servers_info, force=False,  def form_bricks_list_to_remove_brick(mnode, volname, subvol_num=None, -                                     replica_num=None, -                                     remove_from_hot_tier=False, **kwargs): +                                     replica_num=None, **kwargs):      """Form bricks list for removing the bricks.      Args: @@ -1509,9 +1008,6 @@ def form_bricks_list_to_remove_brick(mnode, volname, subvol_num=None,              If replica_num = 0, then 1st brick from each subvolume is removed.              the replica_num starts from 0. -        remove_from_hot_tier (bool): True If bricks are to be removed from -            hot_tier. False otherwise. Defaults to False. -          **kwargs              The keys, values in kwargs are:                  - replica_count : (int)|None. Specify the number of replicas @@ -1554,27 +1050,13 @@ def form_bricks_list_to_remove_brick(mnode, volname, subvol_num=None,          is_arbiter = False          # Calculate bricks to remove -        if subvols_info['is_tier']: -            if remove_from_hot_tier: -                current_replica_count = ( -                    int(replica_count_info['hot_tier_replica_count'])) -                subvols_list = subvols_info['hot_tier_subvols'] -            else: -                current_replica_count = ( -                    int(replica_count_info['cold_tier_replica_count'])) -                subvols_list = subvols_info['cold_tier_subvols'] -                arbiter_count = int(volume_type_info['cold_tier_type_info'] -                                    ['coldarbiterCount']) -                if arbiter_count == 1: -                    is_arbiter = True -        else: -            current_replica_count = ( -                int(replica_count_info['volume_replica_count'])) -            subvols_list = subvols_info['volume_subvols'] -            arbiter_count = int(volume_type_info['volume_type_info'] -                                ['arbiterCount']) -            if arbiter_count == 1: -                is_arbiter = True +        current_replica_count = ( +            int(replica_count_info['volume_replica_count'])) +        subvols_list = subvols_info['volume_subvols'] +        arbiter_count = int(volume_type_info['volume_type_info'] +                            ['arbiterCount']) +        if arbiter_count == 1: +            is_arbiter = True          # If replica_num is specified select the bricks of that replica number          # from all the subvolumes. @@ -1620,14 +1102,7 @@ def form_bricks_list_to_remove_brick(mnode, volname, subvol_num=None,      # remove bricks from sub-volumes      if subvol_num is not None or 'distribute_count' in kwargs: -        if subvols_info['is_tier']: -            if remove_from_hot_tier: -                subvols_list = subvols_info['hot_tier_subvols'] -            else: -                subvols_list = subvols_info['cold_tier_subvols'] -        else: -            subvols_list = subvols_info['volume_subvols'] - +        subvols_list = subvols_info['volume_subvols']          if not subvols_list:              g.log.error("No Sub-Volumes available for the volume %s", volname)              return None @@ -1663,7 +1138,7 @@ def form_bricks_list_to_remove_brick(mnode, volname, subvol_num=None,  def shrink_volume(mnode, volname, subvol_num=None, replica_num=None,                    force=False, rebalance_timeout=300, delete_bricks=True, -                  remove_from_hot_tier=False, **kwargs): +                  **kwargs):      """Remove bricks from the volume.      Args: @@ -1690,9 +1165,6 @@ def shrink_volume(mnode, volname, subvol_num=None, replica_num=None,          delete_bricks (bool): After remove-brick delete the removed bricks. -        remove_from_hot_tier (bool): True If bricks are to be removed from -            hot_tier. False otherwise. Defaults to False. -          **kwargs              The keys, values in kwargs are:                  - replica_count : (int)|None. Specify the replica count to @@ -1703,12 +1175,10 @@ def shrink_volume(mnode, volname, subvol_num=None, replica_num=None,          bool: True if removing bricks from the volume is successful.              False otherwise. -    NOTE: remove-bricks from hot-tier is yet to be added in this function.      """      # Form bricks list to remove-bricks      bricks_list_to_remove = form_bricks_list_to_remove_brick( -        mnode, volname, subvol_num, replica_num, remove_from_hot_tier, -        **kwargs) +        mnode, volname, subvol_num, replica_num, **kwargs)      if not bricks_list_to_remove:          g.log.error("Failed to form bricks list to remove-brick. " @@ -1727,16 +1197,8 @@ def shrink_volume(mnode, volname, subvol_num=None, replica_num=None,          # Get replica count info.          replica_count_info = get_replica_count(mnode, volname) -        if is_tiered_volume(mnode, volname): -            if remove_from_hot_tier: -                current_replica_count = ( -                    int(replica_count_info['hot_tier_replica_count'])) -            else: -                current_replica_count = ( -                    int(replica_count_info['cold_tier_replica_count'])) -        else: -            current_replica_count = ( -                int(replica_count_info['volume_replica_count'])) +        current_replica_count = ( +            int(replica_count_info['volume_replica_count']))          kwargs['replica_count'] = current_replica_count - replica_count @@ -1854,8 +1316,7 @@ def shrink_volume(mnode, volname, subvol_num=None, replica_num=None,  def form_bricks_to_replace_brick(mnode, volname, servers, all_servers_info, -                                 src_brick=None, dst_brick=None, -                                 replace_brick_from_hot_tier=False): +                                 src_brick=None, dst_brick=None):      """Get src_brick, dst_brick to replace brick      Args: @@ -1882,9 +1343,6 @@ def form_bricks_to_replace_brick(mnode, volname, servers, all_servers_info,          dst_brick (str): New brick to replace the faulty brick -        replace_brick_from_hot_tier (bool): True If brick are to be -            replaced from hot_tier. False otherwise. Defaults to False. -      Returns:          Tuple: (src_brick, dst_brick)          Nonetype: if volume doesn't exists or any other failure. @@ -1910,13 +1368,7 @@ def form_bricks_to_replace_brick(mnode, volname, servers, all_servers_info,      if not src_brick:          # Randomly pick up a brick to bring the brick down and replace. -        if subvols_info['is_tier']: -            if replace_brick_from_hot_tier: -                subvols_list = subvols_info['hot_tier_subvols'] -            else: -                subvols_list = subvols_info['cold_tier_subvols'] -        else: -            subvols_list = subvols_info['volume_subvols'] +        subvols_list = subvols_info['volume_subvols']          src_brick = (random.choice(random.choice(subvols_list))) @@ -1925,9 +1377,7 @@ def form_bricks_to_replace_brick(mnode, volname, servers, all_servers_info,  def replace_brick_from_volume(mnode, volname, servers, all_servers_info,                                src_brick=None, dst_brick=None, -                              delete_brick=True, -                              replace_brick_from_hot_tier=False, -                              multi_vol=False): +                              delete_brick=True, multi_vol=False):      """Replace faulty brick from the volume.      Args: @@ -1956,9 +1406,6 @@ def replace_brick_from_volume(mnode, volname, servers, all_servers_info,          delete_bricks (bool): After remove-brick delete the removed bricks. -        replace_brick_from_hot_tier (bool): True If brick are to be -            replaced from hot_tier. False otherwise. Defaults to False. -          multi_vol (bool): True, If bricks need to created for multiple                            volumes(more than 5)                            False, Otherwise. By default, value is set to False. @@ -1998,13 +1445,7 @@ def replace_brick_from_volume(mnode, volname, servers, all_servers_info,      if not src_brick:          # Randomly pick up a brick to bring the brick down and replace. -        if subvols_info['is_tier']: -            if replace_brick_from_hot_tier: -                subvols_list = subvols_info['hot_tier_subvols'] -            else: -                subvols_list = subvols_info['cold_tier_subvols'] -        else: -            subvols_list = subvols_info['volume_subvols'] +        subvols_list = subvols_info['volume_subvols']          src_brick = (random.choice(random.choice(subvols_list))) @@ -2069,17 +1510,6 @@ def get_client_quorum_info(mnode, volname):      Returns:          dict: client quorum information for the volume.              client_quorum_dict = { -                'is_tier': False, -                'hot_tier_quorum_info':{ -                    'is_quorum_applicable': False, -                    'quorum_type': None, -                    'quorum_count': None -                    }, -                'cold_tier_quorum_info':{ -                    'is_quorum_applicable': False, -                    'quorum_type': None, -                    'quorum_count': None -                    },                  'volume_quorum_info':{                      'is_quorum_applicable': False,                      'quorum_type': None, @@ -2089,17 +1519,6 @@ def get_client_quorum_info(mnode, volname):          NoneType: None if volume does not exist.      """      client_quorum_dict = { -        'is_tier': False, -        'hot_tier_quorum_info': { -            'is_quorum_applicable': False, -            'quorum_type': None, -            'quorum_count': None -            }, -        'cold_tier_quorum_info': { -            'is_quorum_applicable': False, -            'quorum_type': None, -            'quorum_count': None -            },          'volume_quorum_info': {              'is_quorum_applicable': False,              'quorum_type': None, @@ -2125,111 +1544,37 @@ def get_client_quorum_info(mnode, volname):      # Set the quorum info      volume_type_info = get_volume_type_info(mnode, volname) -    if volume_type_info['is_tier'] is True: -        client_quorum_dict['is_tier'] = True - -        # Hot Tier quorum info -        hot_tier_type = volume_type_info['hot_tier_type_info']['hotBrickType'] -        if (hot_tier_type == 'Replicate' or -                hot_tier_type == 'Distributed-Replicate'): - -            (client_quorum_dict['hot_tier_quorum_info'] -             ['is_quorum_applicable']) = True -            replica_count = (volume_type_info['hot_tier_type_info'] -                             ['hotreplicaCount']) - -            # Case1: Replica 2 -            if int(replica_count) == 2: -                if 'none' not in quorum_type: -                    (client_quorum_dict['hot_tier_quorum_info'] -                     ['quorum_type']) = quorum_type - -                    if quorum_type == 'fixed': -                        if not quorum_count == '(null)': -                            (client_quorum_dict['hot_tier_quorum_info'] -                             ['quorum_count']) = quorum_count - -            # Case2: Replica > 2 -            if int(replica_count) > 2: -                if quorum_type == 'none': -                    (client_quorum_dict['hot_tier_quorum_info'] -                     ['quorum_type']) = 'auto' -                    quorum_type == 'auto' -                else: -                    (client_quorum_dict['hot_tier_quorum_info'] -                     ['quorum_type']) = quorum_type -                if quorum_type == 'fixed': -                    if not quorum_count == '(null)': -                        (client_quorum_dict['hot_tier_quorum_info'] -                         ['quorum_count']) = quorum_count - -        # Cold Tier quorum info -        cold_tier_type = (volume_type_info['cold_tier_type_info'] -                          ['coldBrickType']) -        if (cold_tier_type == 'Replicate' or -                cold_tier_type == 'Distributed-Replicate'): -            (client_quorum_dict['cold_tier_quorum_info'] -             ['is_quorum_applicable']) = True -            replica_count = (volume_type_info['cold_tier_type_info'] -                             ['coldreplicaCount']) - -            # Case1: Replica 2 -            if int(replica_count) == 2: -                if 'none' not in quorum_type: -                    (client_quorum_dict['cold_tier_quorum_info'] -                     ['quorum_type']) = quorum_type - -                    if quorum_type == 'fixed': -                        if not quorum_count == '(null)': -                            (client_quorum_dict['cold_tier_quorum_info'] -                             ['quorum_count']) = quorum_count - -            # Case2: Replica > 2 -            if int(replica_count) > 2: -                if quorum_type == 'none': -                    (client_quorum_dict['cold_tier_quorum_info'] -                     ['quorum_type']) = 'auto' -                    quorum_type == 'auto' -                else: -                    (client_quorum_dict['cold_tier_quorum_info'] -                     ['quorum_type']) = quorum_type -                if quorum_type == 'fixed': -                    if not quorum_count == '(null)': -                        (client_quorum_dict['cold_tier_quorum_info'] -                         ['quorum_count']) = quorum_count -    else: -        volume_type = (volume_type_info['volume_type_info']['typeStr']) -        if (volume_type == 'Replicate' or -                volume_type == 'Distributed-Replicate'): -            (client_quorum_dict['volume_quorum_info'] -             ['is_quorum_applicable']) = True -            replica_count = (volume_type_info['volume_type_info'] -                             ['replicaCount']) - -            # Case1: Replica 2 -            if int(replica_count) == 2: -                if 'none' not in quorum_type: -                    (client_quorum_dict['volume_quorum_info'] -                     ['quorum_type']) = quorum_type +    volume_type = (volume_type_info['volume_type_info']['typeStr']) +    if (volume_type == 'Replicate' or +            volume_type == 'Distributed-Replicate'): +        (client_quorum_dict['volume_quorum_info'] +            ['is_quorum_applicable']) = True +        replica_count = (volume_type_info['volume_type_info']['replicaCount']) + +        # Case1: Replica 2 +        if int(replica_count) == 2: +            if 'none' not in quorum_type: +                (client_quorum_dict['volume_quorum_info'] +                    ['quorum_type']) = quorum_type -                    if quorum_type == 'fixed': -                        if not quorum_count == '(null)': -                            (client_quorum_dict['volume_quorum_info'] -                             ['quorum_count']) = quorum_count - -            # Case2: Replica > 2 -            if int(replica_count) > 2: -                if quorum_type == 'none': -                    (client_quorum_dict['volume_quorum_info'] -                     ['quorum_type']) = 'auto' -                    quorum_type == 'auto' -                else: -                    (client_quorum_dict['volume_quorum_info'] -                     ['quorum_type']) = quorum_type                  if quorum_type == 'fixed':                      if not quorum_count == '(null)':                          (client_quorum_dict['volume_quorum_info'] -                         ['quorum_count']) = quorum_count +                            ['quorum_count']) = quorum_count + +        # Case2: Replica > 2 +        if int(replica_count) > 2: +            if quorum_type == 'none': +                (client_quorum_dict['volume_quorum_info'] +                    ['quorum_type']) = 'auto' +                quorum_type == 'auto' +            else: +                (client_quorum_dict['volume_quorum_info'] +                    ['quorum_type']) = quorum_type +            if quorum_type == 'fixed': +                if not quorum_count == '(null)': +                    (client_quorum_dict['volume_quorum_info'] +                        ['quorum_count']) = quorum_count      return client_quorum_dict diff --git a/glustolibs-gluster/glustolibs/gluster/volume_ops.py b/glustolibs-gluster/glustolibs/gluster/volume_ops.py index 0090adf1a..d25a9349b 100644 --- a/glustolibs-gluster/glustolibs/gluster/volume_ops.py +++ b/glustolibs-gluster/glustolibs/gluster/volume_ops.py @@ -238,15 +238,8 @@ def volume_delete(mnode, volname, xfail=False):              )              return False -    if volinfo[volname]['typeStr'] == 'Tier': -        tmp_hot_brick = volinfo[volname]["bricks"]["hotBricks"]["brick"] -        hot_bricks = [x["name"] for x in tmp_hot_brick if "name" in x] -        tmp_cold_brick = volinfo[volname]["bricks"]["coldBricks"]["brick"] -        cold_bricks = [x["name"] for x in tmp_cold_brick if "name" in x] -        bricks = hot_bricks + cold_bricks -    else: -        bricks = [x["name"] for x in volinfo[volname]["bricks"]["brick"] -                  if "name" in x] +    bricks = [x["name"] for x in volinfo[volname]["bricks"]["brick"] if +              "name" in x]      ret, out, err = g.run(mnode, "gluster volume delete {} --mode=script"                            .format(volname))      if ret != 0: @@ -392,27 +385,34 @@ def get_volume_status(mnode, volname='all', service='', options=''):          NoneType: on failure      Example: -        get_volume_status("10.70.47.89", volname="testvol") -        >>>{'testvol': {'10.70.47.89': {'/bricks/brick1/a11': {'status': '1', -        'pid': '28963', 'bricktype': 'cold', 'port': '49163', 'peerid': -        '7fc9015e-8134-4753-b837-54cbc6030c98', 'ports': {'rdma': 'N/A', -        'tcp': '49163'}}, '/bricks/brick2/a31': {'status': '1', 'pid': -        '28982', 'bricktype': 'cold', 'port': '49164', 'peerid': -        '7fc9015e-8134-4753-b837-54cbc6030c98', 'ports': {'rdma': 'N/A', -        'tcp': '49164'}}, 'NFS Server': {'status': '1', 'pid': '30525', -        'port': '2049', 'peerid': '7fc9015e-8134-4753-b837-54cbc6030c98', -        'ports': {'rdma': 'N/A', 'tcp': '2049'}}, '/bricks/brick1/a12': -        {'status': '1', 'pid': '30505', 'bricktype': 'hot', 'port': '49165', -        'peerid': '7fc9015e-8134-4753-b837-54cbc6030c98', 'ports': {'rdma': -        'N/A', 'tcp': '49165'}}}, '10.70.47.118': {'/bricks/brick1/a21': -        {'status': '1', 'pid': '5427', 'bricktype': 'cold', 'port': '49162', -        'peerid': '5397d8f5-2986-453a-b0b5-5c40a9bb87ff', 'ports': {'rdma': -        'N/A', 'tcp': '49162'}}, '/bricks/brick2/a41': {'status': '1', 'pid': -        '5446', 'bricktype': 'cold', 'port': '49163', 'peerid': -        '5397d8f5-2986-453a-b0b5-5c40a9bb87ff', 'ports': {'rdma': 'N/A', -        'tcp': '49163'}}, 'NFS Server': {'status': '1', 'pid': '6397', 'port': -        '2049', 'peerid': '5397d8f5-2986-453a-b0b5-5c40a9bb87ff', 'ports': -        {'rdma': 'N/A', 'tcp': '2049'}}}}} +        get_volume_status(host1, volname="testvol_replicated") +        >>>{'testvol_replicated': {'host1': {'Self-heal Daemon': {'status': +        '1', 'pid': '2479', 'port': 'N/A', 'peerid': +        'b7a02af9-eea4-4657-8b86-3b21ec302f48', 'ports': {'rdma': 'N/A', +        'tcp': 'N/A'}}, '/bricks/brick4/testvol_replicated_brick2': {'status': +        '1', 'pid': '2468', 'bricktype': 'None', 'port': '49160', 'peerid': +        'b7a02af9-eea4-4657-8b86-3b21ec302f48', 'ports': {'rdma': 'N/A', +        'tcp': '49160'}}}, 'host2': {'Self-heal Daemon': {'status': '1', +        'pid': '2513', 'port': 'N/A', 'peerid': +        '7f6fb9ed-3e0b-4f27-89b3-9e4f836c2332', 'ports': {'rdma': 'N/A', +        'tcp': 'N/A'}}, '/bricks/brick4/testvol_replicated_brick1': {'status': +        '1', 'pid': '2456', 'bricktype': 'None', 'port': '49160', 'peerid': +        '7f6fb9ed-3e0b-4f27-89b3-9e4f836c2332', 'ports': {'rdma': 'N/A', +        'tcp': '49160'}}}, 'host3': {'Self-heal Daemon': {'status': '1', 'pid' +        : '2515', 'port': 'N/A', 'peerid': +        '6172cfab-9d72-43b5-ba6f-612e5cfc020c', 'ports': {'rdma': 'N/A', +        'tcp': 'N/A'}}}, 'host4': {'Self-heal Daemon': {'status': '1', 'pid': +        '2445', 'port': 'N/A', 'peerid': 'c16a1660-ee73-4e0f-b9c7-d2e830e39539 +        ', 'ports': {'rdma': 'N/A', 'tcp': 'N/A'}}}, 'host5': +        {'Self-heal Daemon': {'status': '1', 'pid': '2536', 'port': 'N/A', +        'peerid': '79ea9f52-88f0-4293-ae21-8ea13f44b58d', 'ports': +        {'rdma': 'N/A', 'tcp': 'N/A'}}}, 'host6': {'Self-heal Daemon': +        {'status': '1', 'pid': '2526', 'port': 'N/A', 'peerid': +        'c00a3c5e-668f-440b-860c-da43e999737b', 'ports': {'rdma': 'N/A', +        'tcp': 'N/A'}}, '/bricks/brick4/testvol_replicated_brick0': {'status': +        '1', 'pid': '2503', 'bricktype': 'None', 'port': '49160', 'peerid': +        'c00a3c5e-668f-440b-860c-da43e999737b', 'ports': {'rdma': 'N/A', +        'tcp': '49160'}}}}}      """      cmd = "gluster vol status %s %s %s --xml" % (volname, service, options) @@ -433,8 +433,6 @@ def get_volume_status(mnode, volname='all', service='', options=''):      for volume in volume_list:          tmp_dict1 = {}          tmp_dict2 = {} -        hot_bricks = [] -        cold_bricks = []          vol_name = [vol.text for vol in volume if vol.tag == "volName"]          # parsing volume status xml output @@ -454,24 +452,7 @@ def get_volume_status(mnode, volname='all', service='', options=''):              elem_tag = []              for elem in volume.getchildren():                  elem_tag.append(elem.tag) -            if ('hotBricks' in elem_tag) or ('coldBricks' in elem_tag): -                for elem in volume.getchildren(): -                    if (elem.tag == 'hotBricks'): -                        nodes = elem.findall("node") -                        hot_bricks = [node.find('path').text -                                      for node in nodes -                                      if ( -                                       node.find('path').text.startswith('/'))] -                    if (elem.tag == 'coldBricks'): -                        for n in elem.findall("node"): -                            nodes.append(n) -                        cold_bricks = [node.find('path').text -                                       for node in nodes -                                       if ( -                                        (node.find('path'). -                                         text.startswith('/')))] -            else: -                nodes = volume.findall("node") +            nodes = volume.findall("node")              for each_node in nodes:                  if each_node.find('path').text.startswith('/'): @@ -484,12 +465,7 @@ def get_volume_status(mnode, volname='all', service='', options=''):                  tmp_dict3 = {}                  if "hostname" in node_dict.keys():                      if node_dict['path'].startswith('/'): -                        if node_dict['path'] in hot_bricks: -                            node_dict["bricktype"] = 'hot' -                        elif node_dict['path'] in cold_bricks: -                            node_dict["bricktype"] = 'cold' -                        else: -                            node_dict["bricktype"] = 'None' +                        node_dict["bricktype"] = 'None'                          tmp = node_dict["path"]                          tmp_dict3[node_dict["path"]] = node_dict                      else: @@ -678,29 +654,42 @@ def get_volume_info(mnode, volname='all', xfail=False):          dict: volume info in dict of dicts      Example: -        get_volume_info("abc.com", volname="testvol") -        >>>{'testvol': {'status': '1', 'xlators': None, 'disperseCount': '0', -        'bricks': {'coldBricks': {'colddisperseCount': '0', -        'coldarbiterCount': '0', 'coldBrickType': 'Distribute', -        'coldbrickCount': '4', 'numberOfBricks': '4', 'brick': -        [{'isArbiter': '0', 'name': '10.70.47.89:/bricks/brick1/a11', -        'hostUuid': '7fc9015e-8134-4753-b837-54cbc6030c98'}, {'isArbiter': -        '0', 'name': '10.70.47.118:/bricks/brick1/a21', 'hostUuid': -        '7fc9015e-8134-4753-b837-54cbc6030c98'}, {'isArbiter': '0', 'name': -        '10.70.47.89:/bricks/brick2/a31', 'hostUuid': -        '7fc9015e-8134-4753-b837-54cbc6030c98'}, {'isArbiter': '0', -        'name': '10.70.47.118:/bricks/brick2/a41', 'hostUuid': -        '7fc9015e-8134-4753-b837-54cbc6030c98'}], 'coldreplicaCount': '1'}, -        'hotBricks': {'hotBrickType': 'Distribute', 'numberOfBricks': '1', -        'brick': [{'name': '10.70.47.89:/bricks/brick1/a12', 'hostUuid': -        '7fc9015e-8134-4753-b837-54cbc6030c98'}], 'hotbrickCount': '1', -        'hotreplicaCount': '1'}}, 'type': '5', 'distCount': '1', -        'replicaCount': '1', 'brickCount': '5', 'options': -        {'cluster.tier-mode': 'cache', 'performance.readdir-ahead': 'on', -        'features.ctr-enabled': 'on'}, 'redundancyCount': '0', 'transport': -        '0', 'typeStr': 'Tier', 'stripeCount': '1', 'arbiterCount': '0', -        'id': 'ffa8a8d1-546f-4ebf-8e82-fcc96c7e4e05', 'statusStr': 'Started', -        'optCount': '3'}} +        get_volume_info("host1", volname="testvol") +        >>>{'testvol': {'status': '1', 'disperseCount': '6', +        'bricks': {'brick': [{'isArbiter': '0', 'name': +        'host1:/bricks/brick6/testvol_brick0', 'hostUuid': +        'c00a3c5e-668f-440b-860c-da43e999737b'}, {'isArbiter': '0', 'name': +        'host2:/bricks/brick6/testvol_brick1', 'hostUuid': +        '7f6fb9ed-3e0b-4f27-89b3-9e4f836c2332'}, {'isArbiter': '0', 'name': +        'host3:/bricks/brick6/testvol_brick2', 'hostUuid': +        'b7a02af9-eea4-4657-8b86-3b21ec302f48'}, {'isArbiter': '0', 'name': +        'host4:/bricks/brick4/testvol_brick3', 'hostUuid': +        '79ea9f52-88f0-4293-ae21-8ea13f44b58d'}, {'isArbiter': '0', 'name': +        'host5:/bricks/brick2/testvol_brick4', 'hostUuid': +        'c16a1660-ee73-4e0f-b9c7-d2e830e39539'}, {'isArbiter': '0', 'name': +        'host6:/bricks/brick2/testvol_brick5', 'hostUuid': +        '6172cfab-9d72-43b5-ba6f-612e5cfc020c'}, {'isArbiter': '0', 'name': +        'host1:/bricks/brick7/testvol_brick6', 'hostUuid': +        'c00a3c5e-668f-440b-860c-da43e999737b'}, {'isArbiter': '0', 'name': +        'host2:/bricks/brick7/testvol_brick7', 'hostUuid': +        '7f6fb9ed-3e0b-4f27-89b3-9e4f836c2332'}, {'isArbiter': '0', 'name': +        'host3:/bricks/brick7/testvol_brick8', 'hostUuid': +        'b7a02af9-eea4-4657-8b86-3b21ec302f48'}, {'isArbiter': '0', 'name': +        'host4:/bricks/brick5/testvol_brick9', 'hostUuid': +        '79ea9f52-88f0-4293-ae21-8ea13f44b58d'}, {'isArbiter': '0', 'name': +        'host5:/bricks/brick4/testvol_brick10', 'hostUuid': +        'c16a1660-ee73-4e0f-b9c7-d2e830e39539'}, {'isArbiter': '0', 'name': +        'host6:/bricks/brick4/testvol_brick11', 'hostUuid': +        '6172cfab-9d72-43b5-ba6f-612e5cfc020c'}]}, +        'type': '9', 'distCount': '2', 'replicaCount': '1', 'brickCount': +        '12', 'options': {'nfs.disable': 'on', 'cluster.server-quorum-ratio': +        '90%', 'storage.fips-mode-rchecksum': 'on', +        'transport.address-family': 'inet', 'cluster.brick-multiplex': +        'disable'}, 'redundancyCount': '2', 'snapshotCount': '0', +        'transport': '0', 'typeStr': 'Distributed-Disperse', 'stripeCount': +        '1', 'arbiterCount': '0', +        'id': '8d217fa3-094b-4293-89b5-41d447c06d22', 'statusStr': 'Started', +        'optCount': '5'}}      """      cmd = "gluster volume info %s --xml" % volname @@ -732,18 +721,6 @@ def get_volume_info(mnode, volname='all', xfail=False):                          (volinfo[volname]["bricks"]["brick"].                           append(brick_info_dict)) -                    if el.tag == "hotBricks" or el.tag == "coldBricks": -                        volinfo[volname]["bricks"][el.tag] = {} -                        volinfo[volname]["bricks"][el.tag]["brick"] = [] -                        for elmt in el.getchildren(): -                            if elmt.tag == 'brick': -                                brick_info_dict = {} -                                for el_brk in elmt.getchildren(): -                                    brick_info_dict[el_brk.tag] = el_brk.text -                                (volinfo[volname]["bricks"][el.tag]["brick"]. -                                 append(brick_info_dict)) -                            else: -                                volinfo[volname]["bricks"][el.tag][elmt.tag] = elmt.text  # noqa: E501              elif elem.tag == "options":                  volinfo[volname]["options"] = {}                  for option in elem.findall("option"):  | 
