Merge "Minor changes to scenario manager"
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 025d0f3..0e11b90 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -770,6 +770,11 @@
 # value)
 #leave_dirty_stack=false
 
+# Allows a full cleaning process after a stress test. Caution
+# : this cleanup will remove every objects of every tenant.
+# (boolean value)
+#full_clean_stack=false
+
 
 [telemetry]
 
@@ -835,6 +840,9 @@
 # (boolean value)
 #multi_backend=false
 
+# Runs Cinder volumes backup test (boolean value)
+#backup=true
+
 # Is the v1 volume API enabled (boolean value)
 #api_v1=true
 
diff --git a/tempest/api/identity/admin/test_users.py b/tempest/api/identity/admin/test_users.py
index 898cccc..a4e6c17 100644
--- a/tempest/api/identity/admin/test_users.py
+++ b/tempest/api/identity/admin/test_users.py
@@ -13,11 +13,11 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-from testtools.matchers import Contains
+from testtools import matchers
 
 from tempest.api.identity import base
 from tempest.common.utils import data_utils
-from tempest.test import attr
+from tempest import test
 
 
 class UsersTestJSON(base.BaseIdentityV2AdminTest):
@@ -30,7 +30,7 @@
         cls.alt_password = data_utils.rand_name('pass_')
         cls.alt_email = cls.alt_user + '@testmail.tm'
 
-    @attr(type='smoke')
+    @test.attr(type='smoke')
     def test_create_user(self):
         # Create a user
         self.data.setup_test_tenant()
@@ -41,7 +41,7 @@
         self.assertEqual('200', resp['status'])
         self.assertEqual(self.alt_user, user['name'])
 
-    @attr(type='smoke')
+    @test.attr(type='smoke')
     def test_create_user_with_enabled(self):
         # Create a user with enabled : False
         self.data.setup_test_tenant()
@@ -55,7 +55,7 @@
         self.assertEqual('false', str(user['enabled']).lower())
         self.assertEqual(self.alt_email, user['email'])
 
-    @attr(type='smoke')
+    @test.attr(type='smoke')
     def test_update_user(self):
         # Test case to check if updating of user attributes is successful.
         test_user = data_utils.rand_name('test_user_')
@@ -83,7 +83,7 @@
         self.assertEqual(u_email2, updated_user['email'])
         self.assertEqual('false', str(updated_user['enabled']).lower())
 
-    @attr(type='smoke')
+    @test.attr(type='smoke')
     def test_delete_user(self):
         # Delete a user
         test_user = data_utils.rand_name('test_user_')
@@ -95,7 +95,7 @@
         resp, body = self.client.delete_user(user['id'])
         self.assertEqual('204', resp['status'])
 
-    @attr(type='smoke')
+    @test.attr(type='smoke')
     def test_user_authentication(self):
         # Valid user's token is authenticated
         self.data.setup_test_user()
@@ -108,7 +108,7 @@
                                             self.data.test_tenant)
         self.assertEqual('200', resp['status'])
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_authentication_request_without_token(self):
         # Request for token authentication with a valid token in header
         self.data.setup_test_user()
@@ -125,16 +125,16 @@
         self.assertEqual('200', resp['status'])
         self.client.auth_provider.clear_auth()
 
-    @attr(type='smoke')
+    @test.attr(type='smoke')
     def test_get_users(self):
         # Get a list of users and find the test user
         self.data.setup_test_user()
         resp, users = self.client.get_users()
         self.assertThat([u['name'] for u in users],
-                        Contains(self.data.test_user),
+                        matchers.Contains(self.data.test_user),
                         "Could not find %s" % self.data.test_user)
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_list_users_for_tenant(self):
         # Return a list of all users for a tenant
         self.data.setup_test_tenant()
@@ -167,7 +167,7 @@
                          "Failed to find user %s in fetched list" %
                          ', '.join(m_user for m_user in missing_users))
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_list_users_with_roles_for_tenant(self):
         # Return list of users on tenant when roles are assigned to users
         self.data.setup_test_user()
diff --git a/tempest/api/identity/admin/v3/test_tokens.py b/tempest/api/identity/admin/v3/test_tokens.py
index 802113a..9629213 100644
--- a/tempest/api/identity/admin/v3/test_tokens.py
+++ b/tempest/api/identity/admin/v3/test_tokens.py
@@ -19,7 +19,7 @@
 from tempest.test import attr
 
 
-class UsersTestJSON(base.BaseIdentityV3AdminTest):
+class TokensV3TestJSON(base.BaseIdentityV3AdminTest):
     _interface = 'json'
 
     @attr(type='smoke')
@@ -51,5 +51,5 @@
                           subject_token)
 
 
-class UsersTestXML(UsersTestJSON):
+class TokensV3TestXML(TokensV3TestJSON):
     _interface = 'xml'
diff --git a/tempest/api/identity/admin/v3/test_trusts.py b/tempest/api/identity/admin/v3/test_trusts.py
index c2eef36..cae20ad 100644
--- a/tempest/api/identity/admin/v3/test_trusts.py
+++ b/tempest/api/identity/admin/v3/test_trusts.py
@@ -14,11 +14,11 @@
 import re
 from tempest.api.identity import base
 from tempest import clients
-from tempest.common.utils.data_utils import rand_name
+from tempest.common.utils import data_utils
 from tempest import config
 from tempest import exceptions
 from tempest.openstack.common import timeutils
-from tempest.test import attr
+from tempest import test
 
 CONF = config.CONF
 
@@ -49,10 +49,10 @@
         self.assertIsNotNone(self.trustor_project_id)
 
         # Create a trustor User
-        self.trustor_username = rand_name('user-')
+        self.trustor_username = data_utils.rand_name('user-')
         u_desc = self.trustor_username + 'description'
         u_email = self.trustor_username + '@testmail.xx'
-        self.trustor_password = rand_name('pass-')
+        self.trustor_password = data_utils.rand_name('pass-')
         resp, user = self.client.create_user(
             self.trustor_username,
             description=u_desc,
@@ -63,8 +63,8 @@
         self.trustor_user_id = user['id']
 
         # And two roles, one we'll delegate and one we won't
-        self.delegated_role = rand_name('DelegatedRole-')
-        self.not_delegated_role = rand_name('NotDelegatedRole-')
+        self.delegated_role = data_utils.rand_name('DelegatedRole-')
+        self.not_delegated_role = data_utils.rand_name('NotDelegatedRole-')
 
         resp, role = self.client.create_role(self.delegated_role)
         self.assertEqual(resp['status'], '201')
@@ -196,7 +196,7 @@
         self.create_trustor_and_roles()
         self.addCleanup(self.cleanup_user_and_roles)
 
-    @attr(type='smoke')
+    @test.attr(type='smoke')
     def test_trust_impersonate(self):
         # Test case to check we can create, get and delete a trust
         # updates are not supported for trusts
@@ -208,7 +208,7 @@
 
         self.check_trust_roles()
 
-    @attr(type='smoke')
+    @test.attr(type='smoke')
     def test_trust_noimpersonate(self):
         # Test case to check we can create, get and delete a trust
         # with impersonation=False
@@ -220,7 +220,7 @@
 
         self.check_trust_roles()
 
-    @attr(type='smoke')
+    @test.attr(type='smoke')
     def test_trust_expire(self):
         # Test case to check we can create, get and delete a trust
         # with an expiry specified
@@ -236,7 +236,7 @@
 
         self.check_trust_roles()
 
-    @attr(type='smoke')
+    @test.attr(type='smoke')
     def test_trust_expire_invalid(self):
         # Test case to check we can check an invlaid expiry time
         # is rejected with the correct error
@@ -246,7 +246,7 @@
                           self.create_trust,
                           expires=expires_str)
 
-    @attr(type='smoke')
+    @test.attr(type='smoke')
     def test_get_trusts_query(self):
         self.create_trust()
         resp, trusts_get = self.trustor_client.get_trusts(
@@ -255,7 +255,7 @@
         self.assertEqual(1, len(trusts_get))
         self.validate_trust(trusts_get[0], summary=True)
 
-    @attr(type='smoke')
+    @test.attr(type='smoke')
     def test_get_trusts_all(self):
         self.create_trust()
         resp, trusts_get = self.client.get_trusts()
diff --git a/tempest/api/orchestration/stacks/test_server_cfn_init.py b/tempest/api/orchestration/stacks/test_server_cfn_init.py
index 4267c1d..5130f87 100644
--- a/tempest/api/orchestration/stacks/test_server_cfn_init.py
+++ b/tempest/api/orchestration/stacks/test_server_cfn_init.py
@@ -15,10 +15,10 @@
 
 from tempest.api.orchestration import base
 from tempest.common.utils import data_utils
-from tempest.common.utils.linux.remote_client import RemoteClient
+from tempest.common.utils.linux import remote_client
 from tempest import config
 from tempest.openstack.common import log as logging
-from tempest.test import attr
+from tempest import test
 
 CONF = config.CONF
 LOG = logging.getLogger(__name__)
@@ -147,7 +147,7 @@
                 'network': cls._get_default_network()['id']
             })
 
-    @attr(type='slow')
+    @test.attr(type='slow')
     @testtools.skipIf(existing_keypair, 'Server ssh tests are disabled.')
     def test_can_log_into_created_server(self):
 
@@ -166,11 +166,12 @@
             body['physical_resource_id'])
 
         # Check that the user can authenticate with the generated password
-        linux_client = RemoteClient(server, 'ec2-user',
-                                    pkey=self.keypair['private_key'])
+        linux_client = remote_client.RemoteClient(server, 'ec2-user',
+                                                  pkey=self.keypair[
+                                                      'private_key'])
         linux_client.validate_authentication()
 
-    @attr(type='slow')
+    @test.attr(type='slow')
     def test_stack_wait_condition_data(self):
 
         sid = self.stack_identifier
diff --git a/tempest/api/utils.py b/tempest/api/utils.py
index c62dc8d..00c93b7 100644
--- a/tempest/api/utils.py
+++ b/tempest/api/utils.py
@@ -15,7 +15,7 @@
 
 """Common utilities used in testing."""
 
-from tempest.test import BaseTestCase
+from tempest import test
 
 
 class skip_unless_attr(object):
@@ -30,7 +30,7 @@
             """Wrapped skipper function."""
             testobj = args[0]
             if not getattr(testobj, self.attr, False):
-                raise BaseTestCase.skipException(self.message)
+                raise test.BaseTestCase.skipException(self.message)
             func(*args, **kw)
         _skipper.__name__ = func.__name__
         _skipper.__doc__ = func.__doc__
diff --git a/tempest/api/volume/admin/test_volumes_backup.py b/tempest/api/volume/admin/test_volumes_backup.py
new file mode 100644
index 0000000..47094f0
--- /dev/null
+++ b/tempest/api/volume/admin/test_volumes_backup.py
@@ -0,0 +1,67 @@
+# Copyright 2014 OpenStack Foundation
+# All Rights Reserved.
+#
+#    Licensed under the Apache License, Version 2.0 (the "License"); you may
+#    not use this file except in compliance with the License. You may obtain
+#    a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+#    License for the specific language governing permissions and limitations
+#    under the License.
+
+from tempest.api.volume.base import BaseVolumeV1AdminTest
+from tempest.common.utils import data_utils
+from tempest import config
+from tempest.openstack.common import log as logging
+from tempest import test
+
+CONF = config.CONF
+LOG = logging.getLogger(__name__)
+
+
+class VolumesBackupsTest(BaseVolumeV1AdminTest):
+    _interface = "json"
+
+    @classmethod
+    def setUpClass(cls):
+        super(VolumesBackupsTest, cls).setUpClass()
+
+        if not CONF.volume_feature_enabled.backup:
+            raise cls.skipException("Cinder backup feature disabled")
+
+        cls.volumes_adm_client = cls.os_adm.volumes_client
+        cls.backups_adm_client = cls.os_adm.backups_client
+        cls.volume = cls.create_volume()
+
+    @test.attr(type='smoke')
+    def test_volume_backup_create_get_restore_delete(self):
+        backup_name = data_utils.rand_name('Backup')
+        create_backup = self.backups_adm_client.create_backup
+        resp, backup = create_backup(self.volume['id'],
+                                     name=backup_name)
+        self.assertEqual(202, resp.status)
+        self.addCleanup(self.backups_adm_client.delete_backup,
+                        backup['id'])
+        self.assertEqual(backup['name'], backup_name)
+        self.volumes_adm_client.wait_for_volume_status(self.volume['id'],
+                                                       'available')
+        self.backups_adm_client.wait_for_backup_status(backup['id'],
+                                                       'available')
+
+        resp, backup = self.backups_adm_client.get_backup(backup['id'])
+        self.assertEqual(200, resp.status)
+        self.assertEqual(backup['name'], backup_name)
+
+        resp, restore = self.backups_adm_client.restore_backup(backup['id'])
+        self.assertEqual(202, resp.status)
+        self.addCleanup(self.volumes_adm_client.delete_volume,
+                        restore['volume_id'])
+        self.assertEqual(restore['backup_id'], backup['id'])
+        self.backups_adm_client.wait_for_backup_status(backup['id'],
+                                                       'available')
+        self.volumes_adm_client.wait_for_volume_status(restore['volume_id'],
+                                                       'available')
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index 6b6f638..8824977 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -106,6 +106,7 @@
         super(BaseVolumeV1Test, cls).setUpClass()
         cls.snapshots_client = cls.os.snapshots_client
         cls.volumes_client = cls.os.volumes_client
+        cls.backups_client = cls.os.backups_client
         cls.volumes_extension_client = cls.os.volumes_extension_client
 
     @classmethod
diff --git a/tempest/api/volume/test_volume_metadata.py b/tempest/api/volume/test_volume_metadata.py
index 7d2216d..e94c700 100644
--- a/tempest/api/volume/test_volume_metadata.py
+++ b/tempest/api/volume/test_volume_metadata.py
@@ -13,7 +13,7 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-from testtools.matchers import ContainsAll
+from testtools import matchers
 
 from tempest.api.volume import base
 from tempest import test
@@ -52,7 +52,7 @@
         # Get the metadata of the volume
         resp, body = self.volumes_client.get_volume_metadata(self.volume_id)
         self.assertEqual(200, resp.status)
-        self.assertThat(body.items(), ContainsAll(metadata.items()))
+        self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
         # Delete one item metadata of the volume
         rsp, body = self.volumes_client.delete_volume_metadata_item(
             self.volume_id,
@@ -61,7 +61,7 @@
         resp, body = self.volumes_client.get_volume_metadata(self.volume_id)
         self.assertNotIn("key1", body)
         del metadata["key1"]
-        self.assertThat(body.items(), ContainsAll(metadata.items()))
+        self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
 
     @test.attr(type='gate')
     def test_update_volume_metadata(self):
@@ -81,7 +81,7 @@
         # Get the metadata of the volume
         resp, body = self.volumes_client.get_volume_metadata(self.volume_id)
         self.assertEqual(200, resp.status)
-        self.assertThat(body.items(), ContainsAll(metadata.items()))
+        self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
         # Update metadata
         resp, body = self.volumes_client.update_volume_metadata(
             self.volume_id,
@@ -90,7 +90,7 @@
         # Get the metadata of the volume
         resp, body = self.volumes_client.get_volume_metadata(self.volume_id)
         self.assertEqual(200, resp.status)
-        self.assertThat(body.items(), ContainsAll(update.items()))
+        self.assertThat(body.items(), matchers.ContainsAll(update.items()))
 
     @test.attr(type='gate')
     def test_update_volume_metadata_item(self):
@@ -107,7 +107,7 @@
             self.volume_id,
             metadata)
         self.assertEqual(200, resp.status)
-        self.assertThat(body.items(), ContainsAll(metadata.items()))
+        self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
         # Update metadata item
         resp, body = self.volumes_client.update_volume_metadata_item(
             self.volume_id,
@@ -117,7 +117,7 @@
         # Get the metadata of the volume
         resp, body = self.volumes_client.get_volume_metadata(self.volume_id)
         self.assertEqual(200, resp.status)
-        self.assertThat(body.items(), ContainsAll(expect.items()))
+        self.assertThat(body.items(), matchers.ContainsAll(expect.items()))
 
 
 class VolumeMetadataTestXML(VolumeMetadataTest):
diff --git a/tempest/api/volume/test_volumes_actions.py b/tempest/api/volume/test_volumes_actions.py
index 5924c7e..a22ad32 100644
--- a/tempest/api/volume/test_volumes_actions.py
+++ b/tempest/api/volume/test_volumes_actions.py
@@ -16,9 +16,7 @@
 from tempest.api.volume import base
 from tempest.common.utils import data_utils
 from tempest import config
-from tempest.test import attr
-from tempest.test import services
-from tempest.test import stresstest
+from tempest import test
 
 CONF = config.CONF
 
@@ -50,9 +48,9 @@
 
         super(VolumesActionsTest, cls).tearDownClass()
 
-    @stresstest(class_setup_per='process')
-    @attr(type='smoke')
-    @services('compute')
+    @test.stresstest(class_setup_per='process')
+    @test.attr(type='smoke')
+    @test.services('compute')
     def test_attach_detach_volume_to_instance(self):
         # Volume is attached and detached successfully from an instance
         mountpoint = '/dev/vdc'
@@ -65,9 +63,9 @@
         self.assertEqual(202, resp.status)
         self.client.wait_for_volume_status(self.volume['id'], 'available')
 
-    @stresstest(class_setup_per='process')
-    @attr(type='gate')
-    @services('compute')
+    @test.stresstest(class_setup_per='process')
+    @test.attr(type='gate')
+    @test.services('compute')
     def test_get_volume_attachment(self):
         # Verify that a volume's attachment information is retrieved
         mountpoint = '/dev/vdc'
@@ -91,8 +89,8 @@
         self.assertEqual(self.volume['id'], attachment['id'])
         self.assertEqual(self.volume['id'], attachment['volume_id'])
 
-    @attr(type='gate')
-    @services('image')
+    @test.attr(type='gate')
+    @test.services('image')
     def test_volume_upload(self):
         # NOTE(gfidente): the volume uploaded in Glance comes from setUpClass,
         # it is shared with the other tests. After it is uploaded in Glance,
@@ -108,7 +106,7 @@
         self.image_client.wait_for_image_status(image_id, 'active')
         self.client.wait_for_volume_status(self.volume['id'], 'available')
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_volume_extend(self):
         # Extend Volume Test.
         extend_size = int(self.volume['size']) + 1
@@ -119,7 +117,7 @@
         self.assertEqual(200, resp.status)
         self.assertEqual(int(volume['size']), extend_size)
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_reserve_unreserve_volume(self):
         # Mark volume as reserved.
         resp, body = self.client.reserve_volume(self.volume['id'])
@@ -139,7 +137,7 @@
     def _is_true(self, val):
         return val in ['true', 'True', True]
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_volume_readonly_update(self):
         # Update volume readonly true
         readonly = True
diff --git a/tempest/api/volume/test_volumes_get.py b/tempest/api/volume/test_volumes_get.py
index ce29b82..175da01 100644
--- a/tempest/api/volume/test_volumes_get.py
+++ b/tempest/api/volume/test_volumes_get.py
@@ -13,13 +13,12 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-from testtools.matchers import ContainsAll
+from testtools import matchers
 
 from tempest.api.volume import base
 from tempest.common.utils import data_utils
 from tempest import config
-from tempest.test import attr
-from tempest.test import services
+from tempest import test
 
 CONF = config.CONF
 
@@ -78,7 +77,7 @@
                          'The fetched Volume id is different '
                          'from the created Volume')
         self.assertThat(fetched_volume['metadata'].items(),
-                        ContainsAll(metadata.items()),
+                        matchers.ContainsAll(metadata.items()),
                         'The fetched Volume metadata misses data '
                         'from the created Volume')
 
@@ -114,7 +113,7 @@
         self.assertEqual(new_v_name, updated_volume['display_name'])
         self.assertEqual(new_desc, updated_volume['display_description'])
         self.assertThat(updated_volume['metadata'].items(),
-                        ContainsAll(metadata.items()),
+                        matchers.ContainsAll(metadata.items()),
                         'The fetched Volume metadata misses data '
                         'from the created Volume')
         # Test volume create when display_name is none and display_description
@@ -146,16 +145,16 @@
         if 'imageRef' not in kwargs:
             self.assertEqual(boot_flag, False)
 
-    @attr(type='smoke')
+    @test.attr(type='smoke')
     def test_volume_create_get_update_delete(self):
         self._volume_create_get_update_delete()
 
-    @attr(type='smoke')
-    @services('image')
+    @test.attr(type='smoke')
+    @test.services('image')
     def test_volume_create_get_update_delete_from_image(self):
         self._volume_create_get_update_delete(imageRef=CONF.compute.image_ref)
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_volume_create_get_update_delete_as_clone(self):
         origin = self.create_volume()
         self._volume_create_get_update_delete(source_volid=origin['id'])
diff --git a/tempest/api/volume/test_volumes_list.py b/tempest/api/volume/test_volumes_list.py
index 049544d..c356342 100644
--- a/tempest/api/volume/test_volumes_list.py
+++ b/tempest/api/volume/test_volumes_list.py
@@ -18,8 +18,8 @@
 from tempest.api.volume import base
 from tempest.common.utils import data_utils
 from tempest.openstack.common import log as logging
-from tempest.test import attr
-from testtools.matchers import ContainsAll
+from tempest import test
+from testtools import matchers
 
 LOG = logging.getLogger(__name__)
 
@@ -111,12 +111,12 @@
                       ('details' if with_detail else '', key)
                 if key == 'metadata':
                     self.assertThat(volume[key].items(),
-                                    ContainsAll(params[key].items()),
+                                    matchers.ContainsAll(params[key].items()),
                                     msg)
                 else:
                     self.assertEqual(params[key], volume[key], msg)
 
-    @attr(type='smoke')
+    @test.attr(type='smoke')
     def test_volume_list(self):
         # Get a list of Volumes
         # Fetch all volumes
@@ -125,7 +125,7 @@
         self.assertVolumesIn(fetched_list, self.volume_list,
                              fields=VOLUME_FIELDS)
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_volume_list_with_details(self):
         # Get a list of Volumes with details
         # Fetch all Volumes
@@ -133,7 +133,7 @@
         self.assertEqual(200, resp.status)
         self.assertVolumesIn(fetched_list, self.volume_list)
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_volume_list_by_name(self):
         volume = self.volume_list[data_utils.rand_int_id(0, 2)]
         params = {'display_name': volume['display_name']}
@@ -143,7 +143,7 @@
         self.assertEqual(fetched_vol[0]['display_name'],
                          volume['display_name'])
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_volume_list_details_by_name(self):
         volume = self.volume_list[data_utils.rand_int_id(0, 2)]
         params = {'display_name': volume['display_name']}
@@ -153,7 +153,7 @@
         self.assertEqual(fetched_vol[0]['display_name'],
                          volume['display_name'])
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_volumes_list_by_status(self):
         params = {'status': 'available'}
         resp, fetched_list = self.client.list_volumes(params)
@@ -163,7 +163,7 @@
         self.assertVolumesIn(fetched_list, self.volume_list,
                              fields=VOLUME_FIELDS)
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_volumes_list_details_by_status(self):
         params = {'status': 'available'}
         resp, fetched_list = self.client.list_volumes_with_detail(params)
@@ -172,7 +172,7 @@
             self.assertEqual('available', volume['status'])
         self.assertVolumesIn(fetched_list, self.volume_list)
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_volumes_list_by_availability_zone(self):
         volume = self.volume_list[data_utils.rand_int_id(0, 2)]
         zone = volume['availability_zone']
@@ -184,7 +184,7 @@
         self.assertVolumesIn(fetched_list, self.volume_list,
                              fields=VOLUME_FIELDS)
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_volumes_list_details_by_availability_zone(self):
         volume = self.volume_list[data_utils.rand_int_id(0, 2)]
         zone = volume['availability_zone']
@@ -195,19 +195,19 @@
             self.assertEqual(zone, volume['availability_zone'])
         self.assertVolumesIn(fetched_list, self.volume_list)
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_volume_list_with_param_metadata(self):
         # Test to list volumes when metadata param is given
         params = {'metadata': self.metadata}
         self._list_by_param_value_and_assert(params)
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_volume_list_with_detail_param_metadata(self):
         # Test to list volumes details when metadata param is given
         params = {'metadata': self.metadata}
         self._list_by_param_value_and_assert(params, with_detail=True)
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_volume_list_param_display_name_and_status(self):
         # Test to list volume when display name and status param is given
         volume = self.volume_list[data_utils.rand_int_id(0, 2)]
@@ -215,7 +215,7 @@
                   'status': 'available'}
         self._list_by_param_value_and_assert(params)
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_volume_list_with_detail_param_display_name_and_status(self):
         # Test to list volume when name and status param is given
         volume = self.volume_list[data_utils.rand_int_id(0, 2)]
diff --git a/tempest/clients.py b/tempest/clients.py
index d0eb1cc..3db05e5 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -148,6 +148,7 @@
     VolumeHostsClientJSON
 from tempest.services.volume.json.admin.volume_types_client import \
     VolumeTypesClientJSON
+from tempest.services.volume.json.backups_client import BackupsClientJSON
 from tempest.services.volume.json.extensions_client import \
     ExtensionsClientJSON as VolumeExtensionClientJSON
 from tempest.services.volume.json.snapshots_client import SnapshotsClientJSON
@@ -158,6 +159,7 @@
     VolumeHostsClientXML
 from tempest.services.volume.xml.admin.volume_types_client import \
     VolumeTypesClientXML
+from tempest.services.volume.xml.backups_client import BackupsClientXML
 from tempest.services.volume.xml.extensions_client import \
     ExtensionsClientXML as VolumeExtensionClientXML
 from tempest.services.volume.xml.snapshots_client import SnapshotsClientXML
@@ -212,6 +214,7 @@
                 auth_provider)
             self.floating_ips_client = FloatingIPsClientXML(
                 auth_provider)
+            self.backups_client = BackupsClientXML(auth_provider)
             self.snapshots_client = SnapshotsClientXML(auth_provider)
             self.volumes_client = VolumesClientXML(auth_provider)
             self.volumes_v2_client = VolumesV2ClientXML(auth_provider)
@@ -277,6 +280,7 @@
                 auth_provider)
             self.floating_ips_client = FloatingIPsClientJSON(
                 auth_provider)
+            self.backups_client = BackupsClientJSON(auth_provider)
             self.snapshots_client = SnapshotsClientJSON(auth_provider)
             self.volumes_client = VolumesClientJSON(auth_provider)
             self.volumes_v2_client = VolumesV2ClientJSON(auth_provider)
diff --git a/tempest/config.py b/tempest/config.py
index 210c857..49d65f9 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -397,6 +397,9 @@
     cfg.BoolOpt('multi_backend',
                 default=False,
                 help="Runs Cinder multi-backend test (requires 2 backends)"),
+    cfg.BoolOpt('backup',
+                default=True,
+                help='Runs Cinder volumes backup test'),
     cfg.ListOpt('api_extensions',
                 default=['all'],
                 help='A list of enabled extensions with a special entry all '
@@ -606,7 +609,12 @@
                 default=False,
                 help='Prevent the cleaning (tearDownClass()) between'
                      ' each stress test run if an exception occurs'
-                     ' during this run.')
+                     ' during this run.'),
+    cfg.BoolOpt('full_clean_stack',
+                default=False,
+                help='Allows a full cleaning process after a stress test.'
+                     ' Caution : this cleanup will remove every objects of'
+                     ' every tenant.')
 ]
 
 
diff --git a/tempest/exceptions.py b/tempest/exceptions.py
index 3b3f3eb..ac88faa 100644
--- a/tempest/exceptions.py
+++ b/tempest/exceptions.py
@@ -100,6 +100,10 @@
     message = "Snapshot %(snapshot_id)s failed to build and is in ERROR status"
 
 
+class VolumeBackupException(TempestException):
+    message = "Volume backup %(backup_id)s failed and is in ERROR status"
+
+
 class StackBuildErrorException(TempestException):
     message = ("Stack %(stack_identifier)s is in %(stack_status)s status "
                "due to '%(stack_status_reason)s'")
diff --git a/tempest/services/volume/json/backups_client.py b/tempest/services/volume/json/backups_client.py
new file mode 100644
index 0000000..baaf5a0
--- /dev/null
+++ b/tempest/services/volume/json/backups_client.py
@@ -0,0 +1,89 @@
+# Copyright 2014 OpenStack Foundation
+# All Rights Reserved.
+#
+#    Licensed under the Apache License, Version 2.0 (the "License"); you may
+#    not use this file except in compliance with the License. You may obtain
+#    a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+#    License for the specific language governing permissions and limitations
+#    under the License.
+
+import json
+import time
+
+from tempest.common import rest_client
+from tempest import config
+from tempest import exceptions
+
+CONF = config.CONF
+
+
+class BackupsClientJSON(rest_client.RestClient):
+    """
+    Client class to send CRUD Volume backup API requests to a Cinder endpoint
+    """
+
+    def __init__(self, auth_provider):
+        super(BackupsClientJSON, self).__init__(auth_provider)
+        self.service = CONF.volume.catalog_type
+        self.build_interval = CONF.volume.build_interval
+        self.build_timeout = CONF.volume.build_timeout
+
+    def create_backup(self, volume_id, container=None, name=None,
+                      description=None):
+        """Creates a backup of volume."""
+        post_body = {'volume_id': volume_id}
+        if container:
+            post_body['container'] = container
+        if name:
+            post_body['name'] = name
+        if description:
+            post_body['description'] = description
+        post_body = json.dumps({'backup': post_body})
+        resp, body = self.post('backups', post_body)
+        body = json.loads(body)
+        return resp, body['backup']
+
+    def restore_backup(self, backup_id, volume_id=None):
+        """Restore volume from backup."""
+        post_body = {'volume_id': volume_id}
+        post_body = json.dumps({'restore': post_body})
+        resp, body = self.post('backups/%s/restore' % (backup_id), post_body)
+        body = json.loads(body)
+        return resp, body['restore']
+
+    def delete_backup(self, backup_id):
+        """Delete a backup of volume."""
+        resp, body = self.delete('backups/%s' % (str(backup_id)))
+        return resp, body
+
+    def get_backup(self, backup_id):
+        """Returns the details of a single backup."""
+        url = "backups/%s" % str(backup_id)
+        resp, body = self.get(url)
+        body = json.loads(body)
+        return resp, body['backup']
+
+    def wait_for_backup_status(self, backup_id, status):
+        """Waits for a Backup to reach a given status."""
+        resp, body = self.get_backup(backup_id)
+        backup_status = body['status']
+        start = int(time.time())
+
+        while backup_status != status:
+            time.sleep(self.build_interval)
+            resp, body = self.get_backup(backup_id)
+            backup_status = body['status']
+            if backup_status == 'error':
+                raise exceptions.VolumeBackupException(backup_id=backup_id)
+
+            if int(time.time()) - start >= self.build_timeout:
+                message = ('Volume backup %s failed to reach %s status within '
+                           'the required time (%s s).' %
+                           (backup_id, status, self.build_timeout))
+                raise exceptions.TimeoutException(message)
diff --git a/tempest/services/volume/xml/backups_client.py b/tempest/services/volume/xml/backups_client.py
new file mode 100644
index 0000000..6a71f8b
--- /dev/null
+++ b/tempest/services/volume/xml/backups_client.py
@@ -0,0 +1,25 @@
+# Copyright 2014 OpenStack Foundation
+# All Rights Reserved.
+#
+#    Licensed under the Apache License, Version 2.0 (the "License"); you may
+#    not use this file except in compliance with the License. You may obtain
+#    a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+#    License for the specific language governing permissions and limitations
+#    under the License.
+
+from tempest.common.rest_client import RestClientXML
+
+
+class BackupsClientXML(RestClientXML):
+    """
+    Client class to send CRUD Volume Backup API requests to a Cinder endpoint
+    """
+
+    #TODO(gfidente): XML client isn't yet implemented because of bug 1270589
+    pass
diff --git a/tempest/stress/driver.py b/tempest/stress/driver.py
index d4689c4..3715636 100644
--- a/tempest/stress/driver.py
+++ b/tempest/stress/driver.py
@@ -220,7 +220,7 @@
     LOG.info("Run %d actions (%d failed)" %
              (sum_runs, sum_fails))
 
-    if not had_errors:
+    if not had_errors and CONF.stress.full_clean_stack:
         LOG.info("cleaning up")
         cleanup.cleanup()
     if had_errors: