Add configuration for compute unified limits feature

This adds a config option to indicate the presence of the unified
limits feature in the compute service and skips tests that depend
on the feature being present or absent.

Related to blueprint unified-limits-nova

Change-Id: I9508b41f1a0a208dbce090a4143cb87b858fc5f2
diff --git a/tempest/api/compute/admin/test_quotas.py b/tempest/api/compute/admin/test_quotas.py
index 9d5e0c9..f8ad220 100644
--- a/tempest/api/compute/admin/test_quotas.py
+++ b/tempest/api/compute/admin/test_quotas.py
@@ -14,14 +14,17 @@
 #    under the License.
 
 from oslo_log import log as logging
+import testtools
 from testtools import matchers
 
 from tempest.api.compute import base
 from tempest.common import identity
 from tempest.common import tempest_fixtures as fixtures
+from tempest import config
 from tempest.lib.common.utils import data_utils
 from tempest.lib import decorators
 
+CONF = config.CONF
 LOG = logging.getLogger(__name__)
 
 
@@ -110,6 +113,8 @@
             self.assertIn(quota, quota_set.keys())
 
     @decorators.idempotent_id('55fbe2bf-21a9-435b-bbd2-4162b0ed799a')
+    @testtools.skipIf(CONF.compute_feature_enabled.unified_limits,
+                      'Legacy quota update not available with unified limits')
     def test_update_all_quota_resources_for_tenant(self):
         """Test admin can update all the compute quota limits for a project"""
         default_quota_set = self.adm_client.show_default_quota_set(
@@ -141,11 +146,15 @@
 
     # TODO(afazekas): merge these test cases
     @decorators.idempotent_id('ce9e0815-8091-4abd-8345-7fe5b85faa1d')
+    @testtools.skipIf(CONF.compute_feature_enabled.unified_limits,
+                      'Legacy quota update not available with unified limits')
     def test_get_updated_quotas(self):
         """Test that GET shows the updated quota set of project"""
         self._get_updated_quotas()
 
     @decorators.idempotent_id('389d04f0-3a41-405f-9317-e5f86e3c44f0')
+    @testtools.skipIf(CONF.compute_feature_enabled.unified_limits,
+                      'Legacy quota update not available with unified limits')
     def test_delete_quota(self):
         """Test admin can delete the compute quota set for a project"""
         project_name = data_utils.rand_name('ram_quota_project')
@@ -178,6 +187,8 @@
     min_microversion = '2.36'
 
     @decorators.idempotent_id('4268b5c9-92e5-4adc-acf1-3a2798f3d803')
+    @testtools.skipIf(CONF.compute_feature_enabled.unified_limits,
+                      'Legacy quota update not available with unified limits')
     def test_get_updated_quotas(self):
         """Test compute quotas API with microversion greater than 2.35
 
@@ -197,6 +208,8 @@
     min_microversion = '2.57'
 
     @decorators.idempotent_id('e641e6c6-e86c-41a4-9e5c-9493c0ae47ad')
+    @testtools.skipIf(CONF.compute_feature_enabled.unified_limits,
+                      'Legacy quota update not available with unified limits')
     def test_get_updated_quotas(self):
         """Test compute quotas API with microversion greater than 2.56
 
@@ -228,6 +241,8 @@
     # tests that get run all by themselves at the end under a
     # 'danger' flag.
     @decorators.idempotent_id('7932ab0f-5136-4075-b201-c0e2338df51a')
+    @testtools.skipIf(CONF.compute_feature_enabled.unified_limits,
+                      'Legacy quota update not available with unified limits')
     def test_update_default_quotas(self):
         """Test updating default compute quota class set"""
         # get the current 'default' quota class values
diff --git a/tempest/api/compute/admin/test_quotas_negative.py b/tempest/api/compute/admin/test_quotas_negative.py
index 04dbc2d..a4120bb 100644
--- a/tempest/api/compute/admin/test_quotas_negative.py
+++ b/tempest/api/compute/admin/test_quotas_negative.py
@@ -12,6 +12,8 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+import testtools
+
 from tempest.api.compute import base
 from tempest.common import utils
 from tempest import config
@@ -68,6 +70,8 @@
     # It can be moved into the setUpClass as well.
     @decorators.attr(type=['negative'])
     @decorators.idempotent_id('91058876-9947-4807-9f22-f6eb17140d9b')
+    @testtools.skipIf(CONF.compute_feature_enabled.unified_limits,
+                      'Legacy quota update not available with unified limits')
     def test_create_server_when_cpu_quota_is_full(self):
         """Disallow server creation when tenant's vcpu quota is full"""
         self._update_quota('cores', 0)
@@ -76,6 +80,8 @@
 
     @decorators.attr(type=['negative'])
     @decorators.idempotent_id('6fdd7012-584d-4327-a61c-49122e0d5864')
+    @testtools.skipIf(CONF.compute_feature_enabled.unified_limits,
+                      'Legacy quota update not available with unified limits')
     def test_create_server_when_memory_quota_is_full(self):
         """Disallow server creation when tenant's memory quota is full"""
         self._update_quota('ram', 0)
@@ -84,6 +90,8 @@
 
     @decorators.attr(type=['negative'])
     @decorators.idempotent_id('7c6be468-0274-449a-81c3-ac1c32ee0161')
+    @testtools.skipIf(CONF.compute_feature_enabled.unified_limits,
+                      'Legacy quota update not available with unified limits')
     def test_create_server_when_instances_quota_is_full(self):
         """Once instances quota limit is reached, disallow server creation"""
         self._update_quota('instances', 0)
diff --git a/tempest/config.py b/tempest/config.py
index fde52e4..a354689 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -650,6 +650,9 @@
                 default=True,
                 help='Does the test environment support attaching devices '
                      'using an IDE bus to the instance?'),
+    cfg.BoolOpt('unified_limits',
+                default=False,
+                help='Does the test environment support unified limits?'),
 ]