added HasId to quark db models

This commit is contained in:
Trey Morris
2013-03-25 17:06:58 -05:00
parent 125f77ff71
commit e0f1285735
3 changed files with 6 additions and 4 deletions

View File

@@ -29,6 +29,8 @@ from quantum.openstack.common import timeutils
from quark.db import custom_types
HasId = models.HasId
LOG = logging.getLogger("quantum.quark.db.models")

View File

@@ -266,7 +266,7 @@ class OptimizedNVPDriver(NVPDriver):
return switches
class LSwitchPort(models.BASEV2, models.models.HasId):
class LSwitchPort(models.BASEV2, models.HasId):
__tablename__ = "quark_nvp_driver_lswitchport"
port_id = sa.Column(sa.String(255), nullable=False)
switch_id = sa.Column(sa.String(255),
@@ -274,7 +274,7 @@ class LSwitchPort(models.BASEV2, models.models.HasId):
nullable=False)
class LSwitch(models.BASEV2, models.models.HasId):
class LSwitch(models.BASEV2, models.HasId):
__tablename__ = "quark_nvp_driver_lswitch"
nvp_id = sa.Column(sa.String(255), nullable=False)
network_id = sa.Column(sa.String(255), nullable=False)

View File

@@ -81,10 +81,10 @@ class Plugin(quantum_plugin_base_v2.QuantumPluginBaseV2):
def __init__(self):
# NOTE(jkoelker) Register the event on all models that have ids
for _name, klass in inspect.getmembers(models, inspect.isclass):
if klass is models.models.HasId:
if klass is models.HasId:
continue
if models.models.HasId in klass.mro():
if models.HasId in klass.mro():
event.listen(klass, "init", perhaps_generate_id)
quantum_db_api.configure_db()