diff options
| author | Vishvananda Ishaya <vishvananda@gmail.com> | 2011-08-23 15:14:09 -0700 |
|---|---|---|
| committer | Vishvananda Ishaya <vishvananda@gmail.com> | 2011-08-23 15:14:09 -0700 |
| commit | da02fc6e4191bdbbb2015b78f9c3fe5045bb0460 (patch) | |
| tree | 1007e11a6b3f5f7203b0fe228d2e60547b456a02 /nova | |
| parent | 83856c9dd6e1f75e3db51574f3db2b4dc4922186 (diff) | |
| download | nova-da02fc6e4191bdbbb2015b78f9c3fe5045bb0460.tar.gz nova-da02fc6e4191bdbbb2015b78f9c3fe5045bb0460.tar.xz nova-da02fc6e4191bdbbb2015b78f9c3fe5045bb0460.zip | |
Fix not found exceptions to properly use ec2_ips for not found
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/api/ec2/__init__.py | 10 | ||||
| -rw-r--r-- | nova/exception.py | 1 |
2 files changed, 7 insertions, 4 deletions
diff --git a/nova/api/ec2/__init__.py b/nova/api/ec2/__init__.py index 5430f443d..363dad7cd 100644 --- a/nova/api/ec2/__init__.py +++ b/nova/api/ec2/__init__.py @@ -392,17 +392,19 @@ class Executor(wsgi.Application): except exception.InstanceNotFound as ex: LOG.info(_('InstanceNotFound raised: %s'), unicode(ex), context=context) - return self._error(req, context, type(ex).__name__, ex.message) + ec2_id = ec2utils.id_to_ec2_id(ex.kwargs['instance_id']) + message = ex.message % {'instance_id': ec2_id} + return self._error(req, context, type(ex).__name__, message) except exception.VolumeNotFound as ex: LOG.info(_('VolumeNotFound raised: %s'), unicode(ex), context=context) - ec2_id = ec2utils.id_to_ec2_vol_id(ex.volume_id) - message = _('Volume %s not found') % ec2_id + ec2_id = ec2utils.id_to_ec2_vol_id(ex.kwargs['volume_id']) + message = ex.message % {'volume_id': ec2_id} return self._error(req, context, type(ex).__name__, message) except exception.SnapshotNotFound as ex: LOG.info(_('SnapshotNotFound raised: %s'), unicode(ex), context=context) - ec2_id = ec2utils.id_to_ec2_snap_id(ex.snapshot_id) + ec2_id = ec2utils.id_to_ec2_snap_id(ex.kwargs['snapshot_id']) message = _('Snapshot %s not found') % ec2_id return self._error(req, context, type(ex).__name__, message) except exception.NotFound as ex: diff --git a/nova/exception.py b/nova/exception.py index 66740019b..5b86059d8 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -146,6 +146,7 @@ class NovaException(Exception): message = _("An unknown exception occurred.") def __init__(self, **kwargs): + self.kwargs = kwargs try: self._error_string = self.message % kwargs |
