From cd0c765ced2823c05b16126d6ba6a823bb66fe7d Mon Sep 17 00:00:00 2001 From: Eric Windisch Date: Thu, 17 Jan 2013 15:38:02 -0500 Subject: Use oslo database code Bring in the new database code from oslo. Uses get_session() from oslo as well as changing NovaBase to derive from a common class. Remove test_sqlalchemy.py now that this code is test in oslo. Implements blueprint db-common. Change-Id: I090754981c871250dd981cbbe1a08e7181440120 --- bin/nova-manage | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'bin') diff --git a/bin/nova-manage b/bin/nova-manage index 82edf7389..c793fed16 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -80,6 +80,7 @@ from nova.db import migration from nova import exception from nova.openstack.common import cfg from nova.openstack.common import cliutils +from nova.openstack.common.db.sqlalchemy import session as db_session from nova.openstack.common import importutils from nova.openstack.common import log as logging from nova.openstack.common import rpc @@ -831,7 +832,7 @@ class InstanceTypeCommands(object): except exception.InstanceTypeNotFound: print _("Valid instance type name is required") sys.exit(1) - except exception.DBError, e: + except db_session.DBError, e: print _("DB Error: %s") % e sys.exit(2) except Exception: @@ -848,7 +849,7 @@ class InstanceTypeCommands(object): inst_types = instance_types.get_all_types() else: inst_types = instance_types.get_instance_type_by_name(name) - except exception.DBError, e: + except db_session.DBError, e: _db_error(e) if isinstance(inst_types.values()[0], dict): for k, v in inst_types.iteritems(): @@ -879,7 +880,7 @@ class InstanceTypeCommands(object): ext_spec) print _("Key %(key)s set to %(value)s on instance" " type %(name)s") % locals() - except exception.DBError, e: + except db_session.DBError, e: _db_error(e) @args('--name', dest='name', metavar='', @@ -902,7 +903,7 @@ class InstanceTypeCommands(object): key) print _("Key %(key)s on instance type %(name)s unset") % locals() - except exception.DBError, e: + except db_session.DBError, e: _db_error(e) -- cgit