From 14a714f2a28d2f0ae232556c1f8ccd6d4a5b2043 Mon Sep 17 00:00:00 2001 From: TerryHowe Date: Fri, 28 Aug 2015 10:34:50 -0600 Subject: [PATCH] Volume v2 list does not show server name The volume v2 list was using the volume id rather than the server id. Change-Id: Ibe03d34b5b503af2d00202dabd640f796449cf9a Closes-Bug: #1489954 --- openstackclient/tests/volume/v2/fakes.py | 7 ++++--- openstackclient/tests/volume/v2/test_volume.py | 10 +++++----- openstackclient/volume/v2/volume.py | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/openstackclient/tests/volume/v2/fakes.py b/openstackclient/tests/volume/v2/fakes.py index 0d8c2024c7..7b7758a3a8 100644 --- a/openstackclient/tests/volume/v2/fakes.py +++ b/openstackclient/tests/volume/v2/fakes.py @@ -15,14 +15,15 @@ import copy import mock -from openstackclient.tests.compute.v2 import fakes as compute_fakes from openstackclient.tests import fakes from openstackclient.tests.identity.v2_0 import fakes as identity_fakes from openstackclient.tests.image.v2 import fakes as image_fakes from openstackclient.tests import utils -volume_attachment_server = copy.deepcopy(compute_fakes.SERVER) -volume_attachment_server['device'] = 'device' +volume_attachment_server = { + 'device': '/dev/ice', + 'server_id': '1233', +} volume_id = "ce26708d-a7f8-4b4b-9861-4a80256615a6" volume_name = "fake_volume" diff --git a/openstackclient/tests/volume/v2/test_volume.py b/openstackclient/tests/volume/v2/test_volume.py index 348ae377de..b15fd02fc1 100644 --- a/openstackclient/tests/volume/v2/test_volume.py +++ b/openstackclient/tests/volume/v2/test_volume.py @@ -548,7 +548,7 @@ class TestVolumeList(TestVolume): ] self.assertEqual(collist, columns) - server = volume_fakes.volume_attachment_server['id'] + server = volume_fakes.volume_attachment_server['server_id'] device = volume_fakes.volume_attachment_server['device'] msg = 'Attached to %s on %s ' % (server, device) datalist = (( @@ -583,7 +583,7 @@ class TestVolumeList(TestVolume): ] self.assertEqual(collist, columns) - server = volume_fakes.volume_attachment_server['id'] + server = volume_fakes.volume_attachment_server['server_id'] device = volume_fakes.volume_attachment_server['device'] msg = 'Attached to %s on %s ' % (server, device) datalist = (( @@ -618,7 +618,7 @@ class TestVolumeList(TestVolume): ) self.assertEqual(collist, tuple(columns)) - server = volume_fakes.volume_attachment_server['id'] + server = volume_fakes.volume_attachment_server['server_id'] device = volume_fakes.volume_attachment_server['device'] msg = 'Attached to %s on %s ' % (server, device) @@ -654,7 +654,7 @@ class TestVolumeList(TestVolume): ) self.assertEqual(collist, tuple(columns)) - server = volume_fakes.volume_attachment_server['id'] + server = volume_fakes.volume_attachment_server['server_id'] device = volume_fakes.volume_attachment_server['device'] msg = 'Attached to %s on %s ' % (server, device) datalist = (( @@ -693,7 +693,7 @@ class TestVolumeList(TestVolume): ] self.assertEqual(collist, columns) - server = volume_fakes.volume_attachment_server['id'] + server = volume_fakes.volume_attachment_server['server_id'] device = volume_fakes.volume_attachment_server['device'] msg = 'Attached to %s on %s ' % (server, device) datalist = (( diff --git a/openstackclient/volume/v2/volume.py b/openstackclient/volume/v2/volume.py index fe4a3ff63f..1d298f46d3 100644 --- a/openstackclient/volume/v2/volume.py +++ b/openstackclient/volume/v2/volume.py @@ -238,7 +238,7 @@ class ListVolume(lister.Lister): msg = '' for attachment in attachments: - server = attachment['id'] + server = attachment['server_id'] if server in server_cache: server = server_cache[server].name device = attachment['device']