commit 50a0c6a4b98a3ef1d893b0bb204a4a4868017cbb
Author: Stephen Finucane <email address hidden>
Date: Tue Mar 26 13:32:56 2019 +0000
[Stable Only] hardware: Handle races during pinning
Due to how we do claiming of pinned CPUs and related NUMA "things", it's
possible for claims to race. This raciness is usually not an issue since
pinning with fail for the losing instance, which will just get
rescheduled. This does mean that it's possible for an instance to land
on a host with no CPUs at all though and this edge case is triggering a
nasty bug made possible by Python's unusual scoping rules around for
loops.
>>> x = 5
>>> for y in range(x):
... pass
...
>>> print(y)
4
'y' would be considered out of scope in the above for most other
languages (JS and its even dumber scoping rules aside, I guess) and it
leaves us with situations where the variable might never exist, i.e. the
bug at hand:
>>> x = 0
>>> for y in range(x):
... pass
...
>>> print(y)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'y' is not defined
Resolve this by adding a check to handle the "no CPUs at all" case and
quick fail but also remove the reliance on this quirk of Python.
This doesn't apply to stable/rocky since the issue was inadvertently
resolved by changes I8982ab25338969cd98621f79b7fbec8af43d12c5 and
I021ce59048d6292055af49457ba642022f648c81. However, those changes are
significantly larger and backports have been previously rejected [1][2].
Reviewed: https:/ /review. openstack. org/647831 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=50a0c6a4b98 a3ef1d893b0bb20 4a4a4868017cbb
Committed: https:/
Submitter: Zuul
Branch: stable/queens
commit 50a0c6a4b98a3ef 1d893b0bb204a4a 4868017cbb
Author: Stephen Finucane <email address hidden>
Date: Tue Mar 26 13:32:56 2019 +0000
[Stable Only] hardware: Handle races during pinning
Due to how we do claiming of pinned CPUs and related NUMA "things", it's
possible for claims to race. This raciness is usually not an issue since
pinning with fail for the losing instance, which will just get
rescheduled. This does mean that it's possible for an instance to land
on a host with no CPUs at all though and this edge case is triggering a
nasty bug made possible by Python's unusual scoping rules around for
loops.
>>> x = 5
>>> for y in range(x):
... pass
...
>>> print(y)
4
'y' would be considered out of scope in the above for most other
languages (JS and its even dumber scoping rules aside, I guess) and it
leaves us with situations where the variable might never exist, i.e. the
bug at hand:
>>> x = 0
>>> for y in range(x):
... pass
...
>>> print(y)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'y' is not defined
Resolve this by adding a check to handle the "no CPUs at all" case and
quick fail but also remove the reliance on this quirk of Python.
This doesn't apply to stable/rocky since the issue was inadvertently cd98621f79b7fbe c8af43d12c5 and d6292055af49457 ba642022f648c81 . However, those changes are
resolved by changes I8982ab25338969
I021ce59048
significantly larger and backports have been previously rejected [1][2].
[1] https:/ /review. openstack. org/#/c/ 588570/ /review. openstack. org/#/c/ 588571/
[2] https:/
Change-Id: I6afc3af9f13e3c 1cc312112eb28eb 6e10d2a9e07
Signed-off-by: Stephen Finucane <email address hidden>
Closes-Bug: #1821733