def pvremove(devices, override=True):
 if isinstance(devices, six.string_types):
  devices = devices.split(',')
 cmd = ['pvremove', '-y']
 for device in devices:
  if pvdisplay(device):
   cmd.append(device)
  elif (not override):
   raise CommandExecutionError('{0} is not a physical volume'.format(device))
 if (not cmd[2:]):
  return True
 out = __salt__['cmd.run_all'](cmd, python_shell=False)
 if out.get('retcode'):
  raise CommandExecutionError(out.get('stderr'))
 for device in devices:
  if pvdisplay(device):
   raise CommandExecutionError('Device "{0}" was not affected.'.format(device))
 return True

def pvremove ( devices , override = True ) : if isinstance ( devices , six . string_types ) : devices = devices . split ( ',' ) cmd = [ 'pvremove' , '-y' ] for device in devices : if pvdisplay ( device ) : cmd . append ( device ) elif ( not override ) : raise CommandExecutionError ( '{0} is not a physical volume' . format ( device ) ) if ( not cmd [ 2 : ] ) : return True out = __salt__ [ 'cmd.run_all' ] ( cmd , python_shell = False ) if out . get ( 'retcode' ) : raise CommandExecutionError ( out . get ( 'stderr' ) ) for device in devices : if pvdisplay ( device ) : raise CommandExecutionError ( 'Device "{0}" was not affected.' . format ( device ) ) return True
remove a physical device being used as an lvm physical volume override skip devices .