Fix mandatory and optional args for create_volume

Calls to create_volume (both volume_rpcapi and scheduler_rpcapi) pass
mandatory args as optional and reverse. This patch fixes the calls to be
according to the function definition.

Also, fix the call to create_volume in the migration code where
allow_reschedule defaults to True, but we don't pass request_spec so it
prints a warning and disables it.

Change-Id: I9509f88866e0ae182f90ebdfca1fcf415ca60d19
Closes-Bug: #1230069
This commit is contained in:
Avishay Traeger
2013-09-25 08:41:21 +03:00
parent c77868f44b
commit d534811cbc
4 changed files with 11 additions and 10 deletions

View File

@@ -80,8 +80,7 @@ class FilterScheduler(driver.Scheduler):
filter_properties.pop('context', None)
self.volume_rpcapi.create_volume(context, updated_volume, host,
request_spec=request_spec,
filter_properties=filter_properties,
request_spec, filter_properties,
allow_reschedule=True,
snapshot_id=snapshot_id,
image_id=image_id)

View File

@@ -1713,7 +1713,8 @@ class VolumeTestCase(BaseVolumeTestCase):
def fake_delete_volume_rpc(self, ctxt, vol_id):
raise Exception('should not be called')
def fake_create_volume(self, ctxt, volume, host, req_spec, filters):
def fake_create_volume(self, ctxt, volume, host, req_spec, filters,
allow_reschedule=True):
db.volume_update(ctxt, volume['id'],
{'status': 'available'})

View File

@@ -732,8 +732,8 @@ class VolumeCastTask(base.CinderTask):
context,
CONF.volume_topic,
volume_id,
snapshot_id,
image_id,
snapshot_id=snapshot_id,
image_id=image_id,
request_spec=request_spec,
filter_properties=filter_properties)
else:
@@ -746,8 +746,8 @@ class VolumeCastTask(base.CinderTask):
context,
volume_ref,
volume_ref['host'],
request_spec=request_spec,
filter_properties=filter_properties,
request_spec,
filter_properties,
allow_reschedule=False,
snapshot_id=snapshot_id,
image_id=image_id,
@@ -893,8 +893,9 @@ class OnFailureRescheduleTask(base.CinderTask):
retry_info['exc'] = traceback.format_exception(*cause.exc_info)
return create_volume(context, CONF.volume_topic, volume_id,
snapshot_id, image_id, request_spec,
filter_properties)
snapshot_id=snapshot_id, image_id=image_id,
request_spec=request_spec,
filter_properties=filter_properties)
def _post_reschedule(self, context, volume_id):
"""Actions that happen after the rescheduling attempt occur here."""

View File

@@ -652,7 +652,7 @@ class VolumeManager(manager.SchedulerDependentManager):
new_vol_values['attach_status'] = 'detached'
new_volume = self.db.volume_create(ctxt, new_vol_values)
rpcapi.create_volume(ctxt, new_volume, host['host'],
None, None)
None, None, allow_reschedule=False)
# Wait for new_volume to become ready
starttime = time.time()