Looks like expected_task_state is pulled from the values dict here:

https://github.com/openstack/nova/blob/1a226aaa9e8c969ddfdfe198c36f7966b1f692f3/nova/db/sqlalchemy/api.py#L2850

and if not None converted to a list here:

https://github.com/openstack/nova/blob/1a226aaa9e8c969ddfdfe198c36f7966b1f692f3/nova/db/sqlalchemy/api.py#L2857

So I guess that's why things work and I can close this bug - there are
wrong uses of expected_task_state for the Instance.save but the DB API
handles it.

** Changed in: nova
       Status: Triaged => Invalid

-- 
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):
  Invalid

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

-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to