From 439787e7588b2409f319f2d86a41a3581cff8861 Mon Sep 17 00:00:00 2001 From: Rick Harris Date: Tue, 17 May 2011 18:15:31 -0500 Subject: Pep8 fixes --- nova/exception.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'nova/exception.py') diff --git a/nova/exception.py b/nova/exception.py index 63ed6dd5e..16c443c61 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -460,15 +460,18 @@ class FlavorNotFound(NotFound): class ZoneNotFound(NotFound): message = _("Zone %(zone_id)s could not be found.") + # TODO(sirp): move these into the schedule classes since they are internal? class SchedulerHostFilterDriverNotFound(NotFound): message = _("Scheduler Host Filter Driver %(driver_name)s could" " not be found.") + class SchedulerCostFunctionNotFound(NotFound): message = _("Scheduler cost function %(cost_fn_str)s could" " not be found.") + class SchedulerWeightFlagNotFound(NotFound): message = _("Scheduler weight flag not found: %(flag_name)s") -- cgit From e16b2d22dc4e6e24c3bf5150a0830661933aad29 Mon Sep 17 00:00:00 2001 From: Naveed Massjouni Date: Fri, 20 May 2011 04:14:02 -0400 Subject: Fixed some tests. --- nova/exception.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'nova/exception.py') diff --git a/nova/exception.py b/nova/exception.py index cf6069454..4c977aca0 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -279,6 +279,10 @@ class DiskNotFound(NotFound): message = _("No disk at %(location)s") +class InvalidImageRef(Invalid): + message = _("Invalid image ref %(image_ref)s.") + + class ImageNotFound(NotFound): message = _("Image %(image_id)s could not be found.") -- cgit From 781672793c5fb774c5d9d291798775db471233b2 Mon Sep 17 00:00:00 2001 From: Naveed Massjouni Date: Wed, 25 May 2011 19:57:04 -0400 Subject: Renamed image_ref variables to image_href. Since the convention is that x_ref vars may imply that they are db objects. --- nova/exception.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nova/exception.py') diff --git a/nova/exception.py b/nova/exception.py index 13f5bf95c..5b91e1cde 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -284,7 +284,7 @@ class DiskNotFound(NotFound): class InvalidImageRef(Invalid): - message = _("Invalid image ref %(image_ref)s.") + message = _("Invalid image ref %(image_href)s.") class ImageNotFound(NotFound): -- cgit From 099c29549a70cb88a6266a5e4145f855e1862d99 Mon Sep 17 00:00:00 2001 From: Naveed Massjouni Date: Tue, 31 May 2011 11:58:15 -0400 Subject: Handle the case when a v1.0 api tries to list servers that contain image hrefs. --- nova/exception.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'nova/exception.py') diff --git a/nova/exception.py b/nova/exception.py index 5b91e1cde..6ea6c3620 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -284,7 +284,12 @@ class DiskNotFound(NotFound): class InvalidImageRef(Invalid): - message = _("Invalid image ref %(image_href)s.") + message = _("Invalid image href %(image_href)s.") + + +class ListingImageRefsNotSupported(Invalid): + message = _("Some images have been stored via hrefs." + + " This version of the api does not support displaying image hrefs.") class ImageNotFound(NotFound): -- cgit From ae1842174f4b079c8d84b32ddad4df1b7ff29bec Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 2 Jun 2011 12:01:49 -0700 Subject: Tests to assure all exceptions can be raised as well as fixing NotAuthorized --- nova/exception.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nova/exception.py') diff --git a/nova/exception.py b/nova/exception.py index d3d58f3b2..5b824bba6 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -65,7 +65,7 @@ class BuildInProgress(Error): class DBError(Error): """Wraps an implementation specific exception.""" - def __init__(self, inner_exception): + def __init__(self, inner_exception=None): self.inner_exception = inner_exception super(DBError, self).__init__(str(inner_exception)) @@ -122,7 +122,7 @@ class NotAuthorized(NovaException): message = _("Not authorized.") def __init__(self, *args, **kwargs): - super(NotFound, self).__init__(**kwargs) + super(NotAuthorized, self).__init__(**kwargs) class AdminRequired(NotAuthorized): -- cgit From 05fecdf873a5c02dcb13c841304df872411d4183 Mon Sep 17 00:00:00 2001 From: John Tran Date: Fri, 10 Jun 2011 11:10:58 -0700 Subject: added new exception more descriptive of not having available floating addresses avail for allocation --- nova/exception.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'nova/exception.py') diff --git a/nova/exception.py b/nova/exception.py index 69b3e0359..1571dd032 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -376,6 +376,10 @@ class NoFloatingIpsDefinedForInstance(NoFloatingIpsDefined): message = _("Zero floating ips defined for instance %(instance_id)s.") +class NoMoreFloatingIps(NotFound): + message = _("Zero floating ips available.") + + class KeypairNotFound(NotFound): message = _("Keypair %(keypair_name)s not found for user %(user_id)s") -- cgit From a3ddb45464204464c93b1deb692414c44ce99376 Mon Sep 17 00:00:00 2001 From: Alex Meade Date: Tue, 14 Jun 2011 10:16:51 -0400 Subject: Created new exception for handling malformed requests Wrote tests Raise httpBadRequest on malformed request bodies --- nova/exception.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'nova/exception.py') diff --git a/nova/exception.py b/nova/exception.py index 1571dd032..ffd88fbe7 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -585,3 +585,7 @@ class InstanceExists(Duplicate): class MigrationError(NovaException): message = _("Migration error") + ": %(reason)s" + + +class MalformedRequestBody(NovaException): + message = _("Malformed message body") + ": %(reason)s" -- cgit From cf66a99314d6420725e32daf6a08404c98239107 Mon Sep 17 00:00:00 2001 From: Alex Meade Date: Tue, 14 Jun 2011 13:27:28 -0400 Subject: mp fixes --- nova/exception.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nova/exception.py') diff --git a/nova/exception.py b/nova/exception.py index ffd88fbe7..f3a452228 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -588,4 +588,4 @@ class MigrationError(NovaException): class MalformedRequestBody(NovaException): - message = _("Malformed message body") + ": %(reason)s" + message = _("Malformed message body: %(reason)s") -- cgit