Merge "Wrong hint key in volume create function"
This commit is contained in:
		
							
								
								
									
										1
									
								
								.mailmap
									
									
									
									
									
								
							
							
						
						
									
										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>
 | 
			
		||||
 
 | 
			
		||||
@@ -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')
 | 
			
		||||
 
 | 
			
		||||
@@ -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):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user