From 4e43747037058522087e6eb71ef3bcce266d55cc Mon Sep 17 00:00:00 2001 From: Joe Gordon Date: Mon, 26 Nov 2012 22:55:19 +0000 Subject: Provide better error message for aggregate-create For an InvalidAggregateAction exception: Before: 'ERROR: There was a conflict when trying to complete your request (HTTP 409)' After: 'ERROR: Cannot perform action 'create_aggregate' on aggregate 'N/A'. Reason: invalid zone. (HTTP 400)' Fix bug 1083353 Change-Id: I26e30059fe5bbc30eecc52cccec4eba2a57d00db --- nova/api/openstack/compute/contrib/aggregates.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/compute/contrib/aggregates.py b/nova/api/openstack/compute/contrib/aggregates.py index 9435f5980..ef9679f5a 100644 --- a/nova/api/openstack/compute/contrib/aggregates.py +++ b/nova/api/openstack/compute/contrib/aggregates.py @@ -71,11 +71,12 @@ class AggregateController(object): try: aggregate = self.api.create_aggregate(context, name, avail_zone) - except (exception.AggregateNameExists, - exception.InvalidAggregateAction): - LOG.info(_("Cannot create aggregate with name %(name)s and " - "availability zone %(avail_zone)s") % locals()) + except exception.AggregateNameExists as e: + LOG.info(e) raise exc.HTTPConflict + except exception.InvalidAggregateAction as e: + LOG.info(e) + raise return self._marshall_aggregate(aggregate) def show(self, req, id): -- cgit