Merge "Enhance the validation of the quotas update"
diff --git a/tempest/services/compute/json/quotas_client.py b/tempest/services/compute/json/quotas_client.py
index 5b1e48f..a910dec 100644
--- a/tempest/services/compute/json/quotas_client.py
+++ b/tempest/services/compute/json/quotas_client.py
@@ -43,7 +43,8 @@
         body = json.loads(body)
         return resp, body['quota_set']
 
-    def update_quota_set(self, tenant_id, injected_file_content_bytes=None,
+    def update_quota_set(self, tenant_id, force=None,
+                         injected_file_content_bytes=None,
                          metadata_items=None, ram=None, floating_ips=None,
                          fixed_ips=None, key_pairs=None, instances=None,
                          security_group_rules=None, injected_files=None,
@@ -54,6 +55,9 @@
         """
         post_body = {}
 
+        if force is not None:
+            post_body['force'] = force
+
         if injected_file_content_bytes is not None:
             post_body['injected_file_content_bytes'] = \
                 injected_file_content_bytes
diff --git a/tempest/services/compute/xml/quotas_client.py b/tempest/services/compute/xml/quotas_client.py
index 8912443..ef5362c 100644
--- a/tempest/services/compute/xml/quotas_client.py
+++ b/tempest/services/compute/xml/quotas_client.py
@@ -64,7 +64,8 @@
         body = self._format_quota(body)
         return resp, body
 
-    def update_quota_set(self, tenant_id, injected_file_content_bytes=None,
+    def update_quota_set(self, tenant_id, force=None,
+                         injected_file_content_bytes=None,
                          metadata_items=None, ram=None, floating_ips=None,
                          fixed_ips=None, key_pairs=None, instances=None,
                          security_group_rules=None, injected_files=None,
@@ -76,6 +77,9 @@
         post_body = Element("quota_set",
                             xmlns=XMLNS_11)
 
+        if force is not None:
+            post_body.add_attr('force', force)
+
         if injected_file_content_bytes is not None:
             post_body.add_attr('injected_file_content_bytes',
                                injected_file_content_bytes)
diff --git a/tempest/tests/compute/admin/test_quotas.py b/tempest/tests/compute/admin/test_quotas.py
index 5bb48d0..7160aed 100644
--- a/tempest/tests/compute/admin/test_quotas.py
+++ b/tempest/tests/compute/admin/test_quotas.py
@@ -71,8 +71,13 @@
         self.assertEqual(expected_quota_set, quota_set)
 
     def test_update_all_quota_resources_for_tenant(self):
+        self.skipTest("This test require the change in nova component "
+                      "https://review.openstack.org/#/c/25887/, the related "
+                      "bug is https://bugs.launchpad.net/nova/+bug/1160749 "
+                      "once the change is merged I will enable this testcase")
         # Admin can update all the resource quota limits for a tenant
-        new_quota_set = {'injected_file_content_bytes': 20480,
+        new_quota_set = {'force': True,
+                         'injected_file_content_bytes': 20480,
                          'metadata_items': 256, 'injected_files': 10,
                          'ram': 10240, 'floating_ips': 20, 'fixed_ips': 10,
                          'key_pairs': 200, 'injected_file_path_bytes': 512,
@@ -119,12 +124,17 @@
                              "defaults")
 
     def test_create_server_when_cpu_quota_is_full(self):
+        self.skipTest("This test require the change in nova component "
+                      "https://review.openstack.org/#/c/25887/, the related "
+                      "bug is https://bugs.launchpad.net/nova/+bug/1160749 "
+                      "once the change is merged I will enable this testcase")
         # Disallow server creation when tenant's vcpu quota is full
         resp, quota_set = self.client.get_quota_set(self.demo_tenant_id)
         default_vcpu_quota = quota_set['cores']
         vcpu_quota = 0  # Set the quota to zero to conserve resources
 
         resp, quota_set = self.adm_client.update_quota_set(self.demo_tenant_id,
+                                                           force=True,
                                                            cores=vcpu_quota)
 
         self.addCleanup(self.adm_client.update_quota_set, self.demo_tenant_id,
@@ -132,12 +142,17 @@
         self.assertRaises(exceptions.OverLimit, self.create_server)
 
     def test_create_server_when_memory_quota_is_full(self):
+        self.skipTest("This test require the change in nova component "
+                      "https://review.openstack.org/#/c/25887/, the related "
+                      "bug is https://bugs.launchpad.net/nova/+bug/1160749 "
+                      "once the change is merged I will enable this testcase")
         # Disallow server creation when tenant's memory quota is full
         resp, quota_set = self.client.get_quota_set(self.demo_tenant_id)
         default_mem_quota = quota_set['ram']
         mem_quota = 0  # Set the quota to zero to conserve resources
 
         self.adm_client.update_quota_set(self.demo_tenant_id,
+                                         force=True,
                                          ram=mem_quota)
 
         self.addCleanup(self.adm_client.update_quota_set, self.demo_tenant_id,
@@ -148,12 +163,17 @@
 
     @attr(type='negative')
     def test_create_server_when_instances_quota_is_full(self):
+        self.skipTest("This test require the change in nova component "
+                      "https://review.openstack.org/#/c/25887/, the related "
+                      "bug is https://bugs.launchpad.net/nova/+bug/1160749 "
+                      "once the change is merged I will enable this testcase")
         #Once instances quota limit is reached, disallow server creation
         resp, quota_set = self.client.get_quota_set(self.demo_tenant_id)
         default_instances_quota = quota_set['instances']
         instances_quota = 0  # Set quota to zero to disallow server creation
 
         self.adm_client.update_quota_set(self.demo_tenant_id,
+                                         force=True,
                                          instances=instances_quota)
         self.addCleanup(self.adm_client.update_quota_set, self.demo_tenant_id,
                         instances=default_instances_quota)