def destroy_vm(session, instance, vm_ref=None):
 try:
  if (not vm_ref):
   vm_ref = get_vm_ref(session, instance)
  LOG.debug('Destroying the VM', instance=instance)
  destroy_task = session._call_method(session.vim, 'Destroy_Task', vm_ref)
  session._wait_for_task(destroy_task)
  LOG.info(_LI('Destroyed the VM'), instance=instance)
 except Exception:
  LOG.exception(_LE('Destroy VM failed'), instance=instance)

def destroy_vm ( session , instance , vm_ref = None ) : try : if ( not vm_ref ) : vm_ref = get_vm_ref ( session , instance ) LOG . debug ( 'Destroying the VM' , instance = instance ) destroy_task = session . _call_method ( session . vim , 'Destroy_Task' , vm_ref ) session . _wait_for_task ( destroy_task ) LOG . info ( _LI ( 'Destroyed the VM' ) , instance = instance ) except Exception : LOG . exception ( _LE ( 'Destroy VM failed' ) , instance = instance )
destroys a vm record .