summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/ec2/cloud.py3
-rw-r--r--nova/api/openstack/__init__.py3
-rw-r--r--nova/api/openstack/contrib/volumes.py6
-rw-r--r--nova/api/openstack/create_instance_helper.py19
-rw-r--r--nova/api/openstack/extensions.py13
-rw-r--r--nova/api/openstack/notes.txt3
-rw-r--r--nova/api/openstack/servers.py8
-rw-r--r--nova/api/openstack/wsgi.py8
8 files changed, 30 insertions, 33 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py
index e1c65ae40..c8a7e69be 100644
--- a/nova/api/ec2/cloud.py
+++ b/nova/api/ec2/cloud.py
@@ -974,7 +974,8 @@ class CloudController(object):
changes[field] = kwargs[field]
if changes:
instance_id = ec2utils.ec2_id_to_id(instance_id)
- self.compute_api.update(context, instance_id=instance_id, **kwargs)
+ self.compute_api.update(context, instance_id=instance_id,
+ **changes)
return True
@staticmethod
diff --git a/nova/api/openstack/__init__.py b/nova/api/openstack/__init__.py
index ddd9580d7..f24017df0 100644
--- a/nova/api/openstack/__init__.py
+++ b/nova/api/openstack/__init__.py
@@ -113,8 +113,7 @@ class APIRouter(base_wsgi.Router):
collection={'detail': 'GET',
'info': 'GET',
'select': 'POST',
- 'boot': 'POST'
- })
+ 'boot': 'POST'})
mapper.resource("console", "consoles",
controller=consoles.create_resource(),
diff --git a/nova/api/openstack/contrib/volumes.py b/nova/api/openstack/contrib/volumes.py
index feabdce89..e5e2c5b50 100644
--- a/nova/api/openstack/contrib/volumes.py
+++ b/nova/api/openstack/contrib/volumes.py
@@ -301,7 +301,7 @@ class Volumes(extensions.ExtensionDescriptor):
return "Volumes"
def get_alias(self):
- return "VOLUMES"
+ return "os-volumes"
def get_description(self):
return "Volumes support"
@@ -317,12 +317,12 @@ class Volumes(extensions.ExtensionDescriptor):
# NOTE(justinsb): No way to provide singular name ('volume')
# Does this matter?
- res = extensions.ResourceExtension('volumes',
+ res = extensions.ResourceExtension('os-volumes',
VolumeController(),
collection_actions={'detail': 'GET'})
resources.append(res)
- res = extensions.ResourceExtension('volume_attachments',
+ res = extensions.ResourceExtension('os-volume_attachments',
VolumeAttachmentController(),
parent=dict(
member_name='server',
diff --git a/nova/api/openstack/create_instance_helper.py b/nova/api/openstack/create_instance_helper.py
index fbc6318ef..436e524c1 100644
--- a/nova/api/openstack/create_instance_helper.py
+++ b/nova/api/openstack/create_instance_helper.py
@@ -94,7 +94,7 @@ class CreateInstanceHelper(object):
except Exception, e:
msg = _("Cannot find requested image %(image_href)s: %(e)s" %
locals())
- raise faults.Fault(exc.HTTPBadRequest(msg))
+ raise faults.Fault(exc.HTTPBadRequest(explanation=msg))
personality = body['server'].get('personality')
@@ -106,7 +106,7 @@ class CreateInstanceHelper(object):
if not 'name' in body['server']:
msg = _("Server name is not defined")
- raise exc.HTTPBadRequest(msg)
+ raise exc.HTTPBadRequest(explanation=msg)
zone_blob = body['server'].get('blob')
name = body['server']['name']
@@ -121,8 +121,7 @@ class CreateInstanceHelper(object):
extra_values = {
'instance_type': inst_type,
'image_ref': image_href,
- 'password': password
- }
+ 'password': password}
return (extra_values,
create_method(context,
@@ -138,14 +137,12 @@ class CreateInstanceHelper(object):
injected_files=injected_files,
admin_password=password,
zone_blob=zone_blob,
- reservation_id=reservation_id
- )
- )
+ reservation_id=reservation_id))
except quota.QuotaError as error:
self._handle_quota_error(error)
except exception.ImageNotFound as error:
msg = _("Can not find requested image")
- raise faults.Fault(exc.HTTPBadRequest(msg))
+ raise faults.Fault(exc.HTTPBadRequest(explanation=msg))
# Let the caller deal with unhandled exceptions.
@@ -180,11 +177,11 @@ class CreateInstanceHelper(object):
def _validate_server_name(self, value):
if not isinstance(value, basestring):
msg = _("Server name is not a string or unicode")
- raise exc.HTTPBadRequest(msg)
+ raise exc.HTTPBadRequest(explanation=msg)
if value.strip() == '':
msg = _("Server name is an empty string")
- raise exc.HTTPBadRequest(msg)
+ raise exc.HTTPBadRequest(explanation=msg)
def _get_kernel_ramdisk_from_image(self, req, image_id):
"""Fetch an image from the ImageService, then if present, return the
@@ -265,7 +262,7 @@ class CreateInstanceHelper(object):
return utils.generate_password(16)
if not isinstance(password, basestring) or password == '':
msg = _("Invalid adminPass")
- raise exc.HTTPBadRequest(msg)
+ raise exc.HTTPBadRequest(explanation=msg)
return password
diff --git a/nova/api/openstack/extensions.py b/nova/api/openstack/extensions.py
index 54e17e23d..da06ecd15 100644
--- a/nova/api/openstack/extensions.py
+++ b/nova/api/openstack/extensions.py
@@ -374,6 +374,8 @@ class ExtensionManager(object):
LOG.debug(_('Ext updated: %s'), extension.get_updated())
except AttributeError as ex:
LOG.exception(_("Exception loading extension: %s"), unicode(ex))
+ return False
+ return True
def _load_all_extensions(self):
"""Load extensions from the configured path.
@@ -412,15 +414,16 @@ class ExtensionManager(object):
'file': ext_path})
continue
new_ext = new_ext_class()
- self._check_extension(new_ext)
- self._add_extension(new_ext)
+ self.add_extension(new_ext)
+
+ def add_extension(self, ext):
+ # Do nothing if the extension doesn't check out
+ if not self._check_extension(ext):
+ return
- def _add_extension(self, ext):
alias = ext.get_alias()
LOG.audit(_('Loaded extension: %s'), alias)
- self._check_extension(ext)
-
if alias in self.extensions:
raise exception.Error("Found duplicate extension: %s" % alias)
self.extensions[alias] = ext
diff --git a/nova/api/openstack/notes.txt b/nova/api/openstack/notes.txt
index 2330f1002..4e95bffc8 100644
--- a/nova/api/openstack/notes.txt
+++ b/nova/api/openstack/notes.txt
@@ -7,9 +7,6 @@ image ids.
GlanceImageService(ImageService):
image ids are URIs.
-LocalImageService(ImageService):
-image ids are random strings.
-
OpenstackAPITranslationStore:
translates RS server/images/flavor/etc ids into formats required
by a given ImageService strategy.
diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py
index 798fdd7f7..b82a6de19 100644
--- a/nova/api/openstack/servers.py
+++ b/nova/api/openstack/servers.py
@@ -51,7 +51,7 @@ class Controller(object):
try:
servers = self._items(req, is_detail=False)
except exception.Invalid as err:
- return exc.HTTPBadRequest(str(err))
+ return exc.HTTPBadRequest(explanation=str(err))
return servers
def detail(self, req):
@@ -59,7 +59,7 @@ class Controller(object):
try:
servers = self._items(req, is_detail=True)
except exception.Invalid as err:
- return exc.HTTPBadRequest(str(err))
+ return exc.HTTPBadRequest(explanation=str(err))
return servers
def _get_view_builder(self, req):
@@ -488,11 +488,11 @@ class ControllerV11(Controller):
if (not 'changePassword' in input_dict
or not 'adminPass' in input_dict['changePassword']):
msg = _("No adminPass was specified")
- return exc.HTTPBadRequest(msg)
+ return exc.HTTPBadRequest(explanation=msg)
password = input_dict['changePassword']['adminPass']
if not isinstance(password, basestring) or password == '':
msg = _("Invalid adminPass")
- return exc.HTTPBadRequest(msg)
+ return exc.HTTPBadRequest(explanation=msg)
self.compute_api.set_admin_password(context, id, password)
return exc.HTTPAccepted()
diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py
index 3f8acf339..a57b7f72b 100644
--- a/nova/api/openstack/wsgi.py
+++ b/nova/api/openstack/wsgi.py
@@ -363,11 +363,11 @@ class Resource(wsgi.Application):
action, action_args, accept = self.deserializer.deserialize(
request)
except exception.InvalidContentType:
- return webob.exc.HTTPBadRequest(_("Unsupported Content-Type"))
+ msg = _("Unsupported Content-Type")
+ return webob.exc.HTTPBadRequest(explanation=msg)
except exception.MalformedRequestBody:
- explanation = _("Malformed request body")
- return faults.Fault(webob.exc.HTTPBadRequest(
- explanation=explanation))
+ msg = _("Malformed request body")
+ return faults.Fault(webob.exc.HTTPBadRequest(explanation=msg))
action_result = self.dispatch(request, action, action_args)