Merge "Fix bad classname"
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index 37573c4..5679a45 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -19,7 +19,6 @@
 
 from tempest.api import compute
 from tempest import clients
-from tempest.common import isolated_creds
 from tempest.common.utils.data_utils import parse_image_id
 from tempest.common.utils.data_utils import rand_name
 from tempest import exceptions
@@ -42,21 +41,10 @@
         if not cls.config.service_available.nova:
             skip_msg = ("%s skipped as nova is not available" % cls.__name__)
             raise cls.skipException(skip_msg)
-        cls.isolated_creds = isolated_creds.IsolatedCreds(cls.__name__)
 
-        if (cls.config.compute.allow_tenant_isolation or
-            cls.force_tenant_isolation is True):
-            creds = cls.isolated_creds.get_primary_creds()
-            username, tenant_name, password = creds
-            os = clients.Manager(username=username,
-                                 password=password,
-                                 tenant_name=tenant_name,
-                                 interface=cls._interface)
-        else:
-            os = clients.Manager(interface=cls._interface)
+        os = cls.get_client_manager()
 
         cls.os = os
-
         cls.build_interval = cls.config.compute.build_interval
         cls.build_timeout = cls.config.compute.build_timeout
         cls.ssh_user = cls.config.compute.ssh_user
@@ -113,7 +101,7 @@
     def tearDownClass(cls):
         cls.clear_images()
         cls.clear_servers()
-        cls.isolated_creds.clear_isolated_creds()
+        cls.clear_isolated_creds()
         super(BaseComputeTest, cls).tearDownClass()
 
     @classmethod
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index b6c2679..159c4f5 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -68,75 +68,39 @@
 
     @classmethod
     def tearDownClass(cls):
-        has_exception = False
+        # Clean up vpn services
         for vpnservice in cls.vpnservices:
-            try:
-                cls.client.delete_vpn_service(vpnservice['id'])
-            except Exception as exc:
-                LOG.exception(exc)
-                has_exception = True
-
+            cls.client.delete_vpn_service(vpnservice['id'])
+        # Clean up routers
         for router in cls.routers:
-            try:
-                resp, body = cls.client.list_router_interfaces(router['id'])
-                interfaces = body['ports']
-                for i in interfaces:
-                    cls.client.remove_router_interface_with_subnet_id(
-                        router['id'], i['fixed_ips'][0]['subnet_id'])
-            except Exception as exc:
-                LOG.exception(exc)
-                has_exception = True
-            try:
-                cls.client.delete_router(router['id'])
-            except Exception as exc:
-                LOG.exception(exc)
-                has_exception = True
-
+            resp, body = cls.client.list_router_interfaces(router['id'])
+            interfaces = body['ports']
+            for i in interfaces:
+                cls.client.remove_router_interface_with_subnet_id(
+                    router['id'], i['fixed_ips'][0]['subnet_id'])
+            cls.client.delete_router(router['id'])
+        # Clean up health monitors
         for health_monitor in cls.health_monitors:
-            try:
-                cls.client.delete_health_monitor(health_monitor['id'])
-            except Exception as exc:
-                LOG.exception(exc)
-                has_exception = True
+            cls.client.delete_health_monitor(health_monitor['id'])
+        # Clean up members
         for member in cls.members:
-            try:
-                cls.client.delete_member(member['id'])
-            except Exception as exc:
-                LOG.exception(exc)
-                has_exception = True
+            cls.client.delete_member(member['id'])
+        # Clean up vips
         for vip in cls.vips:
-            try:
-                cls.client.delete_vip(vip['id'])
-            except Exception as exc:
-                LOG.exception(exc)
-                has_exception = True
+            cls.client.delete_vip(vip['id'])
+        # Clean up pools
         for pool in cls.pools:
-            try:
-                cls.client.delete_pool(pool['id'])
-            except Exception as exc:
-                LOG.exception(exc)
-                has_exception = True
+            cls.client.delete_pool(pool['id'])
+        # Clean up ports
         for port in cls.ports:
-            try:
-                cls.client.delete_port(port['id'])
-            except Exception as exc:
-                LOG.exception(exc)
-                has_exception = True
+            cls.client.delete_port(port['id'])
+        # Clean up subnets
         for subnet in cls.subnets:
-            try:
-                cls.client.delete_subnet(subnet['id'])
-            except Exception as exc:
-                LOG.exception(exc)
-                has_exception = True
+            cls.client.delete_subnet(subnet['id'])
+        # Clean up networks
         for network in cls.networks:
-            try:
-                cls.client.delete_network(network['id'])
-            except Exception as exc:
-                LOG.exception(exc)
-                has_exception = True
+            cls.client.delete_network(network['id'])
         super(BaseNetworkTest, cls).tearDownClass()
-        if has_exception:
-            raise exceptions.TearDownException()
 
     @classmethod
     def create_network(cls, network_name=None):
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index 98694c5..cdf8638 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -18,7 +18,6 @@
 import time
 
 from tempest import clients
-from tempest.common import isolated_creds
 from tempest.openstack.common import log as logging
 import tempest.test
 
@@ -32,21 +31,12 @@
     @classmethod
     def setUpClass(cls):
         super(BaseVolumeTest, cls).setUpClass()
-        cls.isolated_creds = isolated_creds.IsolatedCreds(cls.__name__)
 
         if not cls.config.service_available.cinder:
             skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
             raise cls.skipException(skip_msg)
 
-        if cls.config.compute.allow_tenant_isolation:
-            creds = cls.isolated_creds.get_primary_creds()
-            username, tenant_name, password = creds
-            os = clients.Manager(username=username,
-                                 password=password,
-                                 tenant_name=tenant_name,
-                                 interface=cls._interface)
-        else:
-            os = clients.Manager(interface=cls._interface)
+        os = cls.get_client_manager()
 
         cls.os = os
         cls.volumes_client = os.volumes_client
@@ -69,7 +59,7 @@
     def tearDownClass(cls):
         cls.clear_snapshots()
         cls.clear_volumes()
-        cls.isolated_creds.clear_isolated_creds()
+        cls.clear_isolated_creds()
         super(BaseVolumeTest, cls).tearDownClass()
 
     @classmethod
diff --git a/tempest/test.py b/tempest/test.py
index 8ce7af8..edba709 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -26,6 +26,7 @@
 import testtools
 
 from tempest import clients
+from tempest.common import isolated_creds
 from tempest import config
 from tempest import exceptions
 from tempest.openstack.common import log as logging
@@ -216,7 +217,36 @@
             os.environ.get('OS_LOG_CAPTURE') != '0'):
             log_format = '%(asctime)-15s %(message)s'
             self.useFixture(fixtures.LoggerFixture(nuke_handlers=False,
-                                                   format=log_format))
+                                                   format=log_format,
+                                                   level=None))
+
+    @classmethod
+    def get_client_manager(cls):
+        """
+        Returns an Openstack client manager
+        """
+        cls.isolated_creds = isolated_creds.IsolatedCreds(cls.__name__)
+
+        force_tenant_isolation = getattr(cls, 'force_tenant_isolation', None)
+        if (cls.config.compute.allow_tenant_isolation or
+            force_tenant_isolation):
+            creds = cls.isolated_creds.get_primary_creds()
+            username, tenant_name, password = creds
+            os = clients.Manager(username=username,
+                                 password=password,
+                                 tenant_name=tenant_name,
+                                 interface=cls._interface)
+        else:
+            os = clients.Manager(interface=cls._interface)
+        return os
+
+    @classmethod
+    def clear_isolated_creds(cls):
+        """
+        Clears isolated creds if set
+        """
+        if getattr(cls, 'isolated_creds'):
+            cls.isolated_creds.clear_isolated_creds()
 
     @classmethod
     def _get_identity_admin_client(cls):