"nova list --delete" failed due to InstanceNotFound exception
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
In Progress
|
Undecided
|
WeiguoFan |
Bug Description
Description
===========
When I run "nova list --delete" on our OpenStack environment(
------------
ERROR (ClientException): Unexpected API Error. Please report this at http://
<class 'nova.exception
------------
Note: I reproduced it on our Newton(RHOSP10) environment too.
And the following messages was outputted from nova-api.log.
-------
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
2016-11-25 11:22:25.660 21809 ERROR nova.api.
-------
I noticed that when this problem happened, there were 2 records about the
instance(
instance_extra table of nova DB. And one of their flavor is NULL.
--------
# mysql -u root nova -e "select * from instance_extra where instance_
*******
created_at: 2016-11-16 07:25:09
updated_at: 2016-11-16 07:27:24
deleted_at: 2016-11-16 07:27:26
deleted: 5837
id: 5837
instance_uuid: decfb2f4-
numa_topology: NULL
pci_requests: []
flavor: {"new": null, "old": null, "cur": {"nova_
.....
*******
created_at: 2016-11-16 07:27:26
updated_at: NULL
deleted_at: NULL
deleted: 0
id: 5838
instance_uuid: decfb2f4-
numa_topology: NULL
pci_requests: []
flavor: NULL
.....
--------
According to my investigating, in the current instance_
when updating an instance, if there is no entry for an instance, nova create
a new entry for it. For somehow, if updating comes after the instance has been deleted
(its entry would be soft-deleted), nova would create a new entry for
the deleted instance and keep its flavor being NULL. It causes instance_extra
entry duplicate for the same instance_uuid. I think it cause this problem.
Steps to reproduce
==================
I can reproduce the problem with the following steps.
Note: please notice it's timing problem. It doesn't alway heppen.
But once it happened, it can be reproduced always.
Unless you delete the duplicate entry from instance_extra table.
1, Boot an instance. Meanwhile stop rabbitmq-server.
2, Restart rabbitmq-server.
3, Delete the instance.
4, Run "nova list --delete".
For those deleted instance, I think we shouldn't
create a new entry for it. It's better to just skip the "updating".
Changed in nova: | |
assignee: | nobody → wei-fan@rc.jp.nec.com (wei-fan) |
information type: | Public → Public Security |
information type: | Public Security → Public |
Changed in nova: | |
assignee: | WeiguoFan (wei-fan) → Stephen Finucane (stephenfinucane) |
Changed in nova: | |
assignee: | Stephen Finucane (stephenfinucane) → WeiguoFan (wei-fan) |
Fix proposed to branch: master /review. openstack. org/412771
Review: https:/