Merge "replaced e.message with unicode(e)"

This commit is contained in:
Jenkins 2013-10-29 17:05:15 +00:00 committed by Gerrit Code Review
commit d713c46f10
3 changed files with 9 additions and 9 deletions

View File

@ -63,7 +63,7 @@ class SecurityGroupAPI(security_group_base.SecurityGroupBase):
# quota # quota
raise exc.HTTPBadRequest() raise exc.HTTPBadRequest()
elif e.status_code == 409: elif e.status_code == 409:
self.raise_over_quota(e.message) self.raise_over_quota(unicode(e))
raise exc_info[0], exc_info[1], exc_info[2] raise exc_info[0], exc_info[1], exc_info[2]
return self._convert_to_nova_security_group_format(security_group) return self._convert_to_nova_security_group_format(security_group)
@ -131,7 +131,7 @@ class SecurityGroupAPI(security_group_base.SecurityGroupBase):
exc_info = sys.exc_info() exc_info = sys.exc_info()
if e.status_code == 404: if e.status_code == 404:
LOG.debug(_("Neutron security group %s not found"), name) LOG.debug(_("Neutron security group %s not found"), name)
self.raise_not_found(e.message) self.raise_not_found(unicode(e))
else: else:
LOG.error(_("Neutron Error: %s"), e) LOG.error(_("Neutron Error: %s"), e)
raise exc_info[0], exc_info[1], exc_info[2] raise exc_info[0], exc_info[1], exc_info[2]
@ -176,9 +176,9 @@ class SecurityGroupAPI(security_group_base.SecurityGroupBase):
except n_exc.NeutronClientException as e: except n_exc.NeutronClientException as e:
exc_info = sys.exc_info() exc_info = sys.exc_info()
if e.status_code == 404: if e.status_code == 404:
self.raise_not_found(e.message) self.raise_not_found(unicode(e))
elif e.status_code == 409: elif e.status_code == 409:
self.raise_invalid_property(e.message) self.raise_invalid_property(unicode(e))
else: else:
LOG.error(_("Neutron Error: %s"), e) LOG.error(_("Neutron Error: %s"), e)
raise exc_info[0], exc_info[1], exc_info[2] raise exc_info[0], exc_info[1], exc_info[2]
@ -202,11 +202,11 @@ class SecurityGroupAPI(security_group_base.SecurityGroupBase):
if e.status_code == 404: if e.status_code == 404:
LOG.exception(_("Neutron Error getting security group %s"), LOG.exception(_("Neutron Error getting security group %s"),
name) name)
self.raise_not_found(e.message) self.raise_not_found(unicode(e))
elif e.status_code == 409: elif e.status_code == 409:
LOG.exception(_("Neutron Error adding rules to security " LOG.exception(_("Neutron Error adding rules to security "
"group %s"), name) "group %s"), name)
self.raise_over_quota(e.message) self.raise_over_quota(unicode(e))
else: else:
LOG.exception(_("Neutron Error:")) LOG.exception(_("Neutron Error:"))
raise exc_info[0], exc_info[1], exc_info[2] raise exc_info[0], exc_info[1], exc_info[2]
@ -273,7 +273,7 @@ class SecurityGroupAPI(security_group_base.SecurityGroupBase):
exc_info = sys.exc_info() exc_info = sys.exc_info()
if e.status_code == 404: if e.status_code == 404:
LOG.debug(_("Neutron security group rule %s not found"), id) LOG.debug(_("Neutron security group rule %s not found"), id)
self.raise_not_found(e.message) self.raise_not_found(unicode(e))
else: else:
LOG.error(_("Neutron Error: %s"), e) LOG.error(_("Neutron Error: %s"), e)
raise exc_info[0], exc_info[1], exc_info[2] raise exc_info[0], exc_info[1], exc_info[2]

View File

@ -3966,7 +3966,7 @@ class LibvirtDriver(driver.ComputeDriver):
ret = self._conn.compareCPU(cpu.to_xml(), 0) ret = self._conn.compareCPU(cpu.to_xml(), 0)
except libvirt.libvirtError as e: except libvirt.libvirtError as e:
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
ret = e.message ret = unicode(e)
LOG.error(m, {'ret': ret, 'u': u}) LOG.error(m, {'ret': ret, 'u': u})
if ret <= 0: if ret <= 0:

View File

@ -306,7 +306,7 @@ class API(base.Base):
item = cinderclient(context).volumes.create(size, **kwargs) item = cinderclient(context).volumes.create(size, **kwargs)
return _untranslate_volume_summary_view(context, item) return _untranslate_volume_summary_view(context, item)
except cinder_exception.BadRequest as e: except cinder_exception.BadRequest as e:
raise exception.InvalidInput(reason=e.message) raise exception.InvalidInput(reason=unicode(e))
@translate_volume_exception @translate_volume_exception
def delete(self, context, volume_id): def delete(self, context, volume_id):