Make attach_volume use **kwargs
As we discussed on
http://lists.openstack.org/pipermail/openstack-dev/2015-July/068864.html
All http POST/PUT methods need to contain **kwargs as their arguments.
This patch makes attach_volume use **kwargs.
Partially implements blueprint consistent-service-method-names
Change-Id: Ibc7f5c80755876318e1f5c7f7548276f315467c6
diff --git a/tempest/api/compute/admin/test_live_migration.py b/tempest/api/compute/admin/test_live_migration.py
index 6ffa4e9..c6c0129 100644
--- a/tempest/api/compute/admin/test_live_migration.py
+++ b/tempest/api/compute/admin/test_live_migration.py
@@ -153,7 +153,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/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_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/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/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 da4ebbe..3ef0578 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -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_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..37df179 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)
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: