Fix creating typeless volumes with Mitaka's c-sch
In Mitaka as a workaround for creating volumes without volume type c-api was sending an empty dictionary as request_spec['volume_type'] in create_volume() RPC cast to scheduler. This changed in Newton and we're handling this situation directly in scheduler, but when running Newton's c-api with Mitaka's c-sch we should mimic older behavior. This patch implements that. Change-Id: I3dbb1934f3d8e68fef49f56155cbf59bc5fadc3a Closes-Bug: 1619008
This commit is contained in:
parent
ed20152b78
commit
91bdf9de4c
@ -112,6 +112,10 @@ class SchedulerAPI(rpc.RPCAPI):
|
|||||||
# Send request_spec as dict
|
# Send request_spec as dict
|
||||||
version = '2.0'
|
version = '2.0'
|
||||||
msg_args['request_spec'] = jsonutils.to_primitive(request_spec)
|
msg_args['request_spec'] = jsonutils.to_primitive(request_spec)
|
||||||
|
# NOTE(dulek): This is to keep supporting Mitaka's scheduler which
|
||||||
|
# expects a dictionary when creating a typeless volume.
|
||||||
|
if msg_args['request_spec'].get('volume_type') is None:
|
||||||
|
msg_args['request_spec']['volume_type'] = {}
|
||||||
|
|
||||||
cctxt = self.client.prepare(version=version)
|
cctxt = self.client.prepare(version=version)
|
||||||
return cctxt.cast(ctxt, 'create_volume', **msg_args)
|
return cctxt.cast(ctxt, 'create_volume', **msg_args)
|
||||||
|
@ -109,7 +109,7 @@ class SchedulerRpcAPITestCase(test.TestCase):
|
|||||||
volume_id='volume_id',
|
volume_id='volume_id',
|
||||||
snapshot_id='snapshot_id',
|
snapshot_id='snapshot_id',
|
||||||
image_id='image_id',
|
image_id='image_id',
|
||||||
request_spec='fake_request_spec',
|
request_spec={'volume_type': {}},
|
||||||
filter_properties='filter_properties',
|
filter_properties='filter_properties',
|
||||||
volume='volume',
|
volume='volume',
|
||||||
version='2.0')
|
version='2.0')
|
||||||
|
Loading…
Reference in New Issue
Block a user