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']
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):
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):
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']
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):
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):
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']
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):
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')
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']
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):
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):
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 = {}
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."""
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)
**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}
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):
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 = {}
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."""
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)
**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}
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):
"""
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)
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)
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)
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):
{'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,
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,