def add_volume_bricks(name, bricks):
 ret = {'name': name, 'changes': {}, 'comment': '', 'result': False}
 volinfo = __salt__['glusterfs.info']()
 if (name not in volinfo):
  ret['comment'] = 'Volume {0} does not exist'.format(name)
  return ret
 if (int(volinfo[name]['status']) != 1):
  ret['comment'] = 'Volume {0} is not started'.format(name)
  return ret
 current_bricks = [brick['path'] for brick in volinfo[name]['bricks'].values()]
 if (not (set(bricks) - set(current_bricks))):
  ret['result'] = True
  ret['comment'] = 'Bricks already added in volume {0}'.format(name)
  return ret
 bricks_added = __salt__['glusterfs.add_volume_bricks'](name, bricks)
 if bricks_added:
  ret['result'] = True
  ret['comment'] = 'Bricks successfully added to volume {0}'.format(name)
  new_bricks = [brick['path'] for brick in __salt__['glusterfs.info']()[name]['bricks'].values()]
  ret['changes'] = {'new': new_bricks, 'old': current_bricks}
  return ret
 ret['comment'] = 'Adding bricks to volume {0} failed'.format(name)
 return ret

def add_volume_bricks ( name , bricks ) : ret = { 'name' : name , 'changes' : { } , 'comment' : '' , 'result' : False } volinfo = __salt__ [ 'glusterfs.info' ] ( ) if ( name not in volinfo ) : ret [ 'comment' ] = 'Volume {0} does not exist' . format ( name ) return ret if ( int ( volinfo [ name ] [ 'status' ] ) != 1 ) : ret [ 'comment' ] = 'Volume {0} is not started' . format ( name ) return ret current_bricks = [ brick [ 'path' ] for brick in volinfo [ name ] [ 'bricks' ] . values ( ) ] if ( not ( set ( bricks ) - set ( current_bricks ) ) ) : ret [ 'result' ] = True ret [ 'comment' ] = 'Bricks already added in volume {0}' . format ( name ) return ret bricks_added = __salt__ [ 'glusterfs.add_volume_bricks' ] ( name , bricks ) if bricks_added : ret [ 'result' ] = True ret [ 'comment' ] = 'Bricks successfully added to volume {0}' . format ( name ) new_bricks = [ brick [ 'path' ] for brick in __salt__ [ 'glusterfs.info' ] ( ) [ name ] [ 'bricks' ] . values ( ) ] ret [ 'changes' ] = { 'new' : new_bricks , 'old' : current_bricks } return ret ret [ 'comment' ] = 'Adding bricks to volume {0} failed' . format ( name ) return ret
add brick(s) to an existing volume name volume name bricks list of bricks to add to the volume .