summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Pepple <ken.pepple@gmail.com>2011-03-02 17:14:51 -0800
committerKen Pepple <ken.pepple@gmail.com>2011-03-02 17:14:51 -0800
commit507a13d8dcdc11ea7638c8904d6d0de22d8e109b (patch)
treef15ef02f0809e9f2c76e775fc1050252775a15a5
parent45662001c477bdce7cd50b4f7f67e06479c3cbd3 (diff)
downloadnova-507a13d8dcdc11ea7638c8904d6d0de22d8e109b.tar.gz
nova-507a13d8dcdc11ea7638c8904d6d0de22d8e109b.tar.xz
nova-507a13d8dcdc11ea7638c8904d6d0de22d8e109b.zip
added logging to instance_types for DB errors per code review
-rw-r--r--nova/compute/instance_types.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/nova/compute/instance_types.py b/nova/compute/instance_types.py
index 09b42f319..79c879e8e 100644
--- a/nova/compute/instance_types.py
+++ b/nova/compute/instance_types.py
@@ -24,10 +24,12 @@ The built-in instance properties.
from nova import context
from nova import db
-from nova import flags
from nova import exception
+from nova import flags
+from nova import log as logging
FLAGS = flags.FLAGS
+LOG = logging.getLogger('nova.instance_types')
def create(name, memory, vcpus, local_gb, flavorid, swap=0,
@@ -56,7 +58,8 @@ def create(name, memory, vcpus, local_gb, flavorid, swap=0,
swap=swap,
rxtx_quota=rxtx_quota,
rxtx_cap=rxtx_cap))
- except exception.DBError:
+ except exception.DBError, e:
+ LOG.exception(_('DB error: %s' % e))
raise exception.ApiError(_("Cannot create instance type: %s" % name))
@@ -69,6 +72,7 @@ def destroy(name):
try:
db.instance_type_destroy(context.get_admin_context(), name)
except exception.NotFound:
+ LOG.exception(_('Instance type %s not found for deletion' % name))
raise exception.ApiError(_("Unknown instance type: %s" % name))
@@ -81,6 +85,7 @@ def purge(name):
try:
db.instance_type_purge(context.get_admin_context(), name)
except exception.NotFound:
+ LOG.exception(_('Instance type %s not found for purge' % name))
raise exception.ApiError(_("Unknown instance type: %s" % name))
@@ -117,7 +122,8 @@ def get_by_type(instance_type):
ctxt = context.get_admin_context()
inst_type = db.instance_type_get_by_name(ctxt, instance_type)
return inst_type['name']
- except exception.DBError:
+ except exception.DBError, e:
+ LOG.exception(_('DB error: %s' % e))
raise exception.ApiError(_("Unknown instance type: %s" %\
instance_type))
@@ -130,5 +136,6 @@ def get_by_flavor_id(flavor_id):
ctxt = context.get_admin_context()
flavor = db.instance_type_get_by_flavor_id(ctxt, flavor_id)
return flavor['name']
- except exception.DBError:
+ except exception.DBError, e:
+ LOG.exception(_('DB error: %s' % e))
raise exception.ApiError(_("Unknown flavor: %s" % flavor_id))