def get_local_bricks(volume: str) -> Result:
"""
Return all bricks that are being served locally in the volume
volume: Name of the volume to get local bricks for
"""
try:
vol_info = volume_info(volume)
local_ip = get_local_ip()
if local_ip.is_err():
return Err(local_ip.value)
local_brick_list = []
for vol in vol_info:
for brick in vol.bricks:
if ip_address(brick.peer.hostname) == local_ip.value:
local_brick_list.append(brick)
return Ok(local_brick_list)
except GlusterCmdOutputParseError:
raise
评论列表
文章目录