Merge "Beautify assertEmpty and assertNotEmpty"
diff --git a/doc/source/conf.py b/doc/source/conf.py
index 2597f04..cbfcc09 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -1,3 +1,16 @@
+# 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.
+
 # Tempest documentation build configuration file, created by
 # sphinx-quickstart on Tue May 21 17:43:32 2013.
 #
diff --git a/doc/source/write_tests.rst b/doc/source/write_tests.rst
index 768bf0f..67b55aa 100644
--- a/doc/source/write_tests.rst
+++ b/doc/source/write_tests.rst
@@ -1,7 +1,7 @@
 .. _tempest_test_writing:
 
 Tempest Test Writing Guide
-==========================
+##########################
 
 This guide serves as a starting point for developers working on writing new
 Tempest tests. At a high level tests in Tempest are just tests that conform to
diff --git a/releasenotes/notes/add-cascade-parameter-to-volumes-client-ff4f7f12795003a4.yaml b/releasenotes/notes/add-cascade-parameter-to-volumes-client-ff4f7f12795003a4.yaml
new file mode 100644
index 0000000..6801858
--- /dev/null
+++ b/releasenotes/notes/add-cascade-parameter-to-volumes-client-ff4f7f12795003a4.yaml
@@ -0,0 +1,7 @@
+---
+features:
+  - |
+    Add cascade parameter to volumes_client.
+    This option provides the ability to delete a volume and have Cinder
+    handle deletion of snapshots associated with that volume by passing
+    an additional argument to volume delete, "cascade=True".
diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py
index eec42cd..97e3a4d 100644
--- a/releasenotes/source/conf.py
+++ b/releasenotes/source/conf.py
@@ -11,7 +11,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# tempest Release Notes documentation build configuration file, created by
+# Tempest Release Notes documentation build configuration file, created by
 # sphinx-quickstart on Tue Nov  3 17:40:50 2015.
 #
 # This file is execfile()d with the current directory set to its
diff --git a/requirements.txt b/requirements.txt
index 7c934c2..14c42b3 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,7 +1,7 @@
 # The order of packages is significant, because pip processes them in the order
 # of appearance. Changing the order has an impact on the overall integration
 # process, which may cause wedges in the gate later.
-pbr>=2.0.0 # Apache-2.0
+pbr!=2.1.0,>=2.0.0 # Apache-2.0
 cliff>=2.3.0 # Apache-2.0
 jsonschema!=2.5.0,<3.0.0,>=2.0.0 # MIT
 testtools>=1.4.0 # MIT
diff --git a/tempest/api/compute/admin/test_baremetal_nodes.py b/tempest/api/compute/admin/test_baremetal_nodes.py
deleted file mode 100644
index 7726ed4..0000000
--- a/tempest/api/compute/admin/test_baremetal_nodes.py
+++ /dev/null
@@ -1,55 +0,0 @@
-# Copyright 2015 NEC Corporation.  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.compute import base
-from tempest import config
-from tempest.lib import decorators
-from tempest import test
-
-CONF = config.CONF
-
-
-class BaremetalNodesAdminTestJSON(base.BaseV2ComputeAdminTest):
-    """Tests Baremetal API"""
-
-    @classmethod
-    def resource_setup(cls):
-        super(BaremetalNodesAdminTestJSON, cls).resource_setup()
-        if not getattr(CONF.service_available, 'ironic', False):
-            skip_msg = ('%s skipped as Ironic is not available' % cls.__name__)
-            raise cls.skipException(skip_msg)
-        cls.client = cls.os_adm.baremetal_nodes_client
-        cls.ironic_client = cls.os_adm.baremetal_client
-
-    @test.attr(type=['baremetal'])
-    @decorators.idempotent_id('e475aa6e-416d-4fa4-b3af-28d5e84250fb')
-    def test_list_get_baremetal_nodes(self):
-        # Create some test nodes in Ironic directly
-        test_nodes = []
-        for _ in range(0, 3):
-            _, node = self.ironic_client.create_node()
-            test_nodes.append(node)
-            self.addCleanup(self.ironic_client.delete_node, node['uuid'])
-
-        # List all baremetal nodes and ensure our created test nodes are
-        # listed
-        bm_node_ids = set([n['id'] for n in
-                           self.client.list_baremetal_nodes()['nodes']])
-        test_node_ids = set([n['uuid'] for n in test_nodes])
-        self.assertTrue(test_node_ids.issubset(bm_node_ids))
-
-        # Test getting each individually
-        for node in test_nodes:
-            baremetal_node = self.client.show_baremetal_node(node['uuid'])
-            self.assertEqual(node['uuid'], baremetal_node['node']['id'])
diff --git a/tempest/api/compute/admin/test_live_migration.py b/tempest/api/compute/admin/test_live_migration.py
index 3ffd238..0ceb13c 100644
--- a/tempest/api/compute/admin/test_live_migration.py
+++ b/tempest/api/compute/admin/test_live_migration.py
@@ -13,7 +13,7 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-
+from oslo_log import log as logging
 import testtools
 
 from tempest.api.compute import base
@@ -23,6 +23,7 @@
 from tempest import test
 
 CONF = config.CONF
+LOG = logging.getLogger(__name__)
 
 
 class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest):
@@ -80,6 +81,22 @@
             if host != target_host:
                 return target_host
 
+    def _live_migrate(self, server_id, target_host, state,
+                      volume_backed=False):
+        self._migrate_server_to(server_id, target_host, volume_backed)
+        waiters.wait_for_server_status(self.servers_client, server_id, state)
+        migration_list = (self.admin_migration_client.list_migrations()
+                          ['migrations'])
+
+        msg = ("Live Migration failed. Migrations list for Instance "
+               "%s: [" % server_id)
+        for live_migration in migration_list:
+            if (live_migration['instance_uuid'] == server_id):
+                msg += "\n%s" % live_migration
+        msg += "]"
+        self.assertEqual(target_host, self._get_host_for_server(server_id),
+                         msg)
+
     def _test_live_migration(self, state='ACTIVE', volume_backed=False):
         """Tests live migration between two hosts.
 
@@ -94,27 +111,23 @@
         # Live migrate an instance to another host
         server_id = self.create_test_server(wait_until="ACTIVE",
                                             volume_backed=volume_backed)['id']
-        actual_host = self._get_host_for_server(server_id)
-        target_host = self._get_host_other_than(actual_host)
+        source_host = self._get_host_for_server(server_id)
+        destination_host = self._get_host_other_than(source_host)
 
         if state == 'PAUSED':
             self.admin_servers_client.pause_server(server_id)
             waiters.wait_for_server_status(self.admin_servers_client,
                                            server_id, state)
 
-        self._migrate_server_to(server_id, target_host, volume_backed)
-        waiters.wait_for_server_status(self.servers_client, server_id, state)
-        migration_list = (self.admin_migration_client.list_migrations()
-                          ['migrations'])
-
-        msg = ("Live Migration failed. Migrations list for Instance "
-               "%s: [" % server_id)
-        for live_migration in migration_list:
-            if (live_migration['instance_uuid'] == server_id):
-                msg += "\n%s" % live_migration
-        msg += "]"
-        self.assertEqual(target_host, self._get_host_for_server(server_id),
-                         msg)
+        LOG.info("Live migrate from source %s to destination %s",
+                 source_host, destination_host)
+        self._live_migrate(server_id, destination_host, state, volume_backed)
+        if CONF.compute_feature_enabled.live_migrate_back_and_forth:
+            # If live_migrate_back_and_forth is enabled it is a grenade job.
+            # Therefore test should validate whether LM is compatible in both
+            # ways, so live migrate VM back to the source host
+            LOG.info("Live migrate back to source %s", source_host)
+            self._live_migrate(server_id, source_host, state, volume_backed)
 
     @decorators.idempotent_id('1dce86b8-eb04-4c03-a9d8-9c1dc3ee0c7b')
     def test_live_block_migration(self):
diff --git a/tempest/api/identity/admin/v2/test_tokens.py b/tempest/api/identity/admin/v2/test_tokens.py
index 3428c07..98abd02 100644
--- a/tempest/api/identity/admin/v2/test_tokens.py
+++ b/tempest/api/identity/admin/v2/test_tokens.py
@@ -87,10 +87,7 @@
         self.addCleanup(self.tenants_client.delete_tenant, tenant2['id'])
 
         # Create a role
-        role_name = data_utils.rand_name(name='role')
-        role = self.roles_client.create_role(name=role_name)['role']
-        # Delete the role at the end of the test
-        self.addCleanup(self.roles_client.delete_role, role['id'])
+        role = self.setup_test_role()
 
         # Grant the user the role on the tenants.
         self.roles_client.create_user_role_on_project(tenant1['id'],
diff --git a/tempest/api/identity/admin/v3/test_inherits.py b/tempest/api/identity/admin/v3/test_inherits.py
index 3fe591b..4de0f5b 100644
--- a/tempest/api/identity/admin/v3/test_inherits.py
+++ b/tempest/api/identity/admin/v3/test_inherits.py
@@ -65,9 +65,7 @@
     @decorators.idempotent_id('4e6f0366-97c8-423c-b2be-41eae6ac91c8')
     def test_inherit_assign_list_check_revoke_roles_on_domains_user(self):
         # Create role
-        src_role = self.roles_client.create_role(
-            name=data_utils.rand_name('Role'))['role']
-        self.addCleanup(self.roles_client.delete_role, src_role['id'])
+        src_role = self.setup_test_role()
         # Assign role on domains user
         self.inherited_roles_client.create_inherited_role_on_domains_user(
             self.domain['id'], self.user['id'], src_role['id'])
@@ -91,9 +89,7 @@
     @decorators.idempotent_id('c7a8dda2-be50-4fb4-9a9c-e830771078b1')
     def test_inherit_assign_list_check_revoke_roles_on_domains_group(self):
         # Create role
-        src_role = self.roles_client.create_role(
-            name=data_utils.rand_name('Role'))['role']
-        self.addCleanup(self.roles_client.delete_role, src_role['id'])
+        src_role = self.setup_test_role()
         # Assign role on domains group
         self.inherited_roles_client.create_inherited_role_on_domains_group(
             self.domain['id'], self.group['id'], src_role['id'])
@@ -117,9 +113,7 @@
     @decorators.idempotent_id('18b70e45-7687-4b72-8277-b8f1a47d7591')
     def test_inherit_assign_check_revoke_roles_on_projects_user(self):
         # Create role
-        src_role = self.roles_client.create_role(
-            name=data_utils.rand_name('Role'))['role']
-        self.addCleanup(self.roles_client.delete_role, src_role['id'])
+        src_role = self.setup_test_role()
         # Assign role on projects user
         self.inherited_roles_client.create_inherited_role_on_projects_user(
             self.project['id'], self.user['id'], src_role['id'])
@@ -134,9 +128,7 @@
     @decorators.idempotent_id('26021436-d5a4-4256-943c-ded01e0d4b45')
     def test_inherit_assign_check_revoke_roles_on_projects_group(self):
         # Create role
-        src_role = self.roles_client.create_role(
-            name=data_utils.rand_name('Role'))['role']
-        self.addCleanup(self.roles_client.delete_role, src_role['id'])
+        src_role = self.setup_test_role()
         # Assign role on projects group
         self.inherited_roles_client.create_inherited_role_on_projects_group(
             self.project['id'], self.group['id'], src_role['id'])
@@ -152,9 +144,7 @@
     @decorators.idempotent_id('3acf666e-5354-42ac-8e17-8b68893bcd36')
     def test_inherit_assign_list_revoke_user_roles_on_domain(self):
         # Create role
-        src_role = self.roles_client.create_role(
-            name=data_utils.rand_name('Role'))['role']
-        self.addCleanup(self.roles_client.delete_role, src_role['id'])
+        src_role = self.setup_test_role()
 
         # Create a project hierarchy
         leaf_project_name = data_utils.rand_name('project')
@@ -202,9 +192,7 @@
     @decorators.idempotent_id('9f02ccd9-9b57-46b4-8f77-dd5a736f3a06')
     def test_inherit_assign_list_revoke_user_roles_on_project_tree(self):
         # Create role
-        src_role = self.roles_client.create_role(
-            name=data_utils.rand_name('Role'))['role']
-        self.addCleanup(self.roles_client.delete_role, src_role['id'])
+        src_role = self.setup_test_role()
 
         # Create a project hierarchy
         leaf_project_name = data_utils.rand_name('project')
diff --git a/tempest/api/identity/admin/v3/test_tokens.py b/tempest/api/identity/admin/v3/test_tokens.py
index fabb91c..ae687f6 100644
--- a/tempest/api/identity/admin/v3/test_tokens.py
+++ b/tempest/api/identity/admin/v3/test_tokens.py
@@ -81,9 +81,7 @@
         self.addCleanup(self.projects_client.delete_project, project2['id'])
 
         # Create a role
-        role_name = data_utils.rand_name(name='role')
-        role = self.roles_client.create_role(name=role_name)['role']
-        self.addCleanup(self.roles_client.delete_role, role['id'])
+        role = self.setup_test_role()
 
         # Grant the user the role on both projects.
         self.roles_client.create_user_role_on_project(project1['id'],
diff --git a/tempest/api/identity/admin/v3/test_users.py b/tempest/api/identity/admin/v3/test_users.py
index 0d12ba9..28137ad 100644
--- a/tempest/api/identity/admin/v3/test_users.py
+++ b/tempest/api/identity/admin/v3/test_users.py
@@ -118,10 +118,7 @@
         # Delete the User at the end of this method
         self.addCleanup(self.users_client.delete_user, user_body['id'])
         # Creating Role
-        role_body = self.roles_client.create_role(
-            name=data_utils.rand_name('role'))['role']
-        # Delete the Role at the end of this method
-        self.addCleanup(self.roles_client.delete_role, role_body['id'])
+        role_body = self.setup_test_role()
 
         user = self.users_client.show_user(user_body['id'])['user']
         role = self.roles_client.show_role(role_body['id'])['role']
diff --git a/tempest/api/identity/base.py b/tempest/api/identity/base.py
index 8317535..5cb4c77 100644
--- a/tempest/api/identity/base.py
+++ b/tempest/api/identity/base.py
@@ -78,9 +78,9 @@
             self.users_client.delete_user, user['id'])
         return user
 
-    def setup_test_role(self, domain_id=None):
+    def setup_test_role(self, name=None, domain_id=None):
         """Set up a test role."""
-        params = {'name': data_utils.rand_name('test_role')}
+        params = {'name': name or data_utils.rand_name('test_role')}
         if domain_id:
             params['domain_id'] = domain_id
 
diff --git a/tempest/api/image/v2/test_images_member.py b/tempest/api/image/v2/test_images_member.py
index 7a495e7..0208780 100644
--- a/tempest/api/image/v2/test_images_member.py
+++ b/tempest/api/image/v2/test_images_member.py
@@ -96,20 +96,3 @@
     def test_get_image_members_schema(self):
         body = self.schemas_client.show_schema("members")
         self.assertEqual("members", body['name'])
-
-    @decorators.idempotent_id('cb961424-3f68-4d21-8e36-30ad66fb6bfb')
-    def test_get_private_image(self):
-        image_id = self._create_image()
-        member = self.image_member_client.create_image_member(
-            image_id, member=self.alt_tenant_id)
-        self.assertEqual(member['member_id'], self.alt_tenant_id)
-        self.assertEqual(member['image_id'], image_id)
-        self.assertEqual(member['status'], 'pending')
-        self.assertNotIn(image_id, self._list_image_ids_as_alt())
-        self.alt_image_member_client.update_image_member(image_id,
-                                                         self.alt_tenant_id,
-                                                         status='accepted')
-        self.assertIn(image_id, self._list_image_ids_as_alt())
-        self.image_member_client.delete_image_member(image_id,
-                                                     self.alt_tenant_id)
-        self.assertNotIn(image_id, self._list_image_ids_as_alt())
diff --git a/tempest/api/volume/test_volume_delete_cascade.py b/tempest/api/volume/test_volume_delete_cascade.py
new file mode 100644
index 0000000..bb32c11
--- /dev/null
+++ b/tempest/api/volume/test_volume_delete_cascade.py
@@ -0,0 +1,101 @@
+# Copyright 2016 Red Hat, Inc.
+# 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 operator
+
+import testtools
+
+from tempest.api.volume import base
+from tempest import config
+from tempest.lib import decorators
+
+CONF = config.CONF
+
+
+class VolumesDeleteCascade(base.BaseVolumeTest):
+    """Delete a volume with associated snapshots.
+
+    Cinder provides the ability to delete a volume with its
+    associated snapshots.
+    It is allow a volume and its snapshots to be removed in one operation
+    both for usability and performance reasons.
+    """
+
+    @classmethod
+    def skip_checks(cls):
+        super(VolumesDeleteCascade, cls).skip_checks()
+        if not CONF.volume_feature_enabled.snapshot:
+            raise cls.skipException("Cinder snapshot feature disabled")
+
+    def _assert_cascade_delete(self, volume_id):
+        # Fetch volume ids
+        volume_list = [
+            vol['id'] for vol in
+            self.volumes_client.list_volumes()['volumes']
+            ]
+
+        # Verify the parent volume was deleted
+        self.assertNotIn(volume_id, volume_list)
+
+        # List snapshots
+        snapshot_list = self.snapshots_client.list_snapshots()['snapshots']
+
+        # Verify snapshots were deleted
+        self.assertNotIn(volume_id, map(operator.itemgetter('volume_id'),
+                                        snapshot_list))
+
+    @decorators.idempotent_id('994e2d40-de37-46e8-b328-a58fba7e4a95')
+    def test_volume_delete_cascade(self):
+        # The case validates the ability to delete a volume
+        # with associated snapshots.
+
+        # Create a volume
+        volume = self.create_volume()
+
+        for _ in range(2):
+            self.create_snapshot(volume['id'])
+
+        # Delete the parent volume with associated snapshots
+        self.volumes_client.delete_volume(volume['id'], cascade=True)
+        self.volumes_client.wait_for_resource_deletion(volume['id'])
+
+        # Verify volume parent was deleted with its associated snapshots
+        self._assert_cascade_delete(volume['id'])
+
+    @decorators.idempotent_id('59a77ede-609b-4ee8-9f68-fc3c6ffe97b5')
+    @testtools.skipIf(CONF.volume.storage_protocol == 'ceph',
+                      'Skip because of Bug#1677525')
+    def test_volume_from_snapshot_cascade_delete(self):
+        # The case validates the ability to delete a volume with
+        # associated snapshot while there is another volume created
+        # from that snapshot.
+
+        # Create a volume
+        volume = self.create_volume()
+
+        snapshot = self.create_snapshot(volume['id'])
+
+        # Create volume from snapshot
+        volume_snap = self.create_volume(snapshot_id=snapshot['id'])
+        volume_details = self.volumes_client.show_volume(
+            volume_snap['id'])['volume']
+        self.assertEqual(snapshot['id'], volume_details['snapshot_id'])
+
+        # Delete the parent volume with associated snapshot
+        self.volumes_client.delete_volume(volume['id'], cascade=True)
+        self.volumes_client.wait_for_resource_deletion(volume['id'])
+
+        # Verify volume parent was deleted with its associated snapshot
+        self._assert_cascade_delete(volume['id'])
diff --git a/tempest/api/volume/test_volumes_backup.py b/tempest/api/volume/test_volumes_backup.py
index 925beee..5ad209c 100644
--- a/tempest/api/volume/test_volumes_backup.py
+++ b/tempest/api/volume/test_volumes_backup.py
@@ -50,6 +50,8 @@
                                                 'available')
         return restored_volume
 
+    @testtools.skipIf(CONF.volume.storage_protocol == 'ceph',
+                      'ceph does not support arbitrary container names')
     @decorators.idempotent_id('a66eb488-8ee1-47d4-8e9f-575a095728c6')
     def test_volume_backup_create_get_detailed_list_restore_delete(self):
         # Create a volume with metadata
diff --git a/tempest/clients.py b/tempest/clients.py
index 01abfd8..d21e6a7 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -159,7 +159,6 @@
         self.aggregates_client = self.compute.AggregatesClient()
         self.services_client = self.compute.ServicesClient()
         self.tenant_usages_client = self.compute.TenantUsagesClient()
-        self.baremetal_nodes_client = self.compute.BaremetalNodesClient()
         self.hosts_client = self.compute.HostsClient()
         self.hypervisor_client = self.compute.HypervisorClient()
         self.instance_usages_audit_log_client = (
diff --git a/tempest/cmd/config-generator.tempest.conf b/tempest/cmd/config-generator.tempest.conf
index d718f93..b8f16d9 100644
--- a/tempest/cmd/config-generator.tempest.conf
+++ b/tempest/cmd/config-generator.tempest.conf
@@ -2,7 +2,4 @@
 output_file = etc/tempest.conf.sample
 namespace = tempest.config
 namespace = oslo.concurrency
-namespace = oslo.i18n
 namespace = oslo.log
-namespace = oslo.serialization
-namespace = oslo.utils
diff --git a/tempest/config.py b/tempest/config.py
index 5f9a04e..00c69b0 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -369,6 +369,11 @@
     cfg.BoolOpt('live_migration',
                 default=True,
                 help="Does the test environment support live migration?"),
+    cfg.BoolOpt('live_migrate_back_and_forth',
+                default=False,
+                help="Does the test environment support live migrating "
+                     "VM back and forth between different versions of "
+                     "nova-compute?"),
     cfg.BoolOpt('metadata_service',
                 default=True,
                 help="Does the test environment support metadata service? "
diff --git a/tempest/lib/services/compute/quota_classes_client.py b/tempest/lib/services/compute/quota_classes_client.py
index 523a306..0fe9868 100644
--- a/tempest/lib/services/compute/quota_classes_client.py
+++ b/tempest/lib/services/compute/quota_classes_client.py
@@ -35,9 +35,8 @@
     def update_quota_class_set(self, quota_class_id, **kwargs):
         """Update the quota class's limits for one or more resources.
 
-        For a full list of available parameters, please refer to the official
-        API reference:
-        http://developer.openstack.org/api-ref-compute-v2.1.html#updatequota
+        # NOTE: Current api-site doesn't contain this API description.
+        # LP: https://bugs.launchpad.net/nova/+bug/1602400
         """
         post_body = json.dumps({'quota_class_set': kwargs})
 
diff --git a/tempest/lib/services/compute/tenant_usages_client.py b/tempest/lib/services/compute/tenant_usages_client.py
index d0eb1c9..ade60e5 100644
--- a/tempest/lib/services/compute/tenant_usages_client.py
+++ b/tempest/lib/services/compute/tenant_usages_client.py
@@ -28,7 +28,7 @@
 
         For a full list of available parameters, please refer to the official
         API reference:
-        http://developer.openstack.org/api-ref/compute/#list-tenant-usage-for-all-tenants
+        https://developer.openstack.org/api-ref/compute/#list-tenant-usage-statistics-for-all-tenants
         """
         url = 'os-simple-tenant-usage'
         if params:
@@ -44,7 +44,7 @@
 
         For a full list of available parameters, please refer to the official
         API reference:
-        http://developer.openstack.org/api-ref/compute/#show-usage-details-for-tenant
+        https://developer.openstack.org/api-ref/compute/#show-usage-statistics-for-tenant
         """
         url = 'os-simple-tenant-usage/%s' % tenant_id
         if params:
diff --git a/tempest/lib/services/identity/v2/endpoints_client.py b/tempest/lib/services/identity/v2/endpoints_client.py
index 770e8ae..db8d7cc 100644
--- a/tempest/lib/services/identity/v2/endpoints_client.py
+++ b/tempest/lib/services/identity/v2/endpoints_client.py
@@ -25,7 +25,7 @@
 
         For a full list of available parameters, please refer to the official
         API reference:
-        http://developer.openstack.org/api-ref-identity-v2-ext.html#createEndpoint
+        https://developer.openstack.org/api-ref/identity/v2-admin/index.html#create-endpoint-template
         """
 
         post_body = json.dumps({'endpoint': kwargs})
diff --git a/tempest/lib/services/identity/v2/users_client.py b/tempest/lib/services/identity/v2/users_client.py
index cfd97bb..44bb5fd 100644
--- a/tempest/lib/services/identity/v2/users_client.py
+++ b/tempest/lib/services/identity/v2/users_client.py
@@ -88,7 +88,7 @@
 
         For a full list of available parameters, please refer to the official
         API reference:
-        http://developer.openstack.org/api-ref-identity-v2-ext.html#enableUser
+        https://developer.openstack.org/api-ref/identity/v2-ext/index.html#enable-disable-user
         """
         # NOTE: The URL (users/<id>/enabled) is different from the api-site
         # one (users/<id>/OS-KSADM/enabled) , but they are the same API
diff --git a/tempest/lib/services/identity/v3/oauth_consumers_client.py b/tempest/lib/services/identity/v3/oauth_consumers_client.py
index 582c9e0..97fb141 100644
--- a/tempest/lib/services/identity/v3/oauth_consumers_client.py
+++ b/tempest/lib/services/identity/v3/oauth_consumers_client.py
@@ -58,7 +58,7 @@
 
         For more information, please refer to the official
         API reference:
-        http://developer.openstack.org/api-ref/identity/v3-ext/#update-consumers
+        https://developer.openstack.org/api-ref/identity/v3-ext/#update-consumer
         """
         post_body = {"description": description}
         post_body = json.dumps({'consumer': post_body})
diff --git a/tempest/lib/services/image/v2/namespace_tags_client.py b/tempest/lib/services/image/v2/namespace_tags_client.py
index a7f8c39..61cc33d 100644
--- a/tempest/lib/services/image/v2/namespace_tags_client.py
+++ b/tempest/lib/services/image/v2/namespace_tags_client.py
@@ -41,7 +41,7 @@
 
         For a full list of available parameters, please refer to the official
         API reference:
-        http://developer.openstack.org/api-ref/image/v2/metadefs-index.html#get_tag_definition
+        https://developer.openstack.org/api-ref/image/v2/metadefs-index.html#get-tag-definition
         """
         url = 'metadefs/namespaces/%s/tags/%s' % (namespace,
                                                   tag_name)
diff --git a/tempest/lib/services/volume/v2/capabilities_client.py b/tempest/lib/services/volume/v2/capabilities_client.py
index 40cb8bf..240be13 100644
--- a/tempest/lib/services/volume/v2/capabilities_client.py
+++ b/tempest/lib/services/volume/v2/capabilities_client.py
@@ -24,9 +24,9 @@
     def show_backend_capabilities(self, host):
         """Shows capabilities for a storage back end.
 
-         Output params: see http://developer.openstack.org/
-                            api-ref-blockstorage-v2.html
-                            #showBackendCapabilities
+        For a full list of available parameters, please refer to the official
+        API reference:
+        https://developer.openstack.org/api-ref/block-storage/v2/index.html#show-back-end-capabilities
         """
         url = 'capabilities/%s' % host
         resp, body = self.get(url)
diff --git a/tempest/lib/services/volume/v2/scheduler_stats_client.py b/tempest/lib/services/volume/v2/scheduler_stats_client.py
index 3f56f82..0d04f85 100644
--- a/tempest/lib/services/volume/v2/scheduler_stats_client.py
+++ b/tempest/lib/services/volume/v2/scheduler_stats_client.py
@@ -24,8 +24,9 @@
     def list_pools(self, detail=False):
         """List all the volumes pools (hosts).
 
-        Output params: see http://developer.openstack.org/
-                           api-ref-blockstorage-v2.html#listPools
+        For a full list of available parameters, please refer to the official
+        API reference:
+        https://developer.openstack.org/api-ref/block-storage/v2/index.html#list-back-end-storage-pools
         """
         url = 'scheduler-stats/get_pools'
         if detail:
diff --git a/tempest/lib/services/volume/v2/transfers_client.py b/tempest/lib/services/volume/v2/transfers_client.py
index 6f21944..853948e 100644
--- a/tempest/lib/services/volume/v2/transfers_client.py
+++ b/tempest/lib/services/volume/v2/transfers_client.py
@@ -28,7 +28,7 @@
 
         For a full list of available parameters, please refer to the official
         API reference:
-        http://developer.openstack.org/api-ref/block-storage/v2/#create-volume-transfer-v2
+        https://developer.openstack.org/api-ref/block-storage/v2/#create-volume-transfer
         """
         post_body = json.dumps({'transfer': kwargs})
         resp, body = self.post('os-volume-transfer', post_body)
@@ -49,7 +49,7 @@
 
         For a full list of available parameters, please refer to the official
         API reference:
-        http://developer.openstack.org/api-ref/block-storage/v2/#list-volume-transfers-v2
+        https://developer.openstack.org/api-ref/block-storage/v2/#list-volume-transfers
         """
         url = 'os-volume-transfer'
         if params:
@@ -70,7 +70,7 @@
 
         For a full list of available parameters, please refer to the official
         API reference:
-        http://developer.openstack.org/api-ref/block-storage/v2/#accept-volume-transfer-v2
+        https://developer.openstack.org/api-ref/block-storage/v2/#accept-volume-transfer
         """
         url = 'os-volume-transfer/%s/accept' % transfer_id
         post_body = json.dumps({'accept': kwargs})
diff --git a/tempest/lib/services/volume/v2/volumes_client.py b/tempest/lib/services/volume/v2/volumes_client.py
index 44d4d65..c67ddfb 100644
--- a/tempest/lib/services/volume/v2/volumes_client.py
+++ b/tempest/lib/services/volume/v2/volumes_client.py
@@ -118,9 +118,12 @@
         self.expected_success(200, resp.status)
         return rest_client.ResponseBody(resp, body)
 
-    def delete_volume(self, volume_id):
+    def delete_volume(self, volume_id, cascade=False):
         """Deletes the Specified Volume."""
-        resp, body = self.delete("volumes/%s" % volume_id)
+        url = 'volumes/%s' % volume_id
+        if cascade:
+            url += '?cascade=True'
+        resp, body = self.delete(url)
         self.expected_success(202, resp.status)
         return rest_client.ResponseBody(resp, body)
 
diff --git a/tools/generate-tempest-plugins-list.sh b/tools/generate-tempest-plugins-list.sh
index ecff508..e6aad86 100755
--- a/tools/generate-tempest-plugins-list.sh
+++ b/tools/generate-tempest-plugins-list.sh
@@ -1,4 +1,4 @@
-#!/bin/bash -ex
+#!/usr/bin/env bash
 
 # Copyright 2016 Hewlett Packard Enterprise Development Company, L.P.
 #
@@ -38,6 +38,8 @@
 # current working directory, it will be prepended or appended to
 # the generated reStructuredText plugins table respectively.
 
+set -ex
+
 (
 declare -A plugins
 
diff --git a/tools/with_venv.sh b/tools/with_venv.sh
index 165c883..408b5f1 100755
--- a/tools/with_venv.sh
+++ b/tools/with_venv.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 TOOLS_PATH=${TOOLS_PATH:-$(dirname $0)/../}
 VENV_PATH=${VENV_PATH:-${TOOLS_PATH}}
 VENV_DIR=${VENV_DIR:-/.venv}