def update_downtime(guest, instance, olddowntime, downtime_steps, elapsed):
 LOG.debug('Current %(dt)s elapsed %(elapsed)d steps %(steps)s', {'dt': olddowntime, 'elapsed': elapsed, 'steps': downtime_steps}, instance=instance)
 thisstep = None
 for step in downtime_steps:
  if (elapsed > step[0]):
   thisstep = step
 if (thisstep is None):
  LOG.debug('No current step', instance=instance)
  return olddowntime
 if (thisstep[1] == olddowntime):
  LOG.debug('Downtime does not need to change', instance=instance)
  return olddowntime
 LOG.info(_LI('Increasing downtime to %(downtime)d ms after %(waittime)d sec elapsed time'), {'downtime': thisstep[1], 'waittime': thisstep[0]}, instance=instance)
 try:
  guest.migrate_configure_max_downtime(thisstep[1])
 except libvirt.libvirtError as e:
  LOG.warning(_LW('Unable to increase max downtime to %(time)dms: %(e)s'), {'time': thisstep[1], 'e': e}, instance=instance)
 return thisstep[1]

def update_downtime ( guest , instance , olddowntime , downtime_steps , elapsed ) : LOG . debug ( 'Current %(dt)s elapsed %(elapsed)d steps %(steps)s' , { 'dt' : olddowntime , 'elapsed' : elapsed , 'steps' : downtime_steps } , instance = instance ) thisstep = None for step in downtime_steps : if ( elapsed > step [ 0 ] ) : thisstep = step if ( thisstep is None ) : LOG . debug ( 'No current step' , instance = instance ) return olddowntime if ( thisstep [ 1 ] == olddowntime ) : LOG . debug ( 'Downtime does not need to change' , instance = instance ) return olddowntime LOG . info ( _LI ( 'Increasing downtime to %(downtime)d ms after %(waittime)d sec elapsed time' ) , { 'downtime' : thisstep [ 1 ] , 'waittime' : thisstep [ 0 ] } , instance = instance ) try : guest . migrate_configure_max_downtime ( thisstep [ 1 ] ) except libvirt . libvirtError as e : LOG . warning ( _LW ( 'Unable to increase max downtime to %(time)dms: %(e)s' ) , { 'time' : thisstep [ 1 ] , 'e' : e } , instance = instance ) return thisstep [ 1 ]
update max downtime if needed .