Browse Source

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
changes/59/72059/5
Stephen Ahn 8 years ago
parent
commit
dfa3a93ba4
  1. 1
      .mailmap
  2. 18
      cinderclient/tests/v2/test_volumes.py
  3. 5
      cinderclient/v2/volumes.py

1
.mailmap

@ -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>

18
cinderclient/tests/v2/test_volumes.py

@ -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')

5
cinderclient/v2/volumes.py

@ -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):

Loading…
Cancel
Save