commit 818419c9d313bd6151d1a05b3a087a15116f61b8
Author: Matt Riedemann <email address hidden>
Date: Wed Jun 26 13:26:44 2019 -0400
Fix AttributeError in RT._update_usage_from_migration
Change Ieb539c9a0cfbac743c579a1633234537a8e3e3ee in Stein
added some logging in _update_usage_from_migration to log
the flavor for an inbound and outbound migration.
If an instance is resized and then the resize is immediately
confirmed, it's possible to race with ComputeManager._confirm_resize
setting the instance.old_flavor to None before the migration
status is changed to "confirmed" while the update_available_resource
periodic is running which will result in _update_usage_from_migration
hitting an AttributeError when trying to log instance.old_flavor.flavorid
since instance.old_flavor is None.
There are a few key points there:
- We get into _update_usage_from_migration because the
_update_available_resource method gets in-progress migrations
related to the host (in this case the source compute) and the
migration is consider in-progress until its status is "confirmed".
- The instance is not in the tracked_instances dict when
_update_usage_from_migration runs because RT only tracks instances
where the instance.host matches the RT.host and in this case the
instance has been resized to another compute and the instance.host
is pointing at the dest compute.
The fix here is to simply check if we got the instance.old_flavor and
not log the message if we do not have it, which gets us back to the old
behavior.
This bug was found by noticing it in CI job logs - there is a link to
hits in logstash in the bug report.
As for the "incoming and not tracked" case in _update_usage_from_migration
I have not modified that since I am not sure we have the same race nor
have I seen it in CI logs.
Reviewed: https:/ /review. opendev. org/667687 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=818419c9d31 3bd6151d1a05b3a 087a15116f61b8
Committed: https:/
Submitter: Zuul
Branch: master
commit 818419c9d313bd6 151d1a05b3a087a 15116f61b8
Author: Matt Riedemann <email address hidden>
Date: Wed Jun 26 13:26:44 2019 -0400
Fix AttributeError in RT._update_ usage_from_ migration
Change Ieb539c9a0cfbac 743c579a1633234 537a8e3e3ee in Stein usage_from_ migration to log
added some logging in _update_
the flavor for an inbound and outbound migration.
If an instance is resized and then the resize is immediately _confirm_ resize available_ resource usage_from_ migration old_flavor. flavorid
confirmed, it's possible to race with ComputeManager.
setting the instance.old_flavor to None before the migration
status is changed to "confirmed" while the update_
periodic is running which will result in _update_
hitting an AttributeError when trying to log instance.
since instance.old_flavor is None.
There are a few key points there:
- We get into _update_ usage_from_ migration because the update_ available_ resource method gets in-progress migrations
_
related to the host (in this case the source compute) and the
migration is consider in-progress until its status is "confirmed".
- The instance is not in the tracked_instances dict when update_ usage_from_ migration runs because RT only tracks instances
_
where the instance.host matches the RT.host and in this case the
instance has been resized to another compute and the instance.host
is pointing at the dest compute.
The fix here is to simply check if we got the instance.old_flavor and
not log the message if we do not have it, which gets us back to the old
behavior.
This bug was found by noticing it in CI job logs - there is a link to
hits in logstash in the bug report.
As for the "incoming and not tracked" case in _update_ usage_from_ migration
I have not modified that since I am not sure we have the same race nor
have I seen it in CI logs.
Change-Id: I43e34b3ff1424d 42632a3e8f842c9 3508905aa1a
Closes-Bug: #1834349