]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Transfer creation doesn't support 'name' via xml
authorwingwj <wingwj@gmail.com>
Sat, 14 Dec 2013 12:00:08 +0000 (20:00 +0800)
committerAvishay Traeger <avishay@il.ibm.com>
Mon, 13 Jan 2014 13:32:37 +0000 (15:32 +0200)
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
cinder/tests/api/contrib/test_volume_transfer.py

index b3e46cd09a2d87c890f9df396e23b6c8fb7816e2..e4b25cdcf4591063148c6418ccb8a25f0167fcfb 100644 (file)
@@ -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):
index 30d5f22acb73f80d5a7b57b31e42e59fb0e7d825..21d53f47923411bc6b17815dd965787d59fcd682 100644 (file)
@@ -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 = ('<transfer display_name="transfer-001" '
+        req.body = ('<transfer name="transfer-001" '
                     'volume_id="%s"/>' % 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)