~sandy-walsh/nova/api-parity

« back to all changes in this revision

Viewing changes to nova/db/sqlalchemy/models.py

  • Committer: Sandy Walsh
  • Date: 2011-01-11 06:47:35 UTC
  • mfrom: (515.3.28 nova)
  • Revision ID: sandy.walsh@rackspace.com-20110111064735-ws352hz2hb2tj2fk
Changed shared_ip_group detail routing

Show diffs side-by-side

added added

removed removed

Lines of Context:
540
540
    host = Column(String(255))  # , ForeignKey('hosts.id'))
541
541
 
542
542
 
 
543
class ConsolePool(BASE, NovaBase):
 
544
    """Represents pool of consoles on the same physical node."""
 
545
    __tablename__ = 'console_pools'
 
546
    id = Column(Integer, primary_key=True)
 
547
    address = Column(String(255))
 
548
    username = Column(String(255))
 
549
    password = Column(String(255))
 
550
    console_type = Column(String(255))
 
551
    public_hostname = Column(String(255))
 
552
    host = Column(String(255))
 
553
    compute_host = Column(String(255))
 
554
 
 
555
 
 
556
class Console(BASE, NovaBase):
 
557
    """Represents a console session for an instance."""
 
558
    __tablename__ = 'consoles'
 
559
    id = Column(Integer, primary_key=True)
 
560
    instance_name = Column(String(255))
 
561
    instance_id = Column(Integer)
 
562
    password = Column(String(255))
 
563
    port = Column(Integer, nullable=True)
 
564
    pool_id = Column(Integer, ForeignKey('console_pools.id'))
 
565
    pool = relationship(ConsolePool, backref=backref('consoles'))
 
566
 
 
567
 
543
568
def register_models():
544
569
    """Register Models and create metadata.
545
570
 
552
577
              Volume, ExportDevice, IscsiTarget, FixedIp, FloatingIp,
553
578
              Network, SecurityGroup, SecurityGroupIngressRule,
554
579
              SecurityGroupInstanceAssociation, AuthToken, User,
555
 
              Project, Certificate)  # , Image, Host
 
580
              Project, Certificate, ConsolePool, Console)  # , Image, Host
556
581
    engine = create_engine(FLAGS.sql_connection, echo=False)
557
582
    for model in models:
558
583
        model.metadata.create_all(engine)