diff options
| author | Hans Lindgren <hanlind@kth.se> | 2013-02-28 11:00:29 +0100 |
|---|---|---|
| committer | Hans Lindgren <hanlind@kth.se> | 2013-03-10 13:51:06 +0100 |
| commit | 0a22d9dd01dab78ff68829fd2b0651592c8d56b4 (patch) | |
| tree | 77bf41e208c335ee29a183c8cef2acbb3419d867 /nova/api | |
| parent | 92482459963e21cb692c0515450abc81d69e40ed (diff) | |
| download | nova-0a22d9dd01dab78ff68829fd2b0651592c8d56b4.tar.gz nova-0a22d9dd01dab78ff68829fd2b0651592c8d56b4.tar.xz nova-0a22d9dd01dab78ff68829fd2b0651592c8d56b4.zip | |
Extended server attributes can show wrong hypervisor_hostname
When using the extended server status (EXT-SRV-STS) extension, it might
produce the wrong hypervisor_hostname on multi-node drivers like baremetal.
The db query used is incorrect and in fact not needed anymore, since the info
is already available in the instance dict itself.
This patch resolves the issue by instead using instance['node'] directly
and further removes the no longer used compute_node_get_by_host query.
Resolves bug 1135506.
Change-Id: I641c4f59a088754fe68378ae4bf217c59056b1d1
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/contrib/extended_server_attributes.py | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/nova/api/openstack/compute/contrib/extended_server_attributes.py b/nova/api/openstack/compute/contrib/extended_server_attributes.py index dd332ff13..4f74f389d 100644 --- a/nova/api/openstack/compute/contrib/extended_server_attributes.py +++ b/nova/api/openstack/compute/contrib/extended_server_attributes.py @@ -17,8 +17,6 @@ from nova.api.openstack import extensions from nova.api.openstack import wsgi from nova.api.openstack import xmlutil -from nova import compute -from nova import db from nova.openstack.common import log as logging LOG = logging.getLogger(__name__) @@ -27,22 +25,9 @@ authorize = extensions.soft_extension_authorizer('compute', class ExtendedServerAttributesController(wsgi.Controller): - def __init__(self, *args, **kwargs): - super(ExtendedServerAttributesController, self).__init__(*args, - **kwargs) - self.compute_api = compute.API() - - def _get_hypervisor_hostname(self, context, instance): - compute_node = db.compute_node_get_by_host(context, instance["host"]) - - try: - return compute_node["hypervisor_hostname"] - except TypeError: - return - def _extend_server(self, context, server, instance): key = "%s:hypervisor_hostname" % Extended_server_attributes.alias - server[key] = self._get_hypervisor_hostname(context, instance) + server[key] = instance['node'] for attr in ['host', 'name']: if attr == 'name': |
