Reviewed: https://review.openstack.org/25614 Committed: http://github.com/openstack/nova/commit/f29ecbaa21fc51ce2c6c60ac395378cb8436e0c2 Submitter: Jenkins Branch: milestone-proposed
commit f29ecbaa21fc51ce2c6c60ac395378cb8436e0c2 Author: Dan Smith <[email protected]> Date: Wed Mar 27 11:30:49 2013 -0700 Make tenant_usage fall back to instance_type_id In order to expose historical usage information about instances that were deleted at the time migration #153 was run, we need to fall back to looking up type information by instance_type_id. This patch does that (only for deleted instances) and replicates the previous behavior of skipping instances that have an instance_type_id that points to a non-existent type. Fixes bug 1161022 (cherry-picked from 30631d0077424001e2fa57674e6e9f2a12f0683e) Change-Id: I39d30c59d1711d8f2a61c7a5e2545b3952e55dbe ** Changed in: nova Status: Fix Committed => Fix Released -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1161022 Title: simply_tenant_usage stack traces due to lacking of flavor metadata Status in OpenStack Compute (Nova): Fix Released Bug description: During the Grizzly cycle, we made a change such that flavor details are copied for each instance and stored in instance_system_metadata. There's an associated migration (153) for this, which accounts for *non-deleted* instances only. Thus, if querying usage data containing pre-Grizzly, deleted instances, simple_tenant_usage will stack track due to not having the necessary flavor metadata: 2013-03-27 03:41:00.883 ERROR nova.api.openstack [req-854b5c2a-da1e-47c1-bca9-e6a927642d49 af1711fbb8c84c73a1f245679699b419 62afa5ddaa2248d19e2518eb40b0fe8a] Caught error: 'instance_type_memory_ mb' 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack Traceback (most recent call last): 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/__init__.py", line 81, in __call__ 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack return req.get_response(self.application) 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1296, in send 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack application, catch_exc_info=False) 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1260, in call_application 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack app_iter = application(self.environ, start_response) 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__ 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack return resp(environ, start_response) 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/keystoneclient/middleware/auth_token.py", line 451, in __call__ 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack return self.app(env, start_response) 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__ 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack return resp(environ, start_response) 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__ 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack return resp(environ, start_response) 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__ 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack return resp(environ, start_response) 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/routes/middleware.py", line 131, in __call__ 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack response = self.app(environ, start_response) 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__ 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack return resp(environ, start_response) 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__ 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack resp = self.call_func(req, *args, **self.kwargs) 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack return self.func(req, *args, **kwargs) 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py", line 890, in __call__ 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack content_type, body, accept) 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py", line 942, in _process_stack 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack action_result = self.dispatch(meth, request, action_args) 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py", line 1022, in dispatch 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack return method(req=request, **action_args) 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/compute/contrib/simple_tenant_usage.py", line 220, in index 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack detailed=detailed) 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/compute/contrib/simple_tenant_usage.py", line 122, in _tenant_usages_for_period 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack flavor = instance_types.extract_instance_type(instance) 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/compute/instance_types.py", line 247, in extract_instance_type 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack instance_type[key] = type_fn(sys_meta[type_key]) 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack KeyError: 'instance_type_memory_mb' 2013-03-27 03:41:00.883 10756 TRACE nova.api.openstack 2013-03-27 03:41:00.902 INFO nova.api.openstack [req-854b5c2a-da1e-47c1-bca9-e6a927642d49 af1711fbb8c84c73a1f245679699b419 62afa5ddaa2248d19e2518eb40b0fe8a] We've discussed (via #openstack-nova) a possible short term fix for Grizzly RC2, which is to add handling in the code to fall back to the old flavor data retrieval mechanism. Then, as a longer term Havana solution, adding another migration inclusive of deleted data. Either way we need a fix for Grizzly, otherwise the Horizon "overview" pages will generate exceptions and manifest as errors back to users. To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1161022/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

