def delete_disk(kwargs=None, call=None):
 if (call != 'function'):
  raise SaltCloudSystemExit('The delete_disk function must be called with -f or --function.')
 if ((not kwargs) or ('disk_name' not in kwargs)):
  log.error('A disk_name must be specified when deleting a disk.')
  return False
 conn = get_conn()
 disk = conn.ex_get_volume(kwargs.get('disk_name'))
 __utils__['cloud.fire_event']('event', 'delete disk', 'salt/cloud/disk/deleting', args={'name': disk.name, 'location': disk.extra['zone'].name, 'size': disk.size}, sock_dir=__opts__['sock_dir'], transport=__opts__['transport'])
 try:
  result = conn.destroy_volume(disk)
 except ResourceInUseError as exc:
  log.error('Disk {0} is in use and must be detached before deleting.\nThe following exception was thrown by libcloud:\n{1}'.format(disk.name, exc), exc_info_on_loglevel=logging.DEBUG)
  return False
 __utils__['cloud.fire_event']('event', 'deleted disk', 'salt/cloud/disk/deleted', args={'name': disk.name, 'location': disk.extra['zone'].name, 'size': disk.size}, sock_dir=__opts__['sock_dir'], transport=__opts__['transport'])
 return result

def delete_disk ( kwargs = None , call = None ) : if ( call != 'function' ) : raise SaltCloudSystemExit ( 'The delete_disk function must be called with -f or --function.' ) if ( ( not kwargs ) or ( 'disk_name' not in kwargs ) ) : log . error ( 'A disk_name must be specified when deleting a disk.' ) return False conn = get_conn ( ) disk = conn . ex_get_volume ( kwargs . get ( 'disk_name' ) ) __utils__ [ 'cloud.fire_event' ] ( 'event' , 'delete disk' , 'salt/cloud/disk/deleting' , args = { 'name' : disk . name , 'location' : disk . extra [ 'zone' ] . name , 'size' : disk . size } , sock_dir = __opts__ [ 'sock_dir' ] , transport = __opts__ [ 'transport' ] ) try : result = conn . destroy_volume ( disk ) except ResourceInUseError as exc : log . error ( 'Disk {0} is in use and must be detached before deleting.\nThe following exception was thrown by libcloud:\n{1}' . format ( disk . name , exc ) , exc_info_on_loglevel = logging . DEBUG ) return False __utils__ [ 'cloud.fire_event' ] ( 'event' , 'deleted disk' , 'salt/cloud/disk/deleted' , args = { 'name' : disk . name , 'location' : disk . extra [ 'zone' ] . name , 'size' : disk . size } , sock_dir = __opts__ [ 'sock_dir' ] , transport = __opts__ [ 'transport' ] ) return result
permanently delete a persistent disk .