summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-02-22 11:21:40 +0000
committerGerrit Code Review <review@openstack.org>2012-02-22 11:21:40 +0000
commitd7fb579cf9e192dbbace1b11f2a2bc84555d4c71 (patch)
treeead9ad6f0351182b981a4ba858851c096ff99bf0 /nova/api
parentae99fe81f542f3c8f4e509742afa3d5a87c7cadf (diff)
parentade948dd77139390dc03f62564b0050df3ef54f3 (diff)
downloadnova-d7fb579cf9e192dbbace1b11f2a2bc84555d4c71.tar.gz
nova-d7fb579cf9e192dbbace1b11f2a2bc84555d4c71.tar.xz
nova-d7fb579cf9e192dbbace1b11f2a2bc84555d4c71.zip
Merge "Backslash continuations (nova.api.openstack)"
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/__init__.py2
-rw-r--r--nova/api/openstack/auth.py14
-rw-r--r--nova/api/openstack/compute/__init__.py7
-rw-r--r--nova/api/openstack/compute/contrib/certificates.py4
-rw-r--r--nova/api/openstack/compute/contrib/console_output.py4
-rw-r--r--nova/api/openstack/compute/contrib/createserverext.py4
-rw-r--r--nova/api/openstack/compute/contrib/deferred_delete.py4
-rw-r--r--nova/api/openstack/compute/contrib/extended_status.py4
-rw-r--r--nova/api/openstack/compute/contrib/flavorextradata.py4
-rw-r--r--nova/api/openstack/compute/contrib/flavorextraspecs.py4
-rw-r--r--nova/api/openstack/compute/contrib/floating_ip_pools.py4
-rw-r--r--nova/api/openstack/compute/contrib/scheduler_hints.py4
-rw-r--r--nova/api/openstack/compute/contrib/server_action_list.py4
-rw-r--r--nova/api/openstack/compute/contrib/server_diagnostics.py4
-rw-r--r--nova/api/openstack/compute/contrib/simple_tenant_usage.py12
-rw-r--r--nova/api/openstack/compute/contrib/virtual_interfaces.py4
-rw-r--r--nova/api/openstack/compute/contrib/virtual_storage_arrays.py16
-rw-r--r--nova/api/openstack/compute/images.py4
-rw-r--r--nova/api/openstack/compute/limits.py5
-rw-r--r--nova/api/openstack/compute/servers.py12
-rw-r--r--nova/api/openstack/compute/views/limits.py8
-rw-r--r--nova/api/openstack/wsgi.py4
22 files changed, 68 insertions, 64 deletions
diff --git a/nova/api/openstack/__init__.py b/nova/api/openstack/__init__.py
index 31e6f48fa..82e958a59 100644
--- a/nova/api/openstack/__init__.py
+++ b/nova/api/openstack/__init__.py
@@ -68,7 +68,7 @@ class ProjectMapper(APIMapper):
p_collection = parent_resource['collection_name']
p_member = parent_resource['member_name']
kwargs['path_prefix'] = '{project_id}/%s/:%s_id' % (p_collection,
- p_member)
+ p_member)
routes.Mapper.resource(self, member_name,
collection_name,
**kwargs)
diff --git a/nova/api/openstack/auth.py b/nova/api/openstack/auth.py
index c404c72af..c59d2a315 100644
--- a/nova/api/openstack/auth.py
+++ b/nova/api/openstack/auth.py
@@ -173,15 +173,19 @@ class AuthMiddleware(base_wsgi.Middleware):
if user and token:
res = webob.Response()
res.headers['X-Auth-Token'] = token['token_hash']
- res.headers['X-Server-Management-Url'] = \
- token['server_management_url']
+ _x_server_url = 'X-Server-Management-Url'
+ _server_url = 'server_management_url'
+ res.headers[_x_server_url] = token[_server_url]
if token['storage_url']:
- res.headers['X-Storage-Url'] = token['storage_url']
+ _x_storage_url = 'X-Storage-Url'
+ _storage_url = 'storage_url'
+ res.headers[_x_storage_url] = token[_storage_url]
if token['cdn_management_url']:
- res.headers['X-CDN-Management-Url'] = \
- token['cdn_management_url']
+ _x_cdn_url = 'X-CDN-Management-Url'
+ _cdn_url = 'cdn_management_url'
+ res.headers[_x_cdn_url] = token[_cdn_url]
res.content_type = 'text/plain'
res.status = '204'
diff --git a/nova/api/openstack/compute/__init__.py b/nova/api/openstack/compute/__init__.py
index 2c6a3ce39..9e9bb9003 100644
--- a/nova/api/openstack/compute/__init__.py
+++ b/nova/api/openstack/compute/__init__.py
@@ -38,10 +38,9 @@ from nova.openstack.common import cfg
LOG = logging.getLogger(__name__)
-allow_instance_snapshots_opt = \
- cfg.BoolOpt('allow_instance_snapshots',
- default=True,
- help='Permit instance snapshot operations.')
+allow_instance_snapshots_opt = cfg.BoolOpt('allow_instance_snapshots',
+ default=True,
+ help='Permit instance snapshot operations.')
FLAGS = flags.FLAGS
FLAGS.register_opt(allow_instance_snapshots_opt)
diff --git a/nova/api/openstack/compute/contrib/certificates.py b/nova/api/openstack/compute/contrib/certificates.py
index 11e1480a2..41843e32e 100644
--- a/nova/api/openstack/compute/contrib/certificates.py
+++ b/nova/api/openstack/compute/contrib/certificates.py
@@ -97,8 +97,8 @@ class Certificates(extensions.ExtensionDescriptor):
name = "Certificates"
alias = "os-certificates"
- namespace = \
- "http://docs.openstack.org/compute/ext/certificates/api/v1.1"
+ namespace = ("http://docs.openstack.org/compute/ext/"
+ "certificates/api/v1.1")
updated = "2012-01-19T00:00:00+00:00"
def get_resources(self):
diff --git a/nova/api/openstack/compute/contrib/console_output.py b/nova/api/openstack/compute/contrib/console_output.py
index 6fc7fcbf0..1eb86a092 100644
--- a/nova/api/openstack/compute/contrib/console_output.py
+++ b/nova/api/openstack/compute/contrib/console_output.py
@@ -65,8 +65,8 @@ class Console_output(extensions.ExtensionDescriptor):
name = "Console_output"
alias = "os-console-output"
- namespace = "http://docs.openstack.org/compute/ext/" \
- "os-console-output/api/v2"
+ namespace = ("http://docs.openstack.org/compute/ext/"
+ "os-console-output/api/v2")
updated = "2011-12-08T00:00:00+00:00"
def get_controller_extensions(self):
diff --git a/nova/api/openstack/compute/contrib/createserverext.py b/nova/api/openstack/compute/contrib/createserverext.py
index de4ba8dd0..c5e26a349 100644
--- a/nova/api/openstack/compute/contrib/createserverext.py
+++ b/nova/api/openstack/compute/contrib/createserverext.py
@@ -49,8 +49,8 @@ class Createserverext(extensions.ExtensionDescriptor):
name = "Createserverext"
alias = "os-create-server-ext"
- namespace = "http://docs.openstack.org/compute/ext/" \
- "createserverext/api/v1.1"
+ namespace = ("http://docs.openstack.org/compute/ext/"
+ "createserverext/api/v1.1")
updated = "2011-07-19T00:00:00+00:00"
def get_resources(self):
diff --git a/nova/api/openstack/compute/contrib/deferred_delete.py b/nova/api/openstack/compute/contrib/deferred_delete.py
index 7752871de..16c305973 100644
--- a/nova/api/openstack/compute/contrib/deferred_delete.py
+++ b/nova/api/openstack/compute/contrib/deferred_delete.py
@@ -66,8 +66,8 @@ class Deferred_delete(extensions.ExtensionDescriptor):
name = "DeferredDelete"
alias = "os-deferred-delete"
- namespace = "http://docs.openstack.org/compute/ext/" \
- "deferred-delete/api/v1.1"
+ namespace = ("http://docs.openstack.org/compute/ext/"
+ "deferred-delete/api/v1.1")
updated = "2011-09-01T00:00:00+00:00"
def get_controller_extensions(self):
diff --git a/nova/api/openstack/compute/contrib/extended_status.py b/nova/api/openstack/compute/contrib/extended_status.py
index 88a5f12a4..de532adad 100644
--- a/nova/api/openstack/compute/contrib/extended_status.py
+++ b/nova/api/openstack/compute/contrib/extended_status.py
@@ -89,8 +89,8 @@ class Extended_status(extensions.ExtensionDescriptor):
name = "ExtendedStatus"
alias = "OS-EXT-STS"
- namespace = "http://docs.openstack.org/compute/ext/" \
- "extended_status/api/v1.1"
+ namespace = ("http://docs.openstack.org/compute/ext/"
+ "extended_status/api/v1.1")
updated = "2011-11-03T00:00:00+00:00"
def get_controller_extensions(self):
diff --git a/nova/api/openstack/compute/contrib/flavorextradata.py b/nova/api/openstack/compute/contrib/flavorextradata.py
index aa9156673..f821a8ffb 100644
--- a/nova/api/openstack/compute/contrib/flavorextradata.py
+++ b/nova/api/openstack/compute/contrib/flavorextradata.py
@@ -98,8 +98,8 @@ class Flavorextradata(extensions.ExtensionDescriptor):
name = "FlavorExtraData"
alias = "OS-FLV-EXT-DATA"
- namespace = "http://docs.openstack.org/compute/ext/" \
- "flavor_extra_data/api/v1.1"
+ namespace = ("http://docs.openstack.org/compute/ext/"
+ "flavor_extra_data/api/v1.1")
updated = "2011-09-14T00:00:00+00:00"
def get_controller_extensions(self):
diff --git a/nova/api/openstack/compute/contrib/flavorextraspecs.py b/nova/api/openstack/compute/contrib/flavorextraspecs.py
index faf023659..1712e30b9 100644
--- a/nova/api/openstack/compute/contrib/flavorextraspecs.py
+++ b/nova/api/openstack/compute/contrib/flavorextraspecs.py
@@ -119,8 +119,8 @@ class Flavorextraspecs(extensions.ExtensionDescriptor):
name = "FlavorExtraSpecs"
alias = "os-flavor-extra-specs"
- namespace = "http://docs.openstack.org/compute/ext/" \
- "flavor_extra_specs/api/v1.1"
+ namespace = ("http://docs.openstack.org/compute/ext/"
+ "flavor_extra_specs/api/v1.1")
updated = "2011-06-23T00:00:00+00:00"
def get_resources(self):
diff --git a/nova/api/openstack/compute/contrib/floating_ip_pools.py b/nova/api/openstack/compute/contrib/floating_ip_pools.py
index 39348db6e..9080f086e 100644
--- a/nova/api/openstack/compute/contrib/floating_ip_pools.py
+++ b/nova/api/openstack/compute/contrib/floating_ip_pools.py
@@ -80,8 +80,8 @@ class Floating_ip_pools(extensions.ExtensionDescriptor):
name = "Floating_ip_pools"
alias = "os-floating-ip-pools"
- namespace = \
- "http://docs.openstack.org/compute/ext/floating_ip_pools/api/v1.1"
+ namespace = ("http://docs.openstack.org/compute/ext/"
+ "floating_ip_pools/api/v1.1")
updated = "2012-01-04T00:00:00+00:00"
def get_resources(self):
diff --git a/nova/api/openstack/compute/contrib/scheduler_hints.py b/nova/api/openstack/compute/contrib/scheduler_hints.py
index d5c9a25de..9e0b3ea3a 100644
--- a/nova/api/openstack/compute/contrib/scheduler_hints.py
+++ b/nova/api/openstack/compute/contrib/scheduler_hints.py
@@ -55,8 +55,8 @@ class Scheduler_hints(extensions.ExtensionDescriptor):
name = "SchedulerHints"
alias = "os-scheduler-hints"
- namespace = "http://docs.openstack.org/compute/ext/" \
- "scheduler-hints/api/v2"
+ namespace = ("http://docs.openstack.org/compute/ext/"
+ "scheduler-hints/api/v2")
updated = "2011-07-19T00:00:00+00:00"
def get_controller_extensions(self):
diff --git a/nova/api/openstack/compute/contrib/server_action_list.py b/nova/api/openstack/compute/contrib/server_action_list.py
index 24d3595d4..55c167442 100644
--- a/nova/api/openstack/compute/contrib/server_action_list.py
+++ b/nova/api/openstack/compute/contrib/server_action_list.py
@@ -65,8 +65,8 @@ class Server_action_list(extensions.ExtensionDescriptor):
name = "ServerActionList"
alias = "os-server-action-list"
- namespace = "http://docs.openstack.org/compute/ext/" \
- "server-actions-list/api/v1.1"
+ namespace = ("http://docs.openstack.org/compute/ext/"
+ "server-actions-list/api/v1.1")
updated = "2011-12-21T00:00:00+00:00"
def get_resources(self):
diff --git a/nova/api/openstack/compute/contrib/server_diagnostics.py b/nova/api/openstack/compute/contrib/server_diagnostics.py
index c03cd2d47..eddb7429d 100644
--- a/nova/api/openstack/compute/contrib/server_diagnostics.py
+++ b/nova/api/openstack/compute/contrib/server_diagnostics.py
@@ -54,8 +54,8 @@ class Server_diagnostics(extensions.ExtensionDescriptor):
name = "ServerDiagnostics"
alias = "os-server-diagnostics"
- namespace = "http://docs.openstack.org/compute/ext/" \
- "server-diagnostics/api/v1.1"
+ namespace = ("http://docs.openstack.org/compute/ext/"
+ "server-diagnostics/api/v1.1")
updated = "2011-12-21T00:00:00+00:00"
def get_resources(self):
diff --git a/nova/api/openstack/compute/contrib/simple_tenant_usage.py b/nova/api/openstack/compute/contrib/simple_tenant_usage.py
index eb32e9f08..fd1a95949 100644
--- a/nova/api/openstack/compute/contrib/simple_tenant_usage.py
+++ b/nova/api/openstack/compute/contrib/simple_tenant_usage.py
@@ -97,8 +97,8 @@ class SimpleTenantUsageController(object):
# instance is still running, so charge them up to current time
stop = period_stop
dt = stop - start
- seconds = dt.days * 3600 * 24 + dt.seconds\
- + dt.microseconds / 100000.0
+ seconds = (dt.days * 3600 * 24 + dt.seconds +
+ dt.microseconds / 100000.0)
return seconds / 3600.0
else:
@@ -178,8 +178,8 @@ class SimpleTenantUsageController(object):
summary = rval[info['tenant_id']]
summary['total_local_gb_usage'] += info['local_gb'] * info['hours']
summary['total_vcpus_usage'] += info['vcpus'] * info['hours']
- summary['total_memory_mb_usage'] += info['memory_mb']\
- * info['hours']
+ summary['total_memory_mb_usage'] += (info['memory_mb'] *
+ info['hours'])
summary['total_hours'] += info['hours']
if detailed:
@@ -249,8 +249,8 @@ class Simple_tenant_usage(extensions.ExtensionDescriptor):
name = "SimpleTenantUsage"
alias = "os-simple-tenant-usage"
- namespace = "http://docs.openstack.org/compute/ext/" \
- "os-simple-tenant-usage/api/v1.1"
+ namespace = ("http://docs.openstack.org/compute/ext/"
+ "os-simple-tenant-usage/api/v1.1")
updated = "2011-08-19T00:00:00+00:00"
def get_resources(self):
diff --git a/nova/api/openstack/compute/contrib/virtual_interfaces.py b/nova/api/openstack/compute/contrib/virtual_interfaces.py
index eee90ca7d..87754499a 100644
--- a/nova/api/openstack/compute/contrib/virtual_interfaces.py
+++ b/nova/api/openstack/compute/contrib/virtual_interfaces.py
@@ -81,8 +81,8 @@ class Virtual_interfaces(extensions.ExtensionDescriptor):
name = "VirtualInterfaces"
alias = "virtual_interfaces"
- namespace = "http://docs.openstack.org/compute/ext/" \
- "virtual_interfaces/api/v1.1"
+ namespace = ("http://docs.openstack.org/compute/ext/"
+ "virtual_interfaces/api/v1.1")
updated = "2011-08-17T00:00:00+00:00"
def get_resources(self):
diff --git a/nova/api/openstack/compute/contrib/virtual_storage_arrays.py b/nova/api/openstack/compute/contrib/virtual_storage_arrays.py
index 34e181cc7..ff275f911 100644
--- a/nova/api/openstack/compute/contrib/virtual_storage_arrays.py
+++ b/nova/api/openstack/compute/contrib/virtual_storage_arrays.py
@@ -182,13 +182,13 @@ class VsaController(object):
LOG.audit(_("Create VSA %(display_name)s of type %(vc_type)s"),
locals(), context=context)
+ _vsa_placement = vsa.get('placement', {})
args = dict(display_name=display_name,
- display_description=vsa.get('displayDescription'),
- instance_type=instance_type,
- storage=vsa.get('storage'),
- shared=vsa.get('shared'),
- availability_zone=vsa.get('placement', {}).\
- get('AvailabilityZone'))
+ display_description=vsa.get('displayDescription'),
+ instance_type=instance_type,
+ storage=vsa.get('storage'),
+ shared=vsa.get('shared'),
+ availability_zone=_vsa_placement.get('AvailabilityZone'))
vsa = self.vsa_api.create(context, **args)
@@ -294,7 +294,7 @@ class VsaVolumeDriveController(volumes.VolumeController):
own_vsa_id = self.volume_api.get_volume_metadata_value(volume_ref,
self.direction)
if own_vsa_id != vsa_id:
- LOG.error(_("%(obj)s with ID %(id)s belongs to VSA %(own_vsa_id)s"\
+ LOG.error(_("%(obj)s with ID %(id)s belongs to VSA %(own_vsa_id)s"
" and not to VSA %(vsa_id)s."), locals())
raise exception.Invalid()
@@ -307,7 +307,7 @@ class VsaVolumeDriveController(volumes.VolumeController):
search_opts={'metadata': {self.direction: str(vsa_id)}})
limited_list = common.limited(vols, req)
- res = [self._translation(context, vol, vsa_id, details) \
+ res = [self._translation(context, vol, vsa_id, details)
for vol in limited_list]
return {self.objects: res}
diff --git a/nova/api/openstack/compute/images.py b/nova/api/openstack/compute/images.py
index 51d833e1f..296aacb4b 100644
--- a/nova/api/openstack/compute/images.py
+++ b/nova/api/openstack/compute/images.py
@@ -101,8 +101,8 @@ class Controller(wsgi.Controller):
"""
super(Controller, self).__init__(**kwargs)
- self._image_service = image_service or \
- nova.image.get_default_image_service()
+ self._image_service = (image_service or
+ nova.image.get_default_image_service())
def _get_filters(self, req):
"""
diff --git a/nova/api/openstack/compute/limits.py b/nova/api/openstack/compute/limits.py
index cc78b3006..a20b75bc9 100644
--- a/nova/api/openstack/compute/limits.py
+++ b/nova/api/openstack/compute/limits.py
@@ -137,8 +137,9 @@ class Limit(object):
self.water_level = 0
self.capacity = self.unit
self.request_value = float(self.capacity) / float(self.value)
- self.error_message = _("Only %(value)s %(verb)s request(s) can be "\
- "made to %(uri)s every %(unit_string)s." % self.__dict__)
+ self.error_message = _("Only %(value)s %(verb)s request(s) can be "
+ "made to %(uri)s every %(unit_string)s." %
+ self.__dict__)
def __call__(self, verb, url):
"""
diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py
index 26ed42f20..7a0141a01 100644
--- a/nova/api/openstack/compute/servers.py
+++ b/nova/api/openstack/compute/servers.py
@@ -558,8 +558,8 @@ class Controller(wsgi.Controller):
# at the boot time
for id, ip in networks:
if id == network_uuid:
- expl = _("Duplicate networks (%s) are not allowed")\
- % network_uuid
+ expl = (_("Duplicate networks (%s) are not allowed") %
+ network_uuid)
raise exc.HTTPBadRequest(explanation=expl)
networks.append((network_uuid, address))
@@ -705,8 +705,8 @@ class Controller(wsgi.Controller):
scheduler_hints = server_dict.get('scheduler_hints', {})
try:
- inst_type = \
- instance_types.get_instance_type_by_flavor_id(flavor_id)
+ _get_inst_type = instance_types.get_instance_type_by_flavor_id
+ inst_type = _get_inst_type(flavor_id)
(instances, resv_id) = self.compute_api.create(context,
inst_type,
@@ -747,8 +747,8 @@ class Controller(wsgi.Controller):
except exception.SecurityGroupNotFound as error:
raise exc.HTTPBadRequest(explanation=unicode(error))
except rpc_common.RemoteError as err:
- msg = "%(err_type)s: %(err_msg)s" % \
- {'err_type': err.exc_type, 'err_msg': err.value}
+ msg = "%(err_type)s: %(err_msg)s" % {'err_type': err.exc_type,
+ 'err_msg': err.value}
raise exc.HTTPBadRequest(explanation=msg)
# Let the caller deal with unhandled exceptions.
diff --git a/nova/api/openstack/compute/views/limits.py b/nova/api/openstack/compute/views/limits.py
index cff6781be..f55f451d4 100644
--- a/nova/api/openstack/compute/views/limits.py
+++ b/nova/api/openstack/compute/views/limits.py
@@ -66,8 +66,8 @@ class ViewBuilder(object):
# check for existing key
for limit in limits:
- if limit["uri"] == rate_limit["URI"] and \
- limit["regex"] == rate_limit["regex"]:
+ if (limit["uri"] == rate_limit["URI"] and
+ limit["regex"] == rate_limit["regex"]):
_rate_limit_key = limit
break
@@ -85,8 +85,8 @@ class ViewBuilder(object):
return limits
def _build_rate_limit(self, rate_limit):
- next_avail = \
- datetime.datetime.utcfromtimestamp(rate_limit["resetTime"])
+ _get_utc = datetime.datetime.utcfromtimestamp
+ next_avail = _get_utc(rate_limit["resetTime"])
return {
"verb": rate_limit["verb"],
"value": rate_limit["value"],
diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py
index c887701a7..ad45284c7 100644
--- a/nova/api/openstack/wsgi.py
+++ b/nova/api/openstack/wsgi.py
@@ -79,8 +79,8 @@ class Request(webob.Request):
if not content_type:
content_type = self.accept.best_match(SUPPORTED_CONTENT_TYPES)
- self.environ['nova.best_content_type'] = content_type or \
- 'application/json'
+ self.environ['nova.best_content_type'] = (content_type or
+ 'application/json')
return self.environ['nova.best_content_type']