<s> from oslo_db . sqlalchemy import models <EOL> from sqlalchemy import Boolean <EOL> from sqlalchemy import Column <EOL> from sqlalchemy import Enum <EOL> from sqlalchemy . ext . declarative import declarative_base <EOL> from sqlalchemy import Float <EOL> from sqlalchemy import ForeignKey <EOL> from sqlalchemy import Index <EOL> from sqlalchemy import Integer <EOL> from sqlalchemy import orm <EOL> from sqlalchemy . orm import backref <EOL> from sqlalchemy import schema <EOL> from sqlalchemy import String <EOL> from sqlalchemy import Text <EOL> from nova . db . sqlalchemy import types <EOL> class _NovaAPIBase ( models . ModelBase , models . TimestampMixin ) : <EOL> pass <EOL> API_BASE = declarative_base ( cls = _NovaAPIBase ) <EOL> class CellMapping ( API_BASE ) : <EOL> """<STR_LIT>""" <EOL> __tablename__ = '<STR_LIT>' <EOL> __table_args__ = ( Index ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> schema . UniqueConstraint ( '<STR_LIT>' , <EOL> name = '<STR_LIT>' ) ) <EOL> id = Column ( Integer , primary_key = True ) <EOL> uuid = Column ( String ( <NUM_LIT> ) , nullable = False ) <EOL> name = Column ( String ( <NUM_LIT:255> ) ) <EOL> transport_url = Column ( Text ( ) ) <EOL> database_connection = Column ( Text ( ) ) <EOL> host_mapping = orm . relationship ( '<STR_LIT>' , <EOL> backref = backref ( '<STR_LIT>' , uselist = False ) , <EOL> foreign_keys = id , <EOL> primaryjoin = ( <EOL> '<STR_LIT>' ) ) <EOL> class InstanceMapping ( API_BASE ) : <EOL> """<STR_LIT>""" <EOL> __tablename__ = '<STR_LIT>' <EOL> __table_args__ = ( Index ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> Index ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> schema . UniqueConstraint ( '<STR_LIT>' , <EOL> name = '<STR_LIT>' ) ) <EOL> id = Column ( Integer , primary_key = True ) <EOL> instance_uuid = Column ( String ( <NUM_LIT> ) , nullable = False ) <EOL> cell_id = Column ( Integer , ForeignKey ( '<STR_LIT>' ) , <EOL> nullable = True ) <EOL> project_id = Column ( String ( <NUM_LIT:255> ) , nullable = False ) <EOL> cell_mapping = orm . relationship ( '<STR_LIT>' , <EOL> backref = backref ( '<STR_LIT>' , uselist = False ) , <EOL> foreign_keys = cell_id , <EOL> primaryjoin = ( '<STR_LIT>' ) ) <EOL> class HostMapping ( API_BASE ) : <EOL> """<STR_LIT>""" <EOL> __tablename__ = "<STR_LIT>" <EOL> __table_args__ = ( Index ( '<STR_LIT>' , '<STR_LIT:host>' ) , <EOL> schema . UniqueConstraint ( '<STR_LIT:host>' , <EOL> name = '<STR_LIT>' ) ) <EOL> id = Column ( Integer , primary_key = True ) <EOL> cell_id = Column ( Integer , ForeignKey ( '<STR_LIT>' ) , <EOL> nullable = False ) <EOL> host = Column ( String ( <NUM_LIT:255> ) , nullable = False ) <EOL> class RequestSpec ( API_BASE ) : <EOL> """<STR_LIT>""" <EOL> __tablename__ = '<STR_LIT>' <EOL> __table_args__ = ( <EOL> Index ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> schema . UniqueConstraint ( '<STR_LIT>' , <EOL> name = '<STR_LIT>' ) , <EOL> ) <EOL> id = Column ( Integer , primary_key = True ) <EOL> instance_uuid = Column ( String ( <NUM_LIT> ) , nullable = False ) <EOL> spec = Column ( Text , nullable = False ) <EOL> build_request = orm . relationship ( '<STR_LIT>' , <EOL> back_populates = '<STR_LIT>' , <EOL> uselist = False , <EOL> primaryjoin = ( <EOL> '<STR_LIT>' ) ) <EOL> class Flavors ( API_BASE ) : <EOL> """<STR_LIT>""" <EOL> __tablename__ = '<STR_LIT>' <EOL> __table_args__ = ( <EOL> schema . UniqueConstraint ( "<STR_LIT>" , name = "<STR_LIT>" ) , <EOL> schema . UniqueConstraint ( "<STR_LIT:name>" , name = "<STR_LIT>" ) ) <EOL> id = Column ( Integer , primary_key = True ) <EOL> name = Column ( String ( <NUM_LIT:255> ) , nullable = False ) <EOL> memory_mb = Column ( Integer , nullable = False ) <EOL> vcpus = Column ( Integer , nullable = False ) <EOL> root_gb = Column ( Integer ) <EOL> ephemeral_gb = Column ( Integer ) <EOL> flavorid = Column ( String ( <NUM_LIT:255> ) , nullable = False ) <EOL> swap = Column ( Integer , nullable = False , default = <NUM_LIT:0> ) <EOL> rxtx_factor = Column ( Float , default = <NUM_LIT:1> ) <EOL> vcpu_weight = Column ( Integer ) <EOL> disabled = Column ( Boolean , default = False ) <EOL> is_public = Column ( Boolean , default = True ) <EOL> class FlavorExtraSpecs ( API_BASE ) : <EOL> """<STR_LIT>""" <EOL> __tablename__ = '<STR_LIT>' <EOL> __table_args__ = ( <EOL> Index ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:key>' ) , <EOL> schema . UniqueConstraint ( '<STR_LIT>' , '<STR_LIT:key>' , <EOL> name = '<STR_LIT>' ) , <EOL> { '<STR_LIT>' : '<STR_LIT>' } , <EOL> ) <EOL> id = Column ( Integer , primary_key = True ) <EOL> key = Column ( String ( <NUM_LIT:255> ) , nullable = False ) <EOL> value = Column ( String ( <NUM_LIT:255> ) ) <EOL> flavor_id = Column ( Integer , ForeignKey ( '<STR_LIT>' ) , nullable = False ) <EOL> flavor = orm . relationship ( Flavors , backref = '<STR_LIT>' , <EOL> foreign_keys = flavor_id , <EOL> primaryjoin = ( <EOL> '<STR_LIT>' ) ) <EOL> class FlavorProjects ( API_BASE ) : <EOL> """<STR_LIT>""" <EOL> __tablename__ = '<STR_LIT>' <EOL> __table_args__ = ( schema . UniqueConstraint ( '<STR_LIT>' , '<STR_LIT>' , <EOL> name = '<STR_LIT>' ) , ) <EOL> id = Column ( Integer , primary_key = True ) <EOL> flavor_id = Column ( Integer , ForeignKey ( '<STR_LIT>' ) , nullable = False ) <EOL> project_id = Column ( String ( <NUM_LIT:255> ) , nullable = False ) <EOL> flavor = orm . relationship ( Flavors , backref = '<STR_LIT>' , <EOL> foreign_keys = flavor_id , <EOL> primaryjoin = ( <EOL> '<STR_LIT>' ) ) <EOL> class BuildRequest ( API_BASE ) : <EOL> """<STR_LIT>""" <EOL> __tablename__ = '<STR_LIT>' <EOL> __table_args__ = ( <EOL> Index ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> schema . UniqueConstraint ( '<STR_LIT>' , <EOL> name = '<STR_LIT>' ) <EOL> ) <EOL> id = Column ( Integer , primary_key = True ) <EOL> request_spec_id = Column ( Integer , ForeignKey ( '<STR_LIT>' ) , <EOL> nullable = False ) <EOL> request_spec = orm . relationship ( RequestSpec , <EOL> foreign_keys = request_spec_id , <EOL> back_populates = '<STR_LIT>' , <EOL> primaryjoin = request_spec_id == RequestSpec . id ) <EOL> project_id = Column ( String ( <NUM_LIT:255> ) , nullable = False ) <EOL> user_id = Column ( String ( <NUM_LIT:255> ) , nullable = False ) <EOL> display_name = Column ( String ( <NUM_LIT:255> ) ) <EOL> instance_metadata = Column ( Text ) <EOL> progress = Column ( Integer ) <EOL> vm_state = Column ( String ( <NUM_LIT:255> ) ) <EOL> task_state = Column ( String ( <NUM_LIT:255> ) ) <EOL> image_ref = Column ( String ( <NUM_LIT:255> ) ) <EOL> access_ip_v4 = Column ( types . IPAddress ( ) ) <EOL> access_ip_v6 = Column ( types . IPAddress ( ) ) <EOL> info_cache = Column ( Text ) <EOL> security_groups = Column ( Text , nullable = False ) <EOL> config_drive = Column ( Boolean , default = False , nullable = False ) <EOL> key_name = Column ( String ( <NUM_LIT:255> ) ) <EOL> locked_by = Column ( Enum ( '<STR_LIT>' , '<STR_LIT>' ) ) </s>
