def find_job_type(guest, instance):
 try:
  if guest.is_active():
   LOG.debug('VM running on src, migration failed', instance=instance)
   return libvirt.VIR_DOMAIN_JOB_FAILED
  else:
   LOG.debug('VM is shutoff, migration finished', instance=instance)
   return libvirt.VIR_DOMAIN_JOB_COMPLETED
 except libvirt.libvirtError as ex:
  LOG.debug('Error checking domain status %(ex)s', {'ex': ex}, instance=instance)
  if (ex.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN):
   LOG.debug('VM is missing, migration finished', instance=instance)
   return libvirt.VIR_DOMAIN_JOB_COMPLETED
  else:
   LOG.info(_LI('Error %(ex)s, migration failed'), {'ex': ex}, instance=instance)
   return libvirt.VIR_DOMAIN_JOB_FAILED

def find_job_type ( guest , instance ) : try : if guest . is_active ( ) : LOG . debug ( 'VM running on src, migration failed' , instance = instance ) return libvirt . VIR_DOMAIN_JOB_FAILED else : LOG . debug ( 'VM is shutoff, migration finished' , instance = instance ) return libvirt . VIR_DOMAIN_JOB_COMPLETED except libvirt . libvirtError as ex : LOG . debug ( 'Error checking domain status %(ex)s' , { 'ex' : ex } , instance = instance ) if ( ex . get_error_code ( ) == libvirt . VIR_ERR_NO_DOMAIN ) : LOG . debug ( 'VM is missing, migration finished' , instance = instance ) return libvirt . VIR_DOMAIN_JOB_COMPLETED else : LOG . info ( _LI ( 'Error %(ex)s, migration failed' ) , { 'ex' : ex } , instance = instance ) return libvirt . VIR_DOMAIN_JOB_FAILED
determine the current migration job type .