From 0a22d9dd01dab78ff68829fd2b0651592c8d56b4 Mon Sep 17 00:00:00 2001 From: Hans Lindgren Date: Thu, 28 Feb 2013 11:00:29 +0100 Subject: 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 --- .../compute/contrib/extended_server_attributes.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'nova/api') 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': -- cgit