HostMappingNotFound in wigi.py

Bug #1852665 reported by hua zhao
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
New
Undecided
Unassigned

Bug Description

It seems to be diffrent from #1780727.

# openstack compute service delete 26

Failed to delete compute service with ID '26': 发生意外 API 错误。请在 http://bugs.launchpad.net/nova/ 处报告此错误,并且附上 Nova API 日志(如果可能)。
<class 'nova.exception.HostMappingNotFound'> (HTTP 500) (Request-ID: req-a693a664-5834-48c6-acd9-c92d8b2eea28)

nova-api-log:
2019-11-15 08:41:23.576 11235 ERROR nova.api.openstack.wsgi [req-099cb32c-dfbb-4eaf-a067-a3737720977f 7c177645d83f4a769d51ab4b9801a90d 04627ab3503248cb8d714ac1a44f543f - default default] Unexpected exception in API method: HostMappingNotFound: \u4e3b\u673a 'computer3713hpdl580'\u6ca1\u6709\u6620\u5c04\u5230\u4efb\u4f55\u5355\u5143
2019-11-15 08:41:23.576 11235 ERROR nova.api.openstack.wsgi Traceback (most recent call last):
2019-11-15 08:41:23.576 11235 ERROR nova.api.openstack.wsgi File "/usr/lib/python2.7/site-packages/nova/api/openstack/wsgi.py", line 801, in wrapped
2019-11-15 08:41:23.576 11235 ERROR nova.api.openstack.wsgi return f(*args, **kwargs)
2019-11-15 08:41:23.576 11235 ERROR nova.api.openstack.wsgi File "/usr/lib/python2.7/site-packages/nova/api/openstack/compute/services.py", line 237, in delete
2019-11-15 08:41:23.576 11235 ERROR nova.api.openstack.wsgi service.host)
2019-11-15 08:41:23.576 11235 ERROR nova.api.openstack.wsgi File "/usr/lib/python2.7/site-packages/nova/exception_wrapper.py", line 79, in wrapped
2019-11-15 08:41:23.576 11235 ERROR nova.api.openstack.wsgi function_name, call_dict, binary, tb)
2019-11-15 08:41:23.576 11235 ERROR nova.api.openstack.wsgi File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
2019-11-15 08:41:23.576 11235 ERROR nova.api.openstack.wsgi self.force_reraise()
2019-11-15 08:41:23.576 11235 ERROR nova.api.openstack.wsgi File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
2019-11-15 08:41:23.576 11235 ERROR nova.api.openstack.wsgi six.reraise(self.type_, self.value, self.tb)
2019-11-15 08:41:23.576 11235 ERROR nova.api.openstack.wsgi File "/usr/lib/python2.7/site-packages/nova/exception_wrapper.py", line 69, in wrapped
2019-11-15 08:41:23.576 11235 ERROR nova.api.openstack.wsgi return f(self, context, *args, **kw)
2019-11-15 08:41:23.576 11235 ERROR nova.api.openstack.wsgi File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 5416, in remove_host_from_aggregate
2019-11-15 08:41:23.576 11235 ERROR nova.api.openstack.wsgi mapping = objects.HostMapping.get_by_host(context, host_name)
2019-11-15 08:41:23.576 11235 ERROR nova.api.openstack.wsgi File "/usr/lib/python2.7/site-packages/oslo_versionedobjects/base.py", line 184, in wrapper
2019-11-15 08:41:23.576 11235 ERROR nova.api.openstack.wsgi result = fn(cls, context, *args, **kwargs)
2019-11-15 08:41:23.576 11235 ERROR nova.api.openstack.wsgi File "/usr/lib/python2.7/site-packages/nova/objects/host_mapping.py", line 100, in get_by_host
2019-11-15 08:41:23.576 11235 ERROR nova.api.openstack.wsgi db_mapping = cls._get_by_host_from_db(context, host)
2019-11-15 08:41:23.576 11235 ERROR nova.api.openstack.wsgi File "/usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py", line 993, in wrapper
2019-11-15 08:41:23.576 11235 ERROR nova.api.openstack.wsgi return fn(*args, **kwargs)
2019-11-15 08:41:23.576 11235 ERROR nova.api.openstack.wsgi File "/usr/lib/python2.7/site-packages/nova/objects/host_mapping.py", line 95, in _get_by_host_from_db
2019-11-15 08:41:23.576 11235 ERROR nova.api.openstack.wsgi raise exception.HostMappingNotFound(name=host)
2019-11-15 08:41:23.576 11235 ERROR nova.api.openstack.wsgi HostMappingNotFound: \u4e3b\u673a 'computer3713hpdl580'\u6ca1\u6709\u6620\u5c04\u5230\u4efb\u4f55\u5355\u5143
2019-11-15 08:41:23.576 11235 ERROR nova.api.openstack.wsgi

# openstack compute service list |egrep "(3713|ID)"
| ID | Binary | Host | Zone | Status | State | Updated At |
| 26 | nova-compute | computer3713hpdl580 | sugonZone | disabled | down | 2019-07-24T01:25:20.000000 |

# nova service-list |egrep "(3713|Id)"
| Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason | Forced down |
| 8045be15-4866-4d2f-8cb5-79cca0f9744f | nova-compute | computer3713hpdl580 | sugonZone | disabled | down | 2019-07-24T01:25:20.000000 | hostnotexist | False |

# openstack module list
+-----------------+--------+
| Field | Value |
+-----------------+--------+
| barbicanclient | 4.7.2 |
| cinderclient | 4.0.1 |
| designateclient | 2.10.0 |
| keystoneclient | 3.17.0 |
| novaclient | 11.0.0 |
| openstack | 0.17.2 |
| openstackclient | 3.16.2 |
| swiftclient | 3.6.0 |
+-----------------+--------+

Revision history for this message
Matt Riedemann (mriedem) wrote :

Which release is nova in the API?

As you can see from the service listing, nova CLI does it with the latest microversion negotiated between novaclient and the server so you see the service id as a uuid (microversion 2.53+) but openstack compute service list uses microversion 2.1 by default, so you see the int id.

I think the issue is you're trying to delete the service using openstack client but with the integer id and starting in pike you need to use the uuid to uniquely identify the service in a cell.

See the note here:

https://docs.openstack.org/python-openstackclient/latest/cli/command-objects/compute-service.html#compute-service-delete

"If using --os-compute-api-version 2.53 or greater, the ID is a UUID which can be retrieved by listing compute services using the same 2.53+ microversion."

Anyway, try deleting the service using microversion 2.53 and the service id as a uuid and see if that solves the issue.

Changed in nova:
status: New → Invalid
Revision history for this message
hua zhao (noizz) wrote :

The Same error occurred:

# nova service-list|grep 3713
| 8045be15-4866-4d2f-8cb5-79cca0f9744f | nova-compute | computer3713hpdl580 | sugonZone | disabled | down | 2019-07-24T01:25:20.000000 | hostnotexist | False |

# nova version-list
Client supported API versions:
Minimum version 2.1
Maximum version 2.65

Server supported API versions:
+------+-----------+----------------------+-------------+---------+
| Id | Status | Updated | Min Version | Version |
+------+-----------+----------------------+-------------+---------+
| v2.0 | SUPPORTED | 2011-01-21T11:33:21Z | | |
| v2.1 | CURRENT | 2013-07-23T11:33:21Z | 2.1 | 2.65 |
+------+-----------+----------------------+-------------+---------+

# nova --os-compute-api-version 2.65 service-delete 8045be15-4866-4d2f-8cb5-79cca0f9744f
ERROR (ClientException): 发生意外 API 错误。请在 http://bugs.launchpad.net/nova/ 处报告此错误,并且附上 Nova API 日志(如果可能)。
<class 'nova.exception.HostMappingNotFound'> (HTTP 500) (Request-ID: req-c0428f8d-4675-4eb4-b624-6cb0fcf67d01)

nova-api.log:
2019-11-18 11:06:00.842 11208 ERROR nova.api.openstack.wsgi [req-28808744-8bcb-4e18-b48b-c4f8dae60220 7c177645d83f4a769d51ab4b9801a90d 04627ab3503248cb8d714ac1a44f543f - default default] Unexpected exception in API method: HostMappingNotFound: \u4e3b\u673a 'computer3713hpdl580'\u6ca1\u6709\u6620\u5c04\u5230\u4efb\u4f55\u5355\u5143
2019-11-18 11:06:00.842 11208 ERROR nova.api.openstack.wsgi Traceback (most recent call last):
2019-11-18 11:06:00.842 11208 ERROR nova.api.openstack.wsgi File "/usr/lib/python2.7/site-packages/nova/api/openstack/wsgi.py", line 801, in wrapped
2019-11-18 11:06:00.842 11208 ERROR nova.api.openstack.wsgi return f(*args, **kwargs)

hua zhao (noizz)
Changed in nova:
status: Invalid → New
Revision history for this message
Matt Riedemann (mriedem) wrote :

What release are you using? You must not have this fix:

https://review.opendev.org/#/q/I0d7644db3537a67b94e75972b3c4fce25a623763

I'm going to mark this as a duplicate of bug 1780727.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.