Wrong hint key in volume create function

Hint key has to be 'OS-SCH-HNT:scheduler_hints' not 'scheduler_hints'
and scheduler_hints key has to be located in same level with volume.

Change-Id: Ic5888545d4b7ee6bb58a22840928ef1fc86fedfa
Closes-Bug: #1276088
This commit is contained in:
Stephen Ahn 2014-02-20 13:27:38 +09:00
parent 6fd8d8e12e
commit dfa3a93ba4
3 changed files with 23 additions and 1 deletions

View File

@ -13,3 +13,4 @@ Andy Smith <github@anarkystic.com> termie <github@anarkystic.com>
<matt.dietz@rackspace.com> <matthew.dietz@gmail.com>
Nikolay Sokolov <nsokolov@griddynamics.com> Nokolay Sokolov <nsokolov@griddynamics.com>
Nikolay Sokolov <nsokolov@griddynamics.com> Nokolay Sokolov <chemikadze@gmail.com>
<skanddh@gmail.com> <seungkyu.ahn@samsung.com>

View File

@ -36,6 +36,24 @@ class VolumesTest(utils.TestCase):
cs.volumes.create(1)
cs.assert_called('POST', '/volumes')
def test_create_volume_with_hint(self):
cs.volumes.create(1, scheduler_hints='uuid')
expected = {'volume': {'status': 'creating',
'description': None,
'availability_zone': None,
'source_volid': None,
'snapshot_id': None,
'size': 1,
'user_id': None,
'name': None,
'imageRef': None,
'attach_status': 'detached',
'volume_type': None,
'project_id': None,
'metadata': {}},
'OS-SCH-HNT:scheduler_hints': 'uuid'}
cs.assert_called('POST', '/volumes', body=expected)
def test_attach(self):
v = cs.volumes.get('1234')
cs.volumes.attach(v, 1, '/dev/vdc', mode='ro')

View File

@ -180,8 +180,11 @@ class VolumeManager(base.ManagerWithFind):
'metadata': volume_metadata,
'imageRef': imageRef,
'source_volid': source_volid,
'scheduler_hints': scheduler_hints,
}}
if scheduler_hints:
body['OS-SCH-HNT:scheduler_hints'] = scheduler_hints
return self._create('/volumes', body, 'volume')
def get(self, volume_id):