Support disabling server pausing for compute API

This adds a togglable compute feature for pause/unpause.

The Docker driver does not currently support this feature.

Change-Id: I6f5f1f4624e34801aa52def7450e65716073fc65
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index eb2340a..eb8d458 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -347,6 +347,9 @@
 # Does the test environment support resizing? (boolean value)
 #resize=false
 
+# Does the test environment support pausing? (boolean value)
+#pause=true
+
 # Does the test environment support live migration available?
 # (boolean value)
 #live_migration=false
diff --git a/tempest/api/compute/servers/test_delete_server.py b/tempest/api/compute/servers/test_delete_server.py
index 5e011dd..7e34213 100644
--- a/tempest/api/compute/servers/test_delete_server.py
+++ b/tempest/api/compute/servers/test_delete_server.py
@@ -23,6 +23,8 @@
 
 
 class DeleteServersTestJSON(base.BaseV2ComputeTest):
+    pause_available = CONF.compute_feature_enabled.pause
+
     # NOTE: Server creations of each test class should be under 10
     # for preventing "Quota exceeded for instances"
 
@@ -57,6 +59,7 @@
         self.assertEqual('204', resp['status'])
         self.client.wait_for_server_termination(server['id'])
 
+    @testtools.skipIf(not pause_available, 'Pause is not available.')
     @test.attr(type='gate')
     def test_delete_server_while_in_pause_state(self):
         # Delete a server while it's VM state is Pause
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index bde0f57..8afd5f9 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -30,6 +30,7 @@
 
 class ServerActionsTestJSON(base.BaseV2ComputeTest):
     resize_available = CONF.compute_feature_enabled.resize
+    pause_available = CONF.compute_feature_enabled.pause
     run_ssh = CONF.compute.run_ssh
 
     def setUp(self):
@@ -350,6 +351,7 @@
 
         self.wait_for(self._get_output)
 
+    @testtools.skipIf(not pause_available, 'Pause is not available.')
     @test.attr(type='gate')
     def test_pause_unpause_server(self):
         resp, server = self.client.pause_server(self.server_id)
diff --git a/tempest/api/compute/servers/test_servers_negative.py b/tempest/api/compute/servers/test_servers_negative.py
index 4cccbd6..b05fc12 100644
--- a/tempest/api/compute/servers/test_servers_negative.py
+++ b/tempest/api/compute/servers/test_servers_negative.py
@@ -16,6 +16,8 @@
 import base64
 import sys
 
+import testtools
+
 from tempest.api.compute import base
 from tempest import clients
 from tempest.common.utils import data_utils
@@ -27,6 +29,7 @@
 
 
 class ServersNegativeTestJSON(base.BaseV2ComputeTest):
+    pause_available = CONF.compute_feature_enabled.pause
 
     def setUp(self):
         super(ServersNegativeTestJSON, self).setUp()
@@ -125,6 +128,7 @@
         self.assertRaises(exceptions.NotFound, self.client.reboot,
                           nonexistent_server, 'SOFT')
 
+    @testtools.skipIf(not pause_available, 'Pause is not available.')
     @test.attr(type=['negative', 'gate'])
     def test_pause_paused_server(self):
         # Pause a paused server.
@@ -304,6 +308,7 @@
         self.assertRaises(exceptions.NotFound, self.servers_client.stop,
                           nonexistent_server)
 
+    @testtools.skipIf(not pause_available, 'Pause is not available.')
     @test.attr(type=['negative', 'gate'])
     def test_pause_non_existent_server(self):
         # pause a non existent server
@@ -311,6 +316,7 @@
         self.assertRaises(exceptions.NotFound, self.client.pause_server,
                           nonexistent_server)
 
+    @testtools.skipIf(not pause_available, 'Pause is not available.')
     @test.attr(type=['negative', 'gate'])
     def test_unpause_non_existent_server(self):
         # unpause a non existent server
@@ -318,6 +324,7 @@
         self.assertRaises(exceptions.NotFound, self.client.unpause_server,
                           nonexistent_server)
 
+    @testtools.skipIf(not pause_available, 'Pause is not available.')
     @test.attr(type=['negative', 'gate'])
     def test_unpause_server_invalid_state(self):
         # unpause an active server.
diff --git a/tempest/config.py b/tempest/config.py
index db81f6e..9f279fb 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -252,6 +252,9 @@
     cfg.BoolOpt('resize',
                 default=False,
                 help="Does the test environment support resizing?"),
+    cfg.BoolOpt('pause',
+                default=True,
+                help="Does the test environment support pausing?"),
     cfg.BoolOpt('live_migration',
                 default=False,
                 help="Does the test environment support live migration "