X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-database.git/blobdiff_plain/e2d288987a8ed40aea40f8c8ac01efeb3749719f..e8e9ad0a0d67dc92899a499ab42dccae285d76ba:/python/database/models.py?ds=sidebyside diff --git a/python/database/models.py b/python/database/models.py index 6b53a2a..067f9ca 100644 --- a/python/database/models.py +++ b/python/database/models.py @@ -5,8 +5,8 @@ from sqlalchemy.orm import create_session, relation from sqlalchemy.ext.sessioncontext import SessionContext from sqlalchemy.ext.assignmapper import assign_mapper -from record import * -from owner import Owner +from invirt.database import record +from invirt.database.owner import Owner __all__ = ['meta', 'session', @@ -53,7 +53,8 @@ nic_table = Table('nics', meta, Column('machine_id', Integer, ForeignKey('machines.machine_id'), nullable=True), Column('mac_addr', String, nullable=False, primary_key=True), Column('ip', String, nullable=False, unique=True), - Column('hostname', String, nullable=True)) + Column('hostname', String, nullable=True), + Column('reusable', Boolean, nullable=False, default=True)) disk_table = Table('disks', meta, Column('machine_id', Integer, ForeignKey('machines.machine_id'), nullable=False), @@ -101,28 +102,28 @@ machine_access_table = Table('machine_access', meta, Column('user', String, nullable=False, index=True), PrimaryKeyConstraint('machine_id', 'user')) -class Machine(Record): +class Machine(record.Record): _identity_field = 'name' -class MachineAccess(Record): +class MachineAccess(record.Record): pass -class NIC(Record): +class NIC(record.Record): pass -class Disk(Record): +class Disk(record.Record): pass -class Type(Record): +class Type(record.Record): _identity_field = 'type_id' -class Mirror(Record): +class Mirror(record.Record): _identity_field = 'mirror_id' -class CDROM(Record): +class CDROM(record.Record): _identity_field = 'cdrom_id' -class Autoinstall(Record): +class Autoinstall(record.Record): _identity_field = 'autoinstall_id' session.mapper(Machine, machine_table,