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',
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),
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,