diff --git a/.mailmap b/.mailmap index f270bb6f5..f643222c8 100644 --- a/.mailmap +++ b/.mailmap @@ -13,3 +13,4 @@ Andy Smith termie Nikolay Sokolov Nokolay Sokolov Nikolay Sokolov Nokolay Sokolov + diff --git a/cinderclient/tests/v2/test_volumes.py b/cinderclient/tests/v2/test_volumes.py index 5e128123f..d2a0610c1 100644 --- a/cinderclient/tests/v2/test_volumes.py +++ b/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') diff --git a/cinderclient/v2/volumes.py b/cinderclient/v2/volumes.py index 524456d6e..d03385eba 100644 --- a/cinderclient/v2/volumes.py +++ b/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):