From 9520b1e3a70c4d0de547b1943aa6eadfb8cf6097 Mon Sep 17 00:00:00 2001 From: Lin Hua Cheng Date: Wed, 16 Oct 2013 12:14:22 -0700 Subject: [PATCH] Revert patch causing Instance Image Perf Issue The previous patch https://review.openstack.org/52115 is causing image get call for each instance. Reverting this back. Fix will follow in another patch. Related to bug: Bug: #1239896 Change-Id: If0d6feba50eb3f45248019fcc48580d1eae60d67 --- .../dashboards/project/instances/tests.py | 39 ------------------- .../dashboards/project/instances/views.py | 1 - 2 files changed, 40 deletions(-) diff --git a/openstack_dashboard/dashboards/project/instances/tests.py b/openstack_dashboard/dashboards/project/instances/tests.py index 9804787d86..f982e40249 100644 --- a/openstack_dashboard/dashboards/project/instances/tests.py +++ b/openstack_dashboard/dashboards/project/instances/tests.py @@ -182,45 +182,6 @@ class InstanceTests(test.TestCase): self.assertMessageCount(res, error=len(servers)) self.assertItemsEqual(instances, self.servers.list()) - @test.create_stubs({api.nova: ('flavor_list', - 'server_list', - 'tenant_absolute_limits', - 'extension_supported',), - api.glance: ('image_list_detailed',), - api.network: - ('floating_ip_simple_associate_supported',), - }) - def test_index_with_instance_booted_from_volume(self): - volume_server = self.servers.first() - volume_server.image = "" - volume_server.image_name = "(not found)" - servers = self.servers.list() - servers[0] = volume_server - - api.nova.extension_supported('AdminActions', - IsA(http.HttpRequest)) \ - .MultipleTimes().AndReturn(True) - api.nova.flavor_list(IsA(http.HttpRequest)) \ - .AndReturn(self.flavors.list()) - api.glance.image_list_detailed(IgnoreArg()) \ - .AndReturn((self.images.list(), False)) - search_opts = {'marker': None, 'paginate': True} - api.nova.server_list(IsA(http.HttpRequest), search_opts=search_opts) \ - .AndReturn([servers, False]) - api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \ - .MultipleTimes().AndReturn(self.limits['absolute']) - api.network.floating_ip_simple_associate_supported( - IsA(http.HttpRequest)).MultipleTimes().AndReturn(True) - - self.mox.ReplayAll() - - res = self.client.get(INDEX_URL) - - self.assertTemplateUsed(res, 'project/instances/index.html') - instances = res.context['instances_table'].data - self.assertEqual(len(instances), len(servers)) - self.assertContains(res, "(not found)") - @test.create_stubs({api.nova: ('server_list', 'flavor_list', 'server_delete',), diff --git a/openstack_dashboard/dashboards/project/instances/views.py b/openstack_dashboard/dashboards/project/instances/views.py index 9665604dae..368882c3a3 100644 --- a/openstack_dashboard/dashboards/project/instances/views.py +++ b/openstack_dashboard/dashboards/project/instances/views.py @@ -89,7 +89,6 @@ class IndexView(tables.DataTableView): # Loop through instances to get flavor info. for instance in instances: if (hasattr(instance, 'image') - and hasattr(instance.image, 'id') and instance.image['id'] in image_map): instance.image = image_map[instance.image['id']]