Merge "Add related_bug for bug/1660878"
diff --git a/tempest/api/volume/v2/test_volumes_snapshots_list.py b/tempest/api/volume/v2/test_volumes_snapshots_list.py
index 8f68322..f389b59 100644
--- a/tempest/api/volume/v2/test_volumes_snapshots_list.py
+++ b/tempest/api/volume/v2/test_volumes_snapshots_list.py
@@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import operator
-
from tempest.api.volume import base
from tempest import config
from tempest import test
@@ -89,7 +87,7 @@
# The list of snapshots should end before the provided marker
params = {'marker': self.snapshot_id_list[1]}
snap_list = self.snapshots_client.list_snapshots(**params)['snapshots']
- fetched_list_id = map(operator.itemgetter('id'), snap_list)
+ fetched_list_id = [snap['id'] for snap in snap_list]
# Verify the list of snapshots ends before the provided
# marker(second snapshot), therefore only the first snapshot
# should displayed.
diff --git a/tempest/clients.py b/tempest/clients.py
index 18116f3..cdd6925 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -31,14 +31,6 @@
default_params = config.service_client_config()
- # TODO(jordanP): remove this once no Tempest plugin use that class
- # variable.
- default_params_with_timeout_values = {
- 'build_interval': CONF.compute.build_interval,
- 'build_timeout': CONF.compute.build_timeout
- }
- default_params_with_timeout_values.update(default_params)
-
def __init__(self, credentials, scope='project'):
"""Initialization of Manager class.
diff --git a/tempest/common/compute.py b/tempest/common/compute.py
index 4f2fe67..01de704 100644
--- a/tempest/common/compute.py
+++ b/tempest/common/compute.py
@@ -30,8 +30,7 @@
def create_test_server(clients, validatable=False, validation_resources=None,
tenant_network=None, wait_until=None,
volume_backed=False, name=None, flavor=None,
- image_id=None, delete_vol_on_termination=True,
- **kwargs):
+ image_id=None, **kwargs):
"""Common wrapper utility returning a test server.
This method is a common wrapper returning a test server that can be
@@ -44,16 +43,30 @@
:param tenant_network: Tenant network to be used for creating a server.
:param wait_until: Server status to wait for the server to reach after
its creation.
- :param volume_backed: Whether the instance is volume backed or not.
+ :param volume_backed: Whether the server is volume backed or not.
+ If this is true, a volume will be created and
+ create server will be requested with
+ 'block_device_mapping_v2' populated with below
+ values:
+ --------------------------------------------
+ bd_map_v2 = [{
+ 'uuid': volume['volume']['id'],
+ 'source_type': 'volume',
+ 'destination_type': 'volume',
+ 'boot_index': 0,
+ 'delete_on_termination': True}]
+ kwargs['block_device_mapping_v2'] = bd_map_v2
+ ---------------------------------------------
+ If server needs to be booted from volume with other
+ combination of bdm inputs than mentioned above, then
+ pass the bdm inputs explicitly as kwargs and image_id
+ as empty string ('').
:param name: Name of the server to be provisioned. If not defined a random
string ending with '-instance' will be generated.
:param flavor: Flavor of the server to be provisioned. If not defined,
CONF.compute.flavor_ref will be used instead.
:param image_id: ID of the image to be used to provision the server. If not
defined, CONF.compute.image_ref will be used instead.
- :param delete_vol_on_termination: Controls whether the backing volume
- should be deleted when the server is deleted. Only applies to volume
- backed servers.
:returns: a tuple
"""
@@ -103,12 +116,14 @@
if volume_backed:
volume_name = data_utils.rand_name(__name__ + '-volume')
volumes_client = clients.volumes_v2_client
- if CONF.volume_feature_enabled.api_v1:
+ name_field = 'name'
+ if not CONF.volume_feature_enabled.api_v2:
volumes_client = clients.volumes_client
- volume = volumes_client.create_volume(
- display_name=volume_name,
- imageRef=image_id,
- size=CONF.volume.volume_size)
+ name_field = 'display_name'
+ params = {name_field: volume_name,
+ 'imageRef': image_id,
+ 'size': CONF.volume.volume_size}
+ volume = volumes_client.create_volume(**params)
waiters.wait_for_volume_status(volumes_client,
volume['volume']['id'], 'available')
@@ -117,7 +132,7 @@
'source_type': 'volume',
'destination_type': 'volume',
'boot_index': 0,
- 'delete_on_termination': delete_vol_on_termination}]
+ 'delete_on_termination': True}]
kwargs['block_device_mapping_v2'] = bd_map_v2
# Since this is boot from volume an image does not need