From ce889d99f61aecd0b4002d44866bbfff8ff6a2c3 Mon Sep 17 00:00:00 2001 From: wingwj Date: Sat, 14 Dec 2013 20:00:08 +0800 Subject: [PATCH] Transfer creation doesn't support 'name' via xml Change the transfer create XML deserializer to use 'name' rather than 'display_name'. This is in line with cinderclient and the json code. Change-Id: I97ba0c4411fe4a151261ed2f657465951bcb9d7b Closes-Bug: #1243613 --- cinder/api/contrib/volume_transfer.py | 2 +- cinder/tests/api/contrib/test_volume_transfer.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cinder/api/contrib/volume_transfer.py b/cinder/api/contrib/volume_transfer.py index b3e46cd09..e4b25cdcf 100644 --- a/cinder/api/contrib/volume_transfer.py +++ b/cinder/api/contrib/volume_transfer.py @@ -68,7 +68,7 @@ class CreateDeserializer(wsgi.MetadataXMLDeserializer): transfer = {} transfer_node = self.find_first_child_named(node, 'transfer') - attributes = ['volume_id', 'display_name'] + attributes = ['volume_id', 'name'] for attr in attributes: if transfer_node.getAttribute(attr): diff --git a/cinder/tests/api/contrib/test_volume_transfer.py b/cinder/tests/api/contrib/test_volume_transfer.py index 30d5f22ac..21d53f479 100644 --- a/cinder/tests/api/contrib/test_volume_transfer.py +++ b/cinder/tests/api/contrib/test_volume_transfer.py @@ -264,7 +264,7 @@ class VolumeTransferAPITestCase(test.TestCase): volume_id = self._create_volume(status='available', size=volume_size) req = webob.Request.blank('/v2/fake/os-volume-transfer') - req.body = ('' % volume_id) req.method = 'POST' req.headers['Content-Type'] = 'application/xml' @@ -277,7 +277,7 @@ class VolumeTransferAPITestCase(test.TestCase): self.assertTrue(transfer.item(0).hasAttribute('id')) self.assertTrue(transfer.item(0).hasAttribute('auth_key')) self.assertTrue(transfer.item(0).hasAttribute('created_at')) - self.assertTrue(transfer.item(0).hasAttribute('name')) + self.assertEqual(transfer.item(0).getAttribute('name'), 'transfer-001') self.assertTrue(transfer.item(0).hasAttribute('volume_id')) db.volume_destroy(context.get_admin_context(), volume_id) -- 2.45.2