def pvdisplay(pvname='', real=False):
 ret = {}
 cmd = ['pvdisplay', '-c']
 if pvname:
  cmd.append(pvname)
 cmd_ret = __salt__['cmd.run_all'](cmd, python_shell=False)
 if (cmd_ret['retcode'] != 0):
  return {}
 out = cmd_ret['stdout'].splitlines()
 for line in out:
  if ('is a new physical volume' not in line):
   comps = line.strip().split(':')
   if real:
    device = os.path.realpath(comps[0])
   else:
    device = comps[0]
   ret[device] = {'Physical Volume Device': comps[0], 'Volume Group Name': comps[1], 'Physical Volume Size (kB)': comps[2], 'Internal Physical Volume Number': comps[3], 'Physical Volume Status': comps[4], 'Physical Volume (not) Allocatable': comps[5], 'Current Logical Volumes Here': comps[6], 'Physical Extent Size (kB)': comps[7], 'Total Physical Extents': comps[8], 'Free Physical Extents': comps[9], 'Allocated Physical Extents': comps[10]}
   if real:
    ret[device]['Real Physical Volume Device'] = device
 return ret

def pvdisplay ( pvname = '' , real = False ) : ret = { } cmd = [ 'pvdisplay' , '-c' ] if pvname : cmd . append ( pvname ) cmd_ret = __salt__ [ 'cmd.run_all' ] ( cmd , python_shell = False ) if ( cmd_ret [ 'retcode' ] != 0 ) : return { } out = cmd_ret [ 'stdout' ] . splitlines ( ) for line in out : if ( 'is a new physical volume' not in line ) : comps = line . strip ( ) . split ( ':' ) if real : device = os . path . realpath ( comps [ 0 ] ) else : device = comps [ 0 ] ret [ device ] = { 'Physical Volume Device' : comps [ 0 ] , 'Volume Group Name' : comps [ 1 ] , 'Physical Volume Size (kB)' : comps [ 2 ] , 'Internal Physical Volume Number' : comps [ 3 ] , 'Physical Volume Status' : comps [ 4 ] , 'Physical Volume (not) Allocatable' : comps [ 5 ] , 'Current Logical Volumes Here' : comps [ 6 ] , 'Physical Extent Size (kB)' : comps [ 7 ] , 'Total Physical Extents' : comps [ 8 ] , 'Free Physical Extents' : comps [ 9 ] , 'Allocated Physical Extents' : comps [ 10 ] } if real : ret [ device ] [ 'Real Physical Volume Device' ] = device return ret
return information about the physical volume(s) pvname physical device name real dereference any symlinks and report the real device .