~rlane/nova/lp773690

« back to all changes in this revision

Viewing changes to nova/api/openstack/common.py

  • Committer: rlane at wikimedia
  • Date: 2011-04-29 22:30:40 UTC
  • mfrom: (382.1.655 nova)
  • Revision ID: rlane@wikimedia.org-20110429223040-i0x3ds9eqwrabyru
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
from nova import wsgi
26
26
 
27
27
 
28
 
LOG = logging.getLogger('common')
 
28
LOG = logging.getLogger('nova.api.openstack.common')
29
29
 
30
30
 
31
31
FLAGS = flags.FLAGS
116
116
        items = image_service.index(context)
117
117
    for image in items:
118
118
        image_id = image['id']
119
 
        if abs(hash(image_id)) == int(image_hash):
120
 
            return image_id
121
 
    raise exception.NotFound(image_hash)
 
119
        try:
 
120
            if abs(hash(image_id)) == int(image_hash):
 
121
                return image_id
 
122
        except ValueError:
 
123
            msg = _("Requested image_id has wrong format: %s,"
 
124
                    "should have numerical format") % image_id
 
125
            LOG.error(msg)
 
126
            raise Exception(msg)
 
127
    raise exception.ImageNotFound(image_id=image_hash)
122
128
 
123
129
 
124
130
def get_id_from_href(href):