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
This commit is contained in:
Eric Windisch
2013-01-17 15:38:02 -05:00
committed by Mark McLoughlin
parent d93538cb2e
commit 33b4bd2e42
7 changed files with 13 additions and 266 deletions

View File

@@ -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='<name>',
@@ -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)