#NEWLINE# def _mount_output_all( self , position , dirs_only = False ) : #NEWLINE# #INDENT# if ( ( position in self . mount_all ) and ( dirs_only in self . mount_all [ position ] ) ) : #NEWLINE# #INDENT# return self . mount_all [ position ] [ dirs_only ] #NEWLINE# #UNINDENT# self . mount_all [ position ] = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# self . mount_all [ position ] [ dirs_only ] = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# cmd = ( 'awk -F\'[ =\t]+\' \'/^enabled_backends/{res=$2} END{print res}\' "%s" | tr \',\' \'\n\'' % self . storage [ position ] . conf ) #NEWLINE# backend_blocks = self . _run_cmd ( self . clouds [ position ] , cmd ) #NEWLINE# if ( backend_blocks and ( not isinstance ( backend_blocks , list ) ) ) : #NEWLINE# #INDENT# backend_blocks = [ backend_blocks ] #NEWLINE# #UNINDENT# for backend_block in backend_blocks : #NEWLINE# #INDENT# cmd = ( "awk -F'[ =\\t]+' '/^\\[%s\\]/{i=1} i && /^volume_backend_name/ {res=$2} res && i && /^\\[.*\\]/{exit} END{print res}' '%s'" % ( backend_block , self . storage [ position ] . conf ) ) #NEWLINE# backend = self . _run_cmd ( self . clouds [ position ] , cmd ) #NEWLINE# vtid = None #NEWLINE# if backend : #NEWLINE# #INDENT# vtids = [ sp [ 'volume_type_id' ] for sp in self . data [ position ] [ 'volume_type_extra_specs' ] if ( ( sp [ 'key' ] == 'volume_backend_name' ) and ( sp [ 'value' ] == backend ) ) ] #NEWLINE# vtid = ( vtids [ 0 ] if vtids else None ) #NEWLINE# #UNINDENT# print_cmd = ( "{print $3}}'; done" if dirs_only else ( '{print $3"%s"$1}}\'; done' % MOUNT_DELIM ) ) #NEWLINE# cmd = ( "for exp in $(awk -F'[ =\\t]+' '/^\\[%s\\]/{i=1} i && " % backend_block ) #NEWLINE# cmd += ( AWK_GET_MOUNTED_NFS_SHARES % self . storage [ position ] . conf ) #NEWLINE# cmd += print_cmd #NEWLINE# nfs_shares = self . _run_cmd ( self . clouds [ position ] , cmd ) #NEWLINE# if ( not isinstance ( nfs_shares , list ) ) : #NEWLINE# #INDENT# nfs_shares = [ nfs_shares ] #NEWLINE# #UNINDENT# fld = ( vtid if vtid else DEFAULT ) #NEWLINE# if ( fld not in self . mount_all [ position ] [ dirs_only ] ) : #NEWLINE# #INDENT# self . mount_all [ position ] [ dirs_only ] [ fld ] = set ( [ ] ) #NEWLINE# #UNINDENT# self . mount_all [ position ] [ dirs_only ] [ fld ] . update ( nfs_shares ) #NEWLINE# #UNINDENT# return self . mount_all [ position ] [ dirs_only ]