diff options
author | Zuul <zuul@review.opendev.org> | 2023-01-11 21:24:03 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2023-01-11 21:24:03 +0000 |
commit | b83120cf98e97e64524bb699f3e886c02f7b4a7e (patch) | |
tree | 95c6acbf3ba21c8fe6972e5efb60b6ef8864557b /nova/compute | |
parent | bd9de5e0456b779cfa145377a86411096423e1cd (diff) | |
parent | fa4832c6605b472919e662aa05670a1b0804def6 (diff) | |
download | nova-b83120cf98e97e64524bb699f3e886c02f7b4a7e.tar.gz |
Merge "Support same host resize with PCI in placement"
Diffstat (limited to 'nova/compute')
-rw-r--r-- | nova/compute/resource_tracker.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/nova/compute/resource_tracker.py b/nova/compute/resource_tracker.py index ab60c77d96..4e8ae6b2e6 100644 --- a/nova/compute/resource_tracker.py +++ b/nova/compute/resource_tracker.py @@ -619,18 +619,11 @@ class ResourceTracker(object): :param prefix: Prefix to use when accessing migration context attributes. 'old_' or 'new_', with 'new_' being the default. """ - # Remove usage for an instance that is tracked in migrations, such as - # on the dest node during revert resize. - if instance['uuid'] in self.tracked_migrations: - migration = self.tracked_migrations.pop(instance['uuid']) + if instance["uuid"] in self.tracked_migrations: if not flavor: - flavor = self._get_flavor(instance, prefix, migration) - # Remove usage for an instance that is not tracked in migrations (such - # as on the source node after a migration). - # NOTE(lbeliveau): On resize on the same node, the instance is - # included in both tracked_migrations and tracked_instances. - elif instance['uuid'] in self.tracked_instances: - self.tracked_instances.remove(instance['uuid']) + flavor = self._get_flavor( + instance, prefix, self.tracked_migrations[instance["uuid"]] + ) if flavor is not None: numa_topology = self._get_migration_context_resource( @@ -646,6 +639,15 @@ class ResourceTracker(object): ctxt = context.elevated() self._update(ctxt, self.compute_nodes[nodename]) + # Remove usage for an instance that is tracked in migrations, such as + # on the dest node during revert resize. + self.tracked_migrations.pop(instance['uuid'], None) + # Remove usage for an instance that is not tracked in migrations (such + # as on the source node after a migration). + # NOTE(lbeliveau): On resize on the same node, the instance is + # included in both tracked_migrations and tracked_instances. + self.tracked_instances.discard(instance['uuid']) + @utils.synchronized(COMPUTE_RESOURCE_SEMAPHORE, fair=True) def update_usage(self, context, instance, nodename): """Update the resource usage and stats after a change in an |