diff --git a/cinder/scheduler/rpcapi.py b/cinder/scheduler/rpcapi.py index 2b128bdc9..602c11097 100644 --- a/cinder/scheduler/rpcapi.py +++ b/cinder/scheduler/rpcapi.py @@ -112,6 +112,10 @@ class SchedulerAPI(rpc.RPCAPI): # Send request_spec as dict version = '2.0' 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) diff --git a/cinder/tests/unit/scheduler/test_rpcapi.py b/cinder/tests/unit/scheduler/test_rpcapi.py index 040d70cf4..dc73da7d2 100644 --- a/cinder/tests/unit/scheduler/test_rpcapi.py +++ b/cinder/tests/unit/scheduler/test_rpcapi.py @@ -109,7 +109,7 @@ class SchedulerRpcAPITestCase(test.TestCase): volume_id='volume_id', snapshot_id='snapshot_id', image_id='image_id', - request_spec='fake_request_spec', + request_spec={'volume_type': {}}, filter_properties='filter_properties', volume='volume', version='2.0')