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
(cherry picked from commit 91bdf9de4c
)
This commit is contained in:
parent
d3f3791416
commit
72a1c5dfa2
@ -123,6 +123,10 @@ class SchedulerAPI(rpc.RPCAPI):
|
||||
if version == '2.0':
|
||||
# Send request_spec as dict
|
||||
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)
|
||||
return cctxt.cast(ctxt, 'create_volume', **msg_args)
|
||||
|
@ -116,7 +116,7 @@ class SchedulerRpcAPITestCase(test.TestCase):
|
||||
volume_id=self.volume_id,
|
||||
snapshot_id='snapshot_id',
|
||||
image_id='image_id',
|
||||
request_spec='fake_request_spec',
|
||||
request_spec={'volume_type': {}},
|
||||
filter_properties='filter_properties',
|
||||
volume=fake_volume.fake_volume_obj(
|
||||
self.context),
|
||||
|
Loading…
Reference in New Issue
Block a user