Before saving instance with new host(destination host) in rebuild_instance(),
2931 def rebuild_instance(self, context, instance, orig_image_ref, image_ref,
2932 +--136 lines: injected_files, new_pass, orig_sys_metadata,-------------------------------------------------------------------
3068 instance.apply_migration_context()
3069 # NOTE (ndipanov): This save will now update the host and node
3070 # attributes making sure that next RT pass is consistent since
3071 # it will be based on the instance and not the migration DB
3072 # entry.
3073 instance.host = self.host
3074 instance.node = scheduled_node
3075 instance.save()
3076 instance.drop_migration_context()
3077
3078 # NOTE (ndipanov): Mark the migration as done only after we
3079 # mark the instance as belonging to this host.
3080 self._set_migration_status(migration, 'done')
resource tracker(RT) may get instances by get_by_host_and_node()
743 def _update_available_resource(self, context, resources):
744 +-- 12 lines: # initialize the compute node object, creating it--------------------------------------------------------------
756 # Grab all instances assigned to this node:
757 instances = objects.InstanceList.get_by_host_and_node(
and after saving instance host(destination host) and set the migration status to 'done', RT get the migrations.
Before saving instance with new host(destination host) in rebuild_instance(),
2931 def rebuild_ instance( self, context, instance, orig_image_ref, image_ref, metadata, ------- ------- ------- ------- ------- ------- ------- ------- ------- ---- apply_migration _context( ) drop_migration_ context( ) migration_ status( migration, 'done')
2932 +--136 lines: injected_files, new_pass, orig_sys_
3068 instance.
3069 # NOTE (ndipanov): This save will now update the host and node
3070 # attributes making sure that next RT pass is consistent since
3071 # it will be based on the instance and not the migration DB
3072 # entry.
3073 instance.host = self.host
3074 instance.node = scheduled_node
3075 instance.save()
3076 instance.
3077
3078 # NOTE (ndipanov): Mark the migration as done only after we
3079 # mark the instance as belonging to this host.
3080 self._set_
resource tracker(RT) may get instances by get_by_ host_and_ node()
743 def _update_ available_ resource( self, context, resources): ------- ------- ------- ------- ------- ------- ------- ------- - InstanceList. get_by_ host_and_ node(
744 +-- 12 lines: # initialize the compute node object, creating it-----
756 # Grab all instances assigned to this node:
757 instances = objects.
and after saving instance host(destination host) and set the migration status to 'done', RT get the migrations.
767 # Grab all in-progress migrations: MigrationList. get_in_ progress_ by_host_ and_node(
768 migrations = objects.
769 context, self.host, nodename)
770
After these situation, pci devices are free by clean_usage()
789 self.pci_ tracker. clean_usage( instances, migrations, orphans)