def migrate_instances_add_request_spec(context, max_count):
 marker = _get_marker_for_migrate_instances(context)
 attrs = ['system_metadata', 'flavor', 'pci_requests', 'numa_topology', 'availability_zone']
 instances = objects.InstanceList.get_by_filters(context, filters={'deleted': False}, sort_key='created_at', sort_dir='asc', limit=max_count, marker=marker, expected_attrs=attrs)
 count_all = len(instances)
 count_hit = 0
 for instance in instances:
  try:
   RequestSpec.get_by_instance_uuid(context, instance.uuid)
  except exception.RequestSpecNotFound:
   _create_minimal_request_spec(context, instance)
   count_hit += 1
 if (count_all > 0):
  marker = instances[(-1)].uuid
 _set_or_delete_marker_for_migrate_instances(context, marker)
 return (count_all, count_hit)

def migrate_instances_add_request_spec ( context , max_count ) : marker = _get_marker_for_migrate_instances ( context ) attrs = [ 'system_metadata' , 'flavor' , 'pci_requests' , 'numa_topology' , 'availability_zone' ] instances = objects . InstanceList . get_by_filters ( context , filters = { 'deleted' : False } , sort_key = 'created_at' , sort_dir = 'asc' , limit = max_count , marker = marker , expected_attrs = attrs ) count_all = len ( instances ) count_hit = 0 for instance in instances : try : RequestSpec . get_by_instance_uuid ( context , instance . uuid ) except exception . RequestSpecNotFound : _create_minimal_request_spec ( context , instance ) count_hit += 1 if ( count_all > 0 ) : marker = instances [ ( - 1 ) ] . uuid _set_or_delete_marker_for_migrate_instances ( context , marker ) return ( count_all , count_hit )
creates and persists a requestspec per instance not yet having it .