From: Abhijeet Malawade <Abhijeet.Malawade@nttdata.com>
Date: Tue, 26 May 2015 13:58:00 +0000 (-0700)
Subject: Remove unused context parameter
X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=a5f3ef577818302d701c97ac2e4d42c34bdda0b5;p=openstack-build%2Fcinder-build.git

Remove unused context parameter

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
---

diff --git a/cinder/api/contrib/volume_host_attribute.py b/cinder/api/contrib/volume_host_attribute.py
index 511366295..2367a530f 100644
--- a/cinder/api/contrib/volume_host_attribute.py
+++ b/cinder/api/contrib/volume_host_attribute.py
@@ -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):
diff --git a/cinder/api/contrib/volume_mig_status_attribute.py b/cinder/api/contrib/volume_mig_status_attribute.py
index 54038a1db..9e7b6c380 100644
--- a/cinder/api/contrib/volume_mig_status_attribute.py
+++ b/cinder/api/contrib/volume_mig_status_attribute.py
@@ -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):
diff --git a/cinder/api/contrib/volume_replication.py b/cinder/api/contrib/volume_replication.py
index f7be25021..13939bc9e 100644
--- a/cinder/api/contrib/volume_replication.py
+++ b/cinder/api/contrib/volume_replication.py
@@ -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')
diff --git a/cinder/api/contrib/volume_tenant_attribute.py b/cinder/api/contrib/volume_tenant_attribute.py
index ef7eb806a..bb51b6057 100644
--- a/cinder/api/contrib/volume_tenant_attribute.py
+++ b/cinder/api/contrib/volume_tenant_attribute.py
@@ -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):
diff --git a/cinder/api/v1/snapshots.py b/cinder/api/v1/snapshots.py
index 0667231ff..097f429c2 100644
--- a/cinder/api/v1/snapshots.py
+++ b/cinder/api/v1/snapshots.py
@@ -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):
diff --git a/cinder/api/v2/snapshots.py b/cinder/api/v2/snapshots.py
index b38d1effc..eccb1ac4e 100644
--- a/cinder/api/v2/snapshots.py
+++ b/cinder/api/v2/snapshots.py
@@ -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):
diff --git a/cinder/manager.py b/cinder/manager.py
index 021b40dcf..0749eb990 100644
--- a/cinder/manager.py
+++ b/cinder/manager.py
@@ -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)
diff --git a/cinder/volume/flows/manager/create_volume.py b/cinder/volume/flows/manager/create_volume.py
index 7b9c6d4f7..6f9346a5b 100644
--- a/cinder/volume/flows/manager/create_volume.py
+++ b/cinder/volume/flows/manager/create_volume.py
@@ -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,
diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py
index a231e2f63..18fb995f2 100644
--- a/cinder/volume/manager.py
+++ b/cinder/volume/manager.py
@@ -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,