def run_tasks(guest, instance, active_migrations, on_migration_failure, migration, is_post_copy_enabled):
 tasks = active_migrations.get(instance.uuid, deque())
 while tasks:
  task = tasks.popleft()
  if (task == 'force-complete'):
   if (migration.status == 'running (post-copy)'):
    LOG.warning(_LW('Live-migration %s already switched to post-copy mode.'), instance=instance)
   elif is_post_copy_enabled:
    trigger_postcopy_switch(guest, instance, migration)
   else:
    try:
     guest.pause()
     on_migration_failure.append('unpause')
    except Exception as e:
     LOG.warning(_LW('Failed to pause instance during live-migration %s'), e, instance=instance)
  else:
   LOG.warning(_LW("Unknown migration task '%(task)s'"), {'task': task}, instance=instance)

def run_tasks ( guest , instance , active_migrations , on_migration_failure , migration , is_post_copy_enabled ) : tasks = active_migrations . get ( instance . uuid , deque ( ) ) while tasks : task = tasks . popleft ( ) if ( task == 'force-complete' ) : if ( migration . status == 'running (post-copy)' ) : LOG . warning ( _LW ( 'Live-migration %s already switched to post-copy mode.' ) , instance = instance ) elif is_post_copy_enabled : trigger_postcopy_switch ( guest , instance , migration ) else : try : guest . pause ( ) on_migration_failure . append ( 'unpause' ) except Exception as e : LOG . warning ( _LW ( 'Failed to pause instance during live-migration %s' ) , e , instance = instance ) else : LOG . warning ( _LW ( "Unknown migration task '%(task)s'" ) , { 'task' : task } , instance = instance )
run any pending migration tasks .