]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix mandatory and optional args for create_volume
authorAvishay Traeger <avishay@il.ibm.com>
Wed, 25 Sep 2013 05:41:21 +0000 (08:41 +0300)
committerAvishay Traeger <avishay@il.ibm.com>
Wed, 25 Sep 2013 08:20:22 +0000 (11:20 +0300)
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

cinder/scheduler/filter_scheduler.py
cinder/tests/test_volume.py
cinder/volume/flows/create_volume/__init__.py
cinder/volume/manager.py

index c47b41d4fa85b46eabd957b2c9c0a5e0ae5f804b..247e72f1a5b2cd37a59d45d2a05837304a10b2fa 100644 (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)
index 8ce5b73577a4ff10a1b62068d74569cf785b169b..7ebfe732921360d04f53dc53c40bb66931d7143f 100644 (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'})
 
index de2192c48b918507cbeea40dd68f7039ca36a936..0353f526197a6e9b87b40c56b17736c067db608a 100644 (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."""
index 34b4357ab999af27ee60691f191185117312c8d7..1c291f699f15eb42d8247bc46d48da6abf5e9224 100644 (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()