From ee5d9ae8d376e41e852b06488e922400cf69b4ac Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Tue, 18 Jun 2013 14:33:29 -0400 Subject: Revert "Delegate authentication to quantumclient" This reverts commit dd9c27f999221001bae9faa03571645824d2a681. When this patch was merged, we were suspicious about whether it was safe to cache the client object and have it used by multiple greenthreads. We decided it was safe and merged it. After thinking about it and discussing it further, it is really a bad idea. Sharing httplib2 connections is not considered thread-safe. quantumclient.client.HTTPClient inherits from httplib2.Http. The following page says sharing instances of this object between threads is not safe: https://developers.google.com/api-client-library/python/guide/thread_safety "The google-api-python-client library is built on top of the httplib2 library, which is not thread-safe. Therefore, if you are running as a multi-threaded application, each thread that you are making requests from must have its own instance of httplib2.Http()." Potentially fix bug 1192131. Even if it doesn't fix that bug, this needs to be reverted anyway. Change-Id: I2e4bf5e7b6458cd7b76e30847fe07f06b25c34f7 --- nova/tests/network/test_quantumv2.py | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'nova/tests') diff --git a/nova/tests/network/test_quantumv2.py b/nova/tests/network/test_quantumv2.py index 0b6f184ae..7f21a2aa9 100644 --- a/nova/tests/network/test_quantumv2.py +++ b/nova/tests/network/test_quantumv2.py @@ -19,8 +19,6 @@ import uuid import mox from oslo.config import cfg -from quantumclient import client as quantum_client -from quantumclient.common import exceptions as quantum_exceptions from quantumclient.v2_0 import client from nova.compute import flavors @@ -104,17 +102,6 @@ class TestQuantumClient(test.TestCase): self.mox.ReplayAll() quantumv2.get_client(my_context) - def test_cached_admin_client(self): - self.mox.StubOutWithMock(quantum_client.HTTPClient, "authenticate") - - # should be called one time only - quantum_client.HTTPClient.authenticate() - self.mox.ReplayAll() - - admin1 = quantumv2.get_client(None, admin=True) - admin2 = quantumv2.get_client(None, admin=True) - self.assertIs(admin1, admin2) - def test_withouttoken_keystone_connection_error(self): self.flags(quantum_auth_strategy='keystone') self.flags(quantum_url='http://anyhost/') @@ -1236,7 +1223,7 @@ class TestQuantumv2(test.TestCase): def test_list_floating_ips_without_l3_support(self): api = quantumapi.API() - QuantumNotFound = quantum_exceptions.QuantumClientException( + QuantumNotFound = quantumv2.exceptions.QuantumClientException( status_code=404) self.moxed_client.list_floatingips( fixed_ip_address='1.1.1.1', port_id=1).AndRaise(QuantumNotFound) -- cgit