Merge "Full response for Volume ExtensionsClient methods"
diff --git a/HACKING.rst b/HACKING.rst
index 45c35df..6ddb8ac 100644
--- a/HACKING.rst
+++ b/HACKING.rst
@@ -275,7 +275,7 @@
Test Documentation
------------------
For tests being added we need to require inline documentation in the form of
-docstings to explain what is being tested. In API tests for a new API a class
+docstrings to explain what is being tested. In API tests for a new API a class
level docstring should be added to an API reference doc. If one doesn't exist
a TODO comment should be put indicating that the reference needs to be added.
For individual API test cases a method level docstring should be used to
diff --git a/requirements.txt b/requirements.txt
index f00de0d..cc2a187 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,8 +1,8 @@
# 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,>=1.3
-cliff>=1.13.0 # Apache-2.0
+pbr<2.0,>=1.4
+cliff>=1.14.0 # Apache-2.0
anyjson>=0.3.3
httplib2>=0.7.5
jsonschema!=2.5.0,<3.0.0,>=2.0.0
@@ -13,11 +13,11 @@
testrepository>=0.0.18
pyOpenSSL>=0.14
oslo.concurrency>=2.3.0 # Apache-2.0
-oslo.config>=1.11.0 # Apache-2.0
+oslo.config>=2.1.0 # Apache-2.0
oslo.i18n>=1.5.0 # Apache-2.0
oslo.log>=1.8.0 # Apache-2.0
oslo.serialization>=1.4.0 # Apache-2.0
-oslo.utils>=1.9.0 # Apache-2.0
+oslo.utils>=2.0.0 # Apache-2.0
six>=1.9.0
iso8601>=0.1.9
fixtures>=1.3.1
diff --git a/tempest/api/compute/admin/test_live_migration.py b/tempest/api/compute/admin/test_live_migration.py
index e2f1025..79c2ac9 100644
--- a/tempest/api/compute/admin/test_live_migration.py
+++ b/tempest/api/compute/admin/test_live_migration.py
@@ -56,9 +56,10 @@
return self._get_server_details(server_id)[self._host_key]
def _migrate_server_to(self, server_id, dest_host):
+ bmflm = CONF.compute_feature_enabled.block_migration_for_live_migration
body = self.admin_servers_client.live_migrate_server(
- server_id, dest_host,
- CONF.compute_feature_enabled.block_migration_for_live_migration)
+ server_id, host=dest_host, block_migration=bmflm,
+ disk_over_commit=False)
return body
def _get_host_other_than(self, host):
@@ -163,7 +164,7 @@
self.addCleanup(self._volume_clean_up, server_id, volume['id'])
# Attach the volume to the server
- self.servers_client.attach_volume(server_id, volume['id'],
+ self.servers_client.attach_volume(server_id, volumeId=volume['id'],
device='/dev/xvdb')
self.volumes_client.wait_for_volume_status(volume['id'], 'in-use')
diff --git a/tempest/api/compute/images/test_image_metadata.py b/tempest/api/compute/images/test_image_metadata.py
index ab82d91..d16c020 100644
--- a/tempest/api/compute/images/test_image_metadata.py
+++ b/tempest/api/compute/images/test_image_metadata.py
@@ -48,7 +48,7 @@
body = cls.glance_client.create_image(name=name,
container_format='bare',
disk_format='raw',
- is_public=False)
+ is_public=False)['image']
cls.image_id = body['id']
cls.images.append(cls.image_id)
image_file = six.StringIO(('*' * 1024))
diff --git a/tempest/api/compute/images/test_list_image_filters.py b/tempest/api/compute/images/test_list_image_filters.py
index 2c0ce59..247a57b 100644
--- a/tempest/api/compute/images/test_list_image_filters.py
+++ b/tempest/api/compute/images/test_list_image_filters.py
@@ -54,7 +54,7 @@
body = cls.glance_client.create_image(name=name,
container_format='bare',
disk_format='raw',
- is_public=False)
+ is_public=False)['image']
image_id = body['id']
cls.images.append(image_id)
# Wait 1 second between creation and upload to ensure a delta
diff --git a/tempest/api/compute/servers/test_delete_server.py b/tempest/api/compute/servers/test_delete_server.py
index b2acd34..673a401 100644
--- a/tempest/api/compute/servers/test_delete_server.py
+++ b/tempest/api/compute/servers/test_delete_server.py
@@ -122,7 +122,7 @@
waiters.wait_for_volume_status(volumes_client,
volume['id'], 'available')
self.client.attach_volume(server['id'],
- volume['id'],
+ volumeId=volume['id'],
device=device)
waiters.wait_for_volume_status(volumes_client,
volume['id'], 'in-use')
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 234f7e1..a20f7f5 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -323,7 +323,7 @@
properties=properties,
status='active',
sort_key='created_at',
- sort_dir='asc')
+ sort_dir='asc')['images']
self.assertEqual(2, len(image_list))
self.assertEqual((backup1, backup2),
(image_list[0]['name'], image_list[1]['name']))
@@ -347,7 +347,7 @@
properties=properties,
status='active',
sort_key='created_at',
- sort_dir='asc')
+ sort_dir='asc')['images']
self.assertEqual(2, len(image_list),
'Unexpected number of images for '
'v2:test_create_backup; was the oldest backup not '
diff --git a/tempest/api/compute/servers/test_server_rescue_negative.py b/tempest/api/compute/servers/test_server_rescue_negative.py
index 2fe63ed..7a25526 100644
--- a/tempest/api/compute/servers/test_server_rescue_negative.py
+++ b/tempest/api/compute/servers/test_server_rescue_negative.py
@@ -137,7 +137,7 @@
self.assertRaises(lib_exc.Conflict,
self.servers_client.attach_volume,
self.server_id,
- volume['id'],
+ volumeId=volume['id'],
device='/dev/%s' % self.device)
@test.idempotent_id('f56e465b-fe10-48bf-b75d-646cda3a8bc9')
@@ -148,7 +148,7 @@
# Attach the volume to the server
self.servers_client.attach_volume(self.server_id,
- volume['id'],
+ volumeId=volume['id'],
device='/dev/%s' % self.device)
waiters.wait_for_volume_status(self.volumes_extensions_client,
volume['id'], 'in-use')
diff --git a/tempest/api/compute/test_authorization.py b/tempest/api/compute/test_authorization.py
index e7111b0..b542d7f 100644
--- a/tempest/api/compute/test_authorization.py
+++ b/tempest/api/compute/test_authorization.py
@@ -70,10 +70,11 @@
body = cls.glance_client.create_image(name=name,
container_format='bare',
disk_format='raw',
- is_public=False)
+ is_public=False)['image']
image_id = body['id']
image_file = six.StringIO(('*' * 1024))
- body = cls.glance_client.update_image(image_id, data=image_file)
+ body = cls.glance_client.update_image(image_id,
+ data=image_file)['image']
cls.glance_client.wait_for_image_status(image_id, 'active')
cls.image = cls.images_client.show_image(image_id)
diff --git a/tempest/api/compute/test_live_block_migration_negative.py b/tempest/api/compute/test_live_block_migration_negative.py
index fabe55d..2cd85f2 100644
--- a/tempest/api/compute/test_live_block_migration_negative.py
+++ b/tempest/api/compute/test_live_block_migration_negative.py
@@ -40,10 +40,10 @@
cls.admin_servers_client = cls.os_adm.servers_client
def _migrate_server_to(self, server_id, dest_host):
+ bmflm = CONF.compute_feature_enabled.block_migration_for_live_migration
body = self.admin_servers_client.live_migrate_server(
- server_id, dest_host,
- CONF.compute_feature_enabled.
- block_migration_for_live_migration)
+ server_id, host=dest_host, block_migration=bmflm,
+ disk_over_commit=False)
return body
@test.attr(type=['negative'])
diff --git a/tempest/api/compute/volumes/test_attach_volume.py b/tempest/api/compute/volumes/test_attach_volume.py
index 8e4278a..6496854 100644
--- a/tempest/api/compute/volumes/test_attach_volume.py
+++ b/tempest/api/compute/volumes/test_attach_volume.py
@@ -83,7 +83,7 @@
# Attach the volume to the server
self.attachment = self.servers_client.attach_volume(
self.server['id'],
- self.volume['id'],
+ volumeId=self.volume['id'],
device='/dev/%s' % self.device)
self.volumes_client.wait_for_volume_status(self.volume['id'], 'in-use')
diff --git a/tempest/api/image/base.py b/tempest/api/image/base.py
index 87013db..4572310 100644
--- a/tempest/api/image/base.py
+++ b/tempest/api/image/base.py
@@ -90,6 +90,26 @@
super(BaseV1ImageTest, cls).setup_clients()
cls.client = cls.os.image_client
+ # TODO(jswarren) Remove this method once the v2 client also returns the
+ # full response object, not just the ['image'] value. At that
+ # point BaseImageTest.create_image will need to retrieve the
+ # ['image'] value.
+ @classmethod
+ def create_image(cls, **kwargs):
+ """Wrapper that returns a test image."""
+ name = data_utils.rand_name(cls.__name__ + "-instance")
+
+ if 'name' in kwargs:
+ name = kwargs.pop('name')
+
+ container_format = kwargs.pop('container_format')
+ disk_format = kwargs.pop('disk_format')
+
+ image = cls.client.create_image(name, container_format,
+ disk_format, **kwargs)['image']
+ cls.created_images.append(image['id'])
+ return image
+
class BaseV1ImageMembersTest(BaseV1ImageTest):
diff --git a/tempest/api/image/v1/test_images.py b/tempest/api/image/v1/test_images.py
index 8beed32..7739d16 100644
--- a/tempest/api/image/v1/test_images.py
+++ b/tempest/api/image/v1/test_images.py
@@ -45,7 +45,7 @@
# Now try uploading an image file
image_file = moves.cStringIO(data_utils.random_bytes())
- body = self.client.update_image(image_id, data=image_file)
+ body = self.client.update_image(image_id, data=image_file)['image']
self.assertIn('size', body)
self.assertEqual(1024, body.get('size'))
@@ -168,14 +168,14 @@
@test.idempotent_id('246178ab-3b33-4212-9a4b-a7fe8261794d')
def test_index_no_params(self):
# Simple test to see all fixture images returned
- images_list = self.client.list_images()
+ images_list = self.client.list_images()['images']
image_list = map(lambda x: x['id'], images_list)
for image_id in self.created_images:
self.assertIn(image_id, image_list)
@test.idempotent_id('f1755589-63d6-4468-b098-589820eb4031')
def test_index_disk_format(self):
- images_list = self.client.list_images(disk_format='ami')
+ images_list = self.client.list_images(disk_format='ami')['images']
for image in images_list:
self.assertEqual(image['disk_format'], 'ami')
result_set = set(map(lambda x: x['id'], images_list))
@@ -184,7 +184,8 @@
@test.idempotent_id('2143655d-96d9-4bec-9188-8674206b4b3b')
def test_index_container_format(self):
- images_list = self.client.list_images(container_format='bare')
+ images_list = (self.client.list_images(container_format='bare')
+ ['images'])
for image in images_list:
self.assertEqual(image['container_format'], 'bare')
result_set = set(map(lambda x: x['id'], images_list))
@@ -193,7 +194,7 @@
@test.idempotent_id('feb32ac6-22bb-4a16-afd8-9454bb714b14')
def test_index_max_size(self):
- images_list = self.client.list_images(size_max=42)
+ images_list = self.client.list_images(size_max=42)['images']
for image in images_list:
self.assertTrue(image['size'] <= 42)
result_set = set(map(lambda x: x['id'], images_list))
@@ -202,7 +203,7 @@
@test.idempotent_id('6ffc16d0-4cbf-4401-95c8-4ac63eac34d8')
def test_index_min_size(self):
- images_list = self.client.list_images(size_min=142)
+ images_list = self.client.list_images(size_min=142)['images']
for image in images_list:
self.assertTrue(image['size'] >= 142)
result_set = set(map(lambda x: x['id'], images_list))
@@ -214,7 +215,7 @@
images_list = self.client.list_images(detail=True,
status='active',
sort_key='size',
- sort_dir='desc')
+ sort_dir='desc')['images']
top_size = images_list[0]['size'] # We have non-zero sized images
for image in images_list:
size = image['size']
@@ -226,7 +227,7 @@
def test_index_name(self):
images_list = self.client.list_images(
detail=True,
- name='New Remote Image dup')
+ name='New Remote Image dup')['images']
result_set = set(map(lambda x: x['id'], images_list))
for image in images_list:
self.assertEqual(image['name'], 'New Remote Image dup')
@@ -272,7 +273,7 @@
self.assertEqual(metadata['properties'], {'key1': 'value1'})
metadata['properties'].update(req_metadata)
metadata = self.client.update_image(
- self.image_id, properties=metadata['properties'])
+ self.image_id, properties=metadata['properties'])['image']
resp_metadata = self.client.get_image_meta(self.image_id)
expected = {'key1': 'alt1', 'key2': 'value2'}
diff --git a/tempest/api/telemetry/base.py b/tempest/api/telemetry/base.py
index 0f9b7dd..5d1784f 100644
--- a/tempest/api/telemetry/base.py
+++ b/tempest/api/telemetry/base.py
@@ -85,6 +85,11 @@
body = client.create_image(
data_utils.rand_name('image'), container_format='bare',
disk_format='raw', visibility='private')
+ # TODO(jswarren) Move ['image'] up to initial body value assignment
+ # once both v1 and v2 glance clients include the full response
+ # object.
+ if 'image' in body:
+ body = body['image']
cls.image_ids.append(body['id'])
return body
diff --git a/tempest/api/volume/test_volumes_snapshots.py b/tempest/api/volume/test_volumes_snapshots.py
index 1df1896..5860501 100644
--- a/tempest/api/volume/test_volumes_snapshots.py
+++ b/tempest/api/volume/test_volumes_snapshots.py
@@ -75,7 +75,8 @@
'ACTIVE')
mountpoint = '/dev/%s' % CONF.compute.volume_device_name
self.servers_client.attach_volume(
- server['id'], self.volume_origin['id'], mountpoint)
+ server['id'], volumeId=self.volume_origin['id'],
+ device=mountpoint)
self.volumes_client.wait_for_volume_status(self.volume_origin['id'],
'in-use')
self.addCleanup(self.volumes_client.wait_for_volume_status,
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 89b0842..e9530a2 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -342,7 +342,7 @@
'is_public': 'False',
}
params['properties'] = properties
- image = self.image_client.create_image(**params)
+ image = self.image_client.create_image(**params)['image']
self.addCleanup(self.image_client.delete_image, image['id'])
self.assertEqual("queued", image['status'])
self.image_client.update_image(image['id'], data=image_file)
@@ -419,7 +419,7 @@
def nova_volume_attach(self):
volume = self.servers_client.attach_volume(
- self.server['id'], self.volume['id'], '/dev/%s'
+ self.server['id'], volumeId=self.volume['id'], device='/dev/%s'
% CONF.compute.volume_device_name)
self.assertEqual(self.volume['id'], volume['id'])
self.volumes_client.wait_for_volume_status(volume['id'], 'in-use')
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index e676063..12af667 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -338,8 +338,8 @@
for remote_ip in address_list:
if should_connect:
- msg = "Timed out waiting for "
- "%s to become reachable" % remote_ip
+ msg = ("Timed out waiting for %s to become "
+ "reachable") % remote_ip
else:
msg = "ip address %s is reachable" % remote_ip
try:
diff --git a/tempest/scenario/test_stamp_pattern.py b/tempest/scenario/test_stamp_pattern.py
index c1d9a1b..8b5a595 100644
--- a/tempest/scenario/test_stamp_pattern.py
+++ b/tempest/scenario/test_stamp_pattern.py
@@ -104,7 +104,7 @@
def _attach_volume(self, server, volume):
attached_volume = self.servers_client.attach_volume(
- server['id'], volume['id'], device='/dev/%s'
+ server['id'], volumeId=volume['id'], device='/dev/%s'
% CONF.compute.volume_device_name)
self.assertEqual(volume['id'], attached_volume['id'])
self._wait_for_volume_status(attached_volume, 'in-use')
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index 1159a58..a99a1f5 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -341,14 +341,9 @@
def start(self, server_id, **kwargs):
return self.action(server_id, 'os-start', None, **kwargs)
- def attach_volume(self, server_id, volume_id, device='/dev/vdz'):
+ def attach_volume(self, server_id, **kwargs):
"""Attaches a volume to a server instance."""
- post_body = json.dumps({
- 'volumeAttachment': {
- 'volumeId': volume_id,
- 'device': device,
- }
- })
+ post_body = json.dumps({'volumeAttachment': kwargs})
resp, body = self.post('servers/%s/os-volume_attachments' % server_id,
post_body)
body = json.loads(body)
@@ -386,16 +381,10 @@
"""Removes a security group from the server."""
return self.action(server_id, 'removeSecurityGroup', None, name=name)
- def live_migrate_server(self, server_id, dest_host, use_block_migration):
+ def live_migrate_server(self, server_id, **kwargs):
"""This should be called with administrator privileges ."""
- migrate_params = {
- "disk_over_commit": False,
- "block_migration": use_block_migration,
- "host": dest_host
- }
-
- req_body = json.dumps({'os-migrateLive': migrate_params})
+ req_body = json.dumps({'os-migrateLive': kwargs})
resp, body = self.post("servers/%s/action" % server_id, req_body)
self.validate_response(schema.server_actions_common_schema,
diff --git a/tempest/services/image/v1/json/image_client.py b/tempest/services/image/v1/json/image_client.py
index a07612a..d97da36 100644
--- a/tempest/services/image/v1/json/image_client.py
+++ b/tempest/services/image/v1/json/image_client.py
@@ -130,7 +130,7 @@
self._error_checker('POST', '/v1/images', headers, data, resp,
body_iter)
body = json.loads(''.join([c for c in body_iter]))
- return service_client.ResponseBody(resp, body['image'])
+ return service_client.ResponseBody(resp, body)
def _update_with_data(self, image_id, headers, data):
url = '/v1/images/%s' % image_id
@@ -139,7 +139,7 @@
self._error_checker('PUT', url, headers, data,
resp, body_iter)
body = json.loads(''.join([c for c in body_iter]))
- return service_client.ResponseBody(resp, body['image'])
+ return service_client.ResponseBody(resp, body)
@property
def http(self):
@@ -169,7 +169,7 @@
resp, body = self.post('v1/images', None, headers)
self.expected_success(201, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['image'])
+ return service_client.ResponseBody(resp, body)
def update_image(self, image_id, name=None, container_format=None,
data=None, properties=None):
@@ -193,7 +193,7 @@
resp, body = self.put(url, data, headers)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['image'])
+ return service_client.ResponseBody(resp, body)
def delete_image(self, image_id):
url = 'v1/images/%s' % image_id
@@ -223,7 +223,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['images'])
+ return service_client.ResponseBody(resp, body)
def get_image_meta(self, image_id):
url = 'v1/images/%s' % image_id
diff --git a/tempest/stress/actions/volume_attach_delete.py b/tempest/stress/actions/volume_attach_delete.py
index d6965c7..99e9eb6 100644
--- a/tempest/stress/actions/volume_attach_delete.py
+++ b/tempest/stress/actions/volume_attach_delete.py
@@ -49,8 +49,8 @@
self.logger.info("attach volume (%s) to vm %s" %
(volume['id'], server_id))
self.manager.servers_client.attach_volume(server_id,
- volume['id'],
- '/dev/vdc')
+ volumeId=volume['id'],
+ device='/dev/vdc')
self.manager.volumes_client.wait_for_volume_status(volume['id'],
'in-use')
self.logger.info("volume (%s) attached to vm %s" %
diff --git a/tempest/stress/actions/volume_attach_verify.py b/tempest/stress/actions/volume_attach_verify.py
index c89985c..e30ca0c 100644
--- a/tempest/stress/actions/volume_attach_verify.py
+++ b/tempest/stress/actions/volume_attach_verify.py
@@ -191,8 +191,8 @@
self.logger.info("attach volume (%s) to vm %s" %
(self.volume['id'], self.server_id))
servers_client.attach_volume(self.server_id,
- self.volume['id'],
- self.part_name)
+ volumeId=self.volume['id'],
+ device=self.part_name)
self.manager.volumes_client.wait_for_volume_status(self.volume['id'],
'in-use')
if self.enable_ssh_verify: