yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #80398
[Bug 1848373] [NEW] Instance.save(expected_task_state=) is passed string in many locations
Public bug reported:
I noticed this in some code I was writing when it didn't behave like I
expected:
https://review.opendev.org/#/c/627891/63/nova/conductor/tasks/cross_cell_migrate.py@423
https://review.opendev.org/#/c/688832/2/nova/conductor/tasks/cross_cell_migrate.py@781
That "works" because strings are iterable but it's not the intended use
of that kwarg which should be None or a list or tuple:
https://github.com/openstack/nova/blob/1a226aaa9e8c969ddfdfe198c36f7966b1f692f3/nova/objects/instance.py#L758
We have several places that incorrectly pass a string though, here are a
couple:
https://github.com/openstack/nova/blob/1a226aaa9e8c969ddfdfe198c36f7966b1f692f3/nova/compute/api.py#L3228
https://github.com/openstack/nova/blob/1a226aaa9e8c969ddfdfe198c36f7966b1f692f3/nova/compute/manager.py#L2554
https://github.com/openstack/nova/blob/1a226aaa9e8c969ddfdfe198c36f7966b1f692f3/nova/compute/manager.py#L3103
The Instance.save() method should probably assert that if the value is
not None that it's not a string type since the latter is a coding error.
** Affects: nova
Importance: Medium
Status: Triaged
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1848373
Title:
Instance.save(expected_task_state=) is passed string in many locations
Status in OpenStack Compute (nova):
Triaged
Bug description:
I noticed this in some code I was writing when it didn't behave like I
expected:
https://review.opendev.org/#/c/627891/63/nova/conductor/tasks/cross_cell_migrate.py@423
https://review.opendev.org/#/c/688832/2/nova/conductor/tasks/cross_cell_migrate.py@781
That "works" because strings are iterable but it's not the intended
use of that kwarg which should be None or a list or tuple:
https://github.com/openstack/nova/blob/1a226aaa9e8c969ddfdfe198c36f7966b1f692f3/nova/objects/instance.py#L758
We have several places that incorrectly pass a string though, here are
a couple:
https://github.com/openstack/nova/blob/1a226aaa9e8c969ddfdfe198c36f7966b1f692f3/nova/compute/api.py#L3228
https://github.com/openstack/nova/blob/1a226aaa9e8c969ddfdfe198c36f7966b1f692f3/nova/compute/manager.py#L2554
https://github.com/openstack/nova/blob/1a226aaa9e8c969ddfdfe198c36f7966b1f692f3/nova/compute/manager.py#L3103
The Instance.save() method should probably assert that if the value is
not None that it's not a string type since the latter is a coding
error.
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1848373/+subscriptions
Follow ups