fill_virtual_interface_list migration fails on second attempt
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Medium
|
melanie witt | ||
Stein |
Fix Committed
|
Medium
|
melanie witt | ||
Train |
Fix Committed
|
Medium
|
melanie witt |
Bug Description
On attempting to run online_
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage [req-6cb533e2-
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage Traceback (most recent call last):
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage File "/usr/lib/
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage found, done = migration_
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage File "/usr/lib/
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage return fn(*args, **kwargs)
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage File "/usr/lib/
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage _set_or_
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage File "/usr/lib/
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage return f(context, *args, **kwargs)
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage File "/usr/lib/
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage instance.create()
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage File "/usr/lib/
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage return fn(self, *args, **kwargs)
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage File "/usr/lib/
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage db_inst = db.instance_
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage File "/usr/lib/
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage return IMPL.instance_
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage File "/usr/lib/
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage return f(*args, **kwargs)
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage File "/usr/lib/
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage ectxt.value = e.inner_exc
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage File "/usr/lib/
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage self.force_
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage File "/usr/lib/
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage six.reraise(
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage File "/usr/lib/
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage return f(*args, **kwargs)
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage File "/usr/lib/
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage return f(context, *args, **kwargs)
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage File "/usr/lib/
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage security_
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage File "/usr/lib/
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage return _security_
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage File "/usr/lib/
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage return f(context, *args, **kwargs)
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage File "/usr/lib/
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage default_group = _security_
2019-04-11 03:51:27.632 22147 ERROR nova.cmd.manage TypeError: 'NoneType' object has no attribute '__getitem__'
mysql> select * from security_groups;
+------
| created_at | updated_at | deleted_at | id | name | description | user_id | project_id | deleted |
+------
| 2019-04-09 23:23:10 | NULL | NULL | 1 | default | default | 7ed07a8869044a4
| 2019-04-11 01:11:05 | NULL | NULL | 2 | default | default | NULL | NULL | 0 |
| 2019-04-11 01:11:05 | NULL | NULL | 3 | default | default | NULL | NULL | 0 |
+------
3 rows in set (0.00 sec)
Changed in nova: | |
importance: | High → Medium |
It's because the context doesn't have a project_id so the first pass creates a record with project_id=None:
https:/ /github. com/openstack/ nova/blob/ 03322bb517925a9 f5a04ebdb41c3fd 31e7962440/ nova/db/ sqlalchemy/ api.py# L4037
There is also a unique constraint on project_ id/name/ deleted:
https:/ /github. com/openstack/ nova/blob/ 01c33c584f7209a e02bc537adea855 02d52f1c22/ nova/db/ sqlalchemy/ models. py#L660
The migration is just using an admin context which doesn't have a project_id:
https:/ /github. com/openstack/ nova/blob/ f853e04cd22acc3 6c906ffb2908416 0fa05d1ebd/ nova/cmd/ manage. py#L715
https:/ /github. com/openstack/ nova/blob/ f853e04cd22acc3 6c906ffb2908416 0fa05d1ebd/ nova/context. py#L292