def pv_present(name, **kwargs):
 ret = {'changes': {}, 'comment': '', 'name': name, 'result': True}
 if __salt__['lvm.pvdisplay'](name):
  ret['comment'] = 'Physical Volume {0} already present'.format(name)
 elif __opts__['test']:
  ret['comment'] = 'Physical Volume {0} is set to be created'.format(name)
  ret['result'] = None
  return ret
 else:
  changes = __salt__['lvm.pvcreate'](name, **kwargs)
  if __salt__['lvm.pvdisplay'](name):
   ret['comment'] = 'Created Physical Volume {0}'.format(name)
   ret['changes']['created'] = changes
  else:
   ret['comment'] = 'Failed to create Physical Volume {0}'.format(name)
   ret['result'] = False
 return ret

def pv_present ( name , ** kwargs ) : ret = { 'changes' : { } , 'comment' : '' , 'name' : name , 'result' : True } if __salt__ [ 'lvm.pvdisplay' ] ( name ) : ret [ 'comment' ] = 'Physical Volume {0} already present' . format ( name ) elif __opts__ [ 'test' ] : ret [ 'comment' ] = 'Physical Volume {0} is set to be created' . format ( name ) ret [ 'result' ] = None return ret else : changes = __salt__ [ 'lvm.pvcreate' ] ( name , ** kwargs ) if __salt__ [ 'lvm.pvdisplay' ] ( name ) : ret [ 'comment' ] = 'Created Physical Volume {0}' . format ( name ) ret [ 'changes' ] [ 'created' ] = changes else : ret [ 'comment' ] = 'Failed to create Physical Volume {0}' . format ( name ) ret [ 'result' ] = False return ret
set a physical device to be used as an lvm physical volume name the device name to initialize .