]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Remove unused context parameter
authorAbhijeet Malawade <Abhijeet.Malawade@nttdata.com>
Tue, 26 May 2015 13:58:00 +0000 (06:58 -0700)
committerAbhijeet Malawade <Abhijeet.Malawade@nttdata.com>
Mon, 27 Jul 2015 09:03:53 +0000 (02:03 -0700)
Context parameter is removed from cinder methods
which are not using it at all.

Removed 'notification' method from volume/manager.py as it is
not getting used anywhere.

Change-Id: I2ecfdabb876485ac0c0d1cacd6778408be061fc8
Closes-Bug: #1458844

cinder/api/contrib/volume_host_attribute.py
cinder/api/contrib/volume_mig_status_attribute.py
cinder/api/contrib/volume_replication.py
cinder/api/contrib/volume_tenant_attribute.py
cinder/api/v1/snapshots.py
cinder/api/v2/snapshots.py
cinder/manager.py
cinder/volume/flows/manager/create_volume.py
cinder/volume/manager.py

index 511366295344a81a14817d0d9f4401107a9c5ae4..2367a530f9208ce79404e9866ee988e40ac18ff8 100644 (file)
@@ -25,7 +25,7 @@ authorize = extensions.soft_extension_authorizer('volume',
 
 
 class VolumeHostAttributeController(wsgi.Controller):
-    def _add_volume_host_attribute(self, context, req, resp_volume):
+    def _add_volume_host_attribute(self, req, resp_volume):
         db_volume = req.get_db_volume(resp_volume['id'])
         key = "%s:host" % Volume_host_attribute.alias
         resp_volume[key] = db_volume['host']
@@ -36,7 +36,7 @@ class VolumeHostAttributeController(wsgi.Controller):
         if authorize(context):
             resp_obj.attach(xml=VolumeHostAttributeTemplate())
             volume = resp_obj.obj['volume']
-            self._add_volume_host_attribute(context, req, volume)
+            self._add_volume_host_attribute(req, volume)
 
     @wsgi.extends
     def detail(self, req, resp_obj):
@@ -44,7 +44,7 @@ class VolumeHostAttributeController(wsgi.Controller):
         if authorize(context):
             resp_obj.attach(xml=VolumeListHostAttributeTemplate())
             for vol in list(resp_obj.obj['volumes']):
-                self._add_volume_host_attribute(context, req, vol)
+                self._add_volume_host_attribute(req, vol)
 
 
 class Volume_host_attribute(extensions.ExtensionDescriptor):
index 54038a1db0ae9c4fca3684e1855d6e806875489b..9e7b6c380a4e11eef0644990f2d2030303fb0678 100644 (file)
@@ -22,7 +22,7 @@ authorize = extensions.soft_extension_authorizer('volume',
 
 
 class VolumeMigStatusAttributeController(wsgi.Controller):
-    def _add_volume_mig_status_attribute(self, req, context, resp_volume):
+    def _add_volume_mig_status_attribute(self, req, resp_volume):
         db_volume = req.get_db_volume(resp_volume['id'])
         key = "%s:migstat" % Volume_mig_status_attribute.alias
         resp_volume[key] = db_volume['migration_status']
@@ -34,8 +34,7 @@ class VolumeMigStatusAttributeController(wsgi.Controller):
         context = req.environ['cinder.context']
         if authorize(context):
             resp_obj.attach(xml=VolumeMigStatusAttributeTemplate())
-            self._add_volume_mig_status_attribute(req, context,
-                                                  resp_obj.obj['volume'])
+            self._add_volume_mig_status_attribute(req, resp_obj.obj['volume'])
 
     @wsgi.extends
     def detail(self, req, resp_obj):
@@ -43,7 +42,7 @@ class VolumeMigStatusAttributeController(wsgi.Controller):
         if authorize(context):
             resp_obj.attach(xml=VolumeListMigStatusAttributeTemplate())
             for vol in list(resp_obj.obj['volumes']):
-                self._add_volume_mig_status_attribute(req, context, vol)
+                self._add_volume_mig_status_attribute(req, vol)
 
 
 class Volume_mig_status_attribute(extensions.ExtensionDescriptor):
index f7be250215753c6adee11065b31cc24be6dfc3f5..13939bc9edd85d479faade4da55e04f8b3362c85 100644 (file)
@@ -39,7 +39,7 @@ class VolumeReplicationController(wsgi.Controller):
         self.volume_api = volume.API()
         self.replication_api = replicationAPI.API()
 
-    def _add_replication_attributes(self, req, context, resp_volume):
+    def _add_replication_attributes(self, req, resp_volume):
         db_volume = req.cached_resource_by_id(resp_volume['id'])
         key = "%s:extended_status" % Volume_replication.alias
         resp_volume[key] = db_volume['replication_extended_status']
@@ -51,8 +51,7 @@ class VolumeReplicationController(wsgi.Controller):
         context = req.environ['cinder.context']
         if authorize(context):
             resp_obj.attach(xml=VolumeReplicationAttributeTemplate())
-            self._add_replication_attributes(req, context,
-                                             resp_obj.obj['volume'])
+            self._add_replication_attributes(req, resp_obj.obj['volume'])
 
     @wsgi.extends
     def detail(self, req, resp_obj):
@@ -60,7 +59,7 @@ class VolumeReplicationController(wsgi.Controller):
         if authorize(context):
             resp_obj.attach(xml=VolumeReplicationListAttributeTemplate())
             for vol in list(resp_obj.obj['volumes']):
-                self._add_replication_attributes(req, context, vol)
+                self._add_replication_attributes(req, vol)
 
     @wsgi.response(202)
     @wsgi.action('os-promote-replica')
index ef7eb806a73b072e397a8a565d6727ea06755b78..bb51b6057fe7890d2090df90117300c54d34460d 100644 (file)
@@ -22,7 +22,7 @@ authorize = extensions.soft_extension_authorizer('volume',
 
 
 class VolumeTenantAttributeController(wsgi.Controller):
-    def _add_volume_tenant_attribute(self, context, req, resp_volume):
+    def _add_volume_tenant_attribute(self, req, resp_volume):
         db_volume = req.get_db_volume(resp_volume['id'])
         key = "%s:tenant_id" % Volume_tenant_attribute.alias
         resp_volume[key] = db_volume['project_id']
@@ -33,7 +33,7 @@ class VolumeTenantAttributeController(wsgi.Controller):
         if authorize(context):
             resp_obj.attach(xml=VolumeTenantAttributeTemplate())
             volume = resp_obj.obj['volume']
-            self._add_volume_tenant_attribute(context, req, volume)
+            self._add_volume_tenant_attribute(req, volume)
 
     @wsgi.extends
     def detail(self, req, resp_obj):
@@ -41,7 +41,7 @@ class VolumeTenantAttributeController(wsgi.Controller):
         if authorize(context):
             resp_obj.attach(xml=VolumeListTenantAttributeTemplate())
             for vol in list(resp_obj.obj['volumes']):
-                self._add_volume_tenant_attribute(context, req, vol)
+                self._add_volume_tenant_attribute(req, vol)
 
 
 class Volume_tenant_attribute(extensions.ExtensionDescriptor):
index 0667231fff49b5f91a5b064b7ed067becca11c9d..097f429c292c7e97dce4e14d122fa7dac88cf294 100644 (file)
@@ -32,16 +32,16 @@ from cinder import volume
 LOG = logging.getLogger(__name__)
 
 
-def _translate_snapshot_detail_view(context, snapshot):
+def _translate_snapshot_detail_view(snapshot):
     """Maps keys for snapshots details view."""
 
-    d = _translate_snapshot_summary_view(context, snapshot)
+    d = _translate_snapshot_summary_view(snapshot)
 
     # NOTE(gagupta): No additional data / lookups at the moment
     return d
 
 
-def _translate_snapshot_summary_view(context, snapshot):
+def _translate_snapshot_summary_view(snapshot):
     """Maps keys for snapshots summary view."""
     d = {}
 
@@ -107,7 +107,7 @@ class SnapshotsController(wsgi.Controller):
         except exception.NotFound:
             raise exc.HTTPNotFound()
 
-        return {'snapshot': _translate_snapshot_detail_view(context, snapshot)}
+        return {'snapshot': _translate_snapshot_detail_view(snapshot)}
 
     def delete(self, req, id):
         """Delete a snapshot."""
@@ -150,7 +150,7 @@ class SnapshotsController(wsgi.Controller):
                                                       search_opts=search_opts)
         limited_list = common.limited(snapshots.objects, req)
         req.cache_db_snapshots(limited_list)
-        res = [entity_maker(context, snapshot) for snapshot in limited_list]
+        res = [entity_maker(snapshot) for snapshot in limited_list]
         return {'snapshots': res}
 
     @wsgi.serializers(xml=SnapshotTemplate)
@@ -200,7 +200,7 @@ class SnapshotsController(wsgi.Controller):
                 **kwargs)
         req.cache_db_snapshot(new_snapshot)
 
-        retval = _translate_snapshot_detail_view(context, new_snapshot)
+        retval = _translate_snapshot_detail_view(new_snapshot)
 
         return {'snapshot': retval}
 
@@ -236,7 +236,7 @@ class SnapshotsController(wsgi.Controller):
         snapshot.update(update_dict)
         req.cache_db_snapshot(snapshot)
 
-        return {'snapshot': _translate_snapshot_detail_view(context, snapshot)}
+        return {'snapshot': _translate_snapshot_detail_view(snapshot)}
 
 
 def create_resource(ext_mgr):
index b38d1effcd73def5401b27b44e8ac1ed4f89c06f..eccb1ac4e1c6f135a076ccfeb81756a50f599bc7 100644 (file)
@@ -33,16 +33,16 @@ from cinder.volume import utils as volume_utils
 LOG = logging.getLogger(__name__)
 
 
-def _translate_snapshot_detail_view(context, snapshot):
+def _translate_snapshot_detail_view(snapshot):
     """Maps keys for snapshots details view."""
 
-    d = _translate_snapshot_summary_view(context, snapshot)
+    d = _translate_snapshot_summary_view(snapshot)
 
     # NOTE(gagupta): No additional data / lookups at the moment
     return d
 
 
-def _translate_snapshot_summary_view(context, snapshot):
+def _translate_snapshot_summary_view(snapshot):
     """Maps keys for snapshots summary view."""
     d = {}
 
@@ -108,7 +108,7 @@ class SnapshotsController(wsgi.Controller):
         except exception.SnapshotNotFound as error:
             raise exc.HTTPNotFound(explanation=error.msg)
 
-        return {'snapshot': _translate_snapshot_detail_view(context, snapshot)}
+        return {'snapshot': _translate_snapshot_detail_view(snapshot)}
 
     def delete(self, req, id):
         """Delete a snapshot."""
@@ -157,7 +157,7 @@ class SnapshotsController(wsgi.Controller):
                                                       search_opts=search_opts)
         limited_list = common.limited(snapshots.objects, req)
         req.cache_db_snapshots(limited_list)
-        res = [entity_maker(context, snapshot) for snapshot in limited_list]
+        res = [entity_maker(snapshot) for snapshot in limited_list]
         return {'snapshots': res}
 
     @wsgi.response(202)
@@ -213,7 +213,7 @@ class SnapshotsController(wsgi.Controller):
                 **kwargs)
         req.cache_db_snapshot(new_snapshot)
 
-        retval = _translate_snapshot_detail_view(context, new_snapshot)
+        retval = _translate_snapshot_detail_view(new_snapshot)
 
         return {'snapshot': retval}
 
@@ -269,7 +269,7 @@ class SnapshotsController(wsgi.Controller):
         volume_utils.notify_about_snapshot_usage(context, snapshot,
                                                  'update.end')
 
-        return {'snapshot': _translate_snapshot_detail_view(context, snapshot)}
+        return {'snapshot': _translate_snapshot_detail_view(snapshot)}
 
 
 def create_resource(ext_mgr):
index 021b40dcf8826f8281d3e1306e0e8c50393c29dc..0749eb990597d9408553942a29e14ddc1e8aa0cc 100644 (file)
@@ -108,10 +108,10 @@ class Manager(base.Base, PeriodicTasks):
         """
         pass
 
-    def service_version(self, context):
+    def service_version(self):
         return version.version_string()
 
-    def service_config(self, context):
+    def service_config(self):
         config = {}
         for key in CONF:
             config[key] = CONF.get(key, None)
index 7b9c6d4f7a99b0ac44b4cb46ee3f725fb942c5ec..6f9346a5b9882470d4e3d630b417a895c5383216 100644 (file)
@@ -144,7 +144,7 @@ class OnFailureRescheduleTask(flow_utils.CinderTask):
                              request_spec=request_spec,
                              filter_properties=filter_properties)
 
-    def _post_reschedule(self, context, volume_id):
+    def _post_reschedule(self, volume_id):
         """Actions that happen after the rescheduling attempt occur here."""
 
         LOG.debug("Volume %s: re-scheduled", volume_id)
@@ -177,7 +177,7 @@ class OnFailureRescheduleTask(flow_utils.CinderTask):
             try:
                 self._pre_reschedule(context, volume_id)
                 self._reschedule(context, cause, volume_id=volume_id, **kwargs)
-                self._post_reschedule(context, volume_id)
+                self._post_reschedule(volume_id)
                 return True
             except exception.CinderException:
                 LOG.exception(_LE("Volume %s: rescheduling failed"), volume_id)
@@ -614,7 +614,7 @@ class CreateVolumeFromSpecTask(flow_utils.CinderTask):
                                                  image_meta=image_meta)
         return model_update
 
-    def _create_raw_volume(self, context, volume_ref, **kwargs):
+    def _create_raw_volume(self, volume_ref, **kwargs):
         return self.driver.create_volume(volume_ref)
 
     def execute(self, context, volume_ref, volume_spec):
@@ -636,8 +636,7 @@ class CreateVolumeFromSpecTask(flow_utils.CinderTask):
                  {'volume_spec': volume_spec, 'volume_id': volume_id,
                   'create_type': create_type})
         if create_type == 'raw':
-            model_update = self._create_raw_volume(context,
-                                                   volume_ref=volume_ref,
+            model_update = self._create_raw_volume(volume_ref=volume_ref,
                                                    **volume_spec)
         elif create_type == 'snap':
             model_update = self._create_from_snapshot(context,
index a231e2f6304dee353244b83ed5fcf48d803d7dd0..18fb995f2052233d2ef01ac65b31f980dc521712 100644 (file)
@@ -1530,9 +1530,6 @@ class VolumeManager(manager.SchedulerDependentManager):
         self._report_driver_status(context)
         self._publish_service_capabilities(context)
 
-    def notification(self, context, event):
-        LOG.info(_LI("Notification {%s} received"), event)
-
     def _notify_about_volume_usage(self,
                                    context,
                                    volume,