summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/incubator/volumes/volume_attachments.py30
-rw-r--r--nova/api/openstack/incubator/volumes/volumes.py18
-rw-r--r--nova/api/openstack/incubator/volumes/volumes_ext.py4
3 files changed, 26 insertions, 26 deletions
diff --git a/nova/api/openstack/incubator/volumes/volume_attachments.py b/nova/api/openstack/incubator/volumes/volume_attachments.py
index 93786d1c7..1e260b34d 100644
--- a/nova/api/openstack/incubator/volumes/volume_attachments.py
+++ b/nova/api/openstack/incubator/volumes/volume_attachments.py
@@ -34,7 +34,7 @@ FLAGS = flags.FLAGS
def _translate_detail_view(context, volume):
- """Maps keys for details view"""
+ """Maps keys for details view."""
d = _translate_summary_view(context, volume)
@@ -44,12 +44,12 @@ def _translate_detail_view(context, volume):
def _translate_summary_view(context, vol):
- """Maps keys for summary view"""
+ """Maps keys for summary view."""
d = {}
volume_id = vol['id']
- #NOTE(justinsb): We use the volume id as the id of the attachment object
+ # NOTE(justinsb): We use the volume id as the id of the attachment object
d['id'] = volume_id
d['volumeId'] = volume_id
@@ -62,7 +62,7 @@ def _translate_summary_view(context, vol):
class Controller(wsgi.Controller):
- """The volume attachment API controller for the Openstack API
+ """The volume attachment API controller for the Openstack API.
A child resource of the server. Note that we use the volume id
as the ID of the attachment (though this is not guaranteed externally)"""
@@ -81,12 +81,12 @@ class Controller(wsgi.Controller):
super(Controller, self).__init__()
def index(self, req, server_id):
- """Returns the list of volume attachments for a given instance """
+ """Returns the list of volume attachments for a given instance."""
return self._items(req, server_id,
entity_maker=_translate_summary_view)
def show(self, req, server_id, id):
- """Return data about the given volume"""
+ """Return data about the given volume."""
context = req.environ['nova.context']
volume_id = id
@@ -103,7 +103,7 @@ class Controller(wsgi.Controller):
return {'volumeAttachment': _translate_detail_view(context, vol)}
def create(self, req, server_id):
- """Attach a volume to an instance """
+ """Attach a volume to an instance."""
context = req.environ['nova.context']
env = self._deserialize(req.body, req.get_content_type())
@@ -131,15 +131,15 @@ class Controller(wsgi.Controller):
attachment['id'] = volume_id
attachment['volumeId'] = volume_id
- #NOTE(justinsb): And now, we have a problem...
+ # NOTE(justinsb): And now, we have a problem...
# The attach is async, so there's a window in which we don't see
- # the attachment (until the attachment completes). We could also
- # get problems with concurrent requests. I think we need an
- # attachment state, and to write to the DB here, but that's a bigger
- # change.
+ # the attachment (until the attachment completes). We could also
+ # get problems with concurrent requests. I think we need an
+ # attachment state, and to write to the DB here, but that's a bigger
+ # change.
# For now, we'll probably have to rely on libraries being smart
- #TODO(justinsb): How do I return "accepted" here?
+ # TODO(justinsb): How do I return "accepted" here?
return {'volumeAttachment': attachment}
def update(self, _req, _server_id, _id):
@@ -147,7 +147,7 @@ class Controller(wsgi.Controller):
return faults.Fault(exc.HTTPBadRequest())
def delete(self, req, server_id, id):
- """Detach a volume from an instance """
+ """Detach a volume from an instance."""
context = req.environ['nova.context']
volume_id = id
@@ -168,7 +168,7 @@ class Controller(wsgi.Controller):
return exc.HTTPAccepted()
def _items(self, req, server_id, entity_maker):
- """Returns a list of attachments, transformed through entity_maker"""
+ """Returns a list of attachments, transformed through entity_maker."""
context = req.environ['nova.context']
try:
diff --git a/nova/api/openstack/incubator/volumes/volumes.py b/nova/api/openstack/incubator/volumes/volumes.py
index e122bb465..a7d5fbaa6 100644
--- a/nova/api/openstack/incubator/volumes/volumes.py
+++ b/nova/api/openstack/incubator/volumes/volumes.py
@@ -31,7 +31,7 @@ FLAGS = flags.FLAGS
def _translate_detail_view(context, vol):
- """Maps keys for details view"""
+ """Maps keys for details view."""
d = _translate_summary_view(context, vol)
@@ -41,7 +41,7 @@ def _translate_detail_view(context, vol):
def _translate_summary_view(_context, vol):
- """Maps keys for summary view"""
+ """Maps keys for summary view."""
d = {}
instance_id = None
@@ -79,7 +79,7 @@ def _translate_summary_view(_context, vol):
class Controller(wsgi.Controller):
- """The Volumes API controller for the OpenStack API"""
+ """The Volumes API controller for the OpenStack API."""
_serialization_metadata = {
'application/xml': {
@@ -99,7 +99,7 @@ class Controller(wsgi.Controller):
super(Controller, self).__init__()
def show(self, req, id):
- """Return data about the given volume"""
+ """Return data about the given volume."""
context = req.environ['nova.context']
try:
@@ -110,7 +110,7 @@ class Controller(wsgi.Controller):
return {'volume': _translate_detail_view(context, vol)}
def delete(self, req, id):
- """Delete a volume """
+ """Delete a volume."""
context = req.environ['nova.context']
LOG.audit(_("Delete volume with id: %s"), id, context=context)
@@ -122,15 +122,15 @@ class Controller(wsgi.Controller):
return exc.HTTPAccepted()
def index(self, req):
- """Returns a summary list of volumes"""
+ """Returns a summary list of volumes."""
return self._items(req, entity_maker=_translate_summary_view)
def detail(self, req):
- """Returns a detailed list of volumes """
+ """Returns a detailed list of volumes."""
return self._items(req, entity_maker=_translate_detail_view)
def _items(self, req, entity_maker):
- """Returns a list of volumes, transformed through entity_maker"""
+ """Returns a list of volumes, transformed through entity_maker."""
context = req.environ['nova.context']
volumes = self.volume_api.get_all(context)
@@ -139,7 +139,7 @@ class Controller(wsgi.Controller):
return {'volumes': res}
def create(self, req):
- """Creates a new volume"""
+ """Creates a new volume."""
context = req.environ['nova.context']
env = self._deserialize(req.body, req.get_content_type())
diff --git a/nova/api/openstack/incubator/volumes/volumes_ext.py b/nova/api/openstack/incubator/volumes/volumes_ext.py
index 87a57320d..6a3bb0265 100644
--- a/nova/api/openstack/incubator/volumes/volumes_ext.py
+++ b/nova/api/openstack/incubator/volumes/volumes_ext.py
@@ -37,8 +37,8 @@ class VolumesExtension(extensions.ExtensionDescriptor):
def get_resources(self):
resources = []
- #NOTE(justinsb): No way to provide singular name ('volume')
- # Does this matter?
+ # NOTE(justinsb): No way to provide singular name ('volume')
+ # Does this matter?
res = extensions.ResourceExtension('volumes',
volumes.Controller(),
collection_actions={'detail': 'GET'}