~ubuntu-branches/ubuntu/quantal/nova/quantal-proposed

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Adam Gandelman, Adam Gandelman, Chuck Short
  • Date: 2012-08-27 15:37:18 UTC
  • mfrom: (1.1.60)
  • Revision ID: package-import@ubuntu.com-20120827153718-lj8er44eqqz1gsrj
Tags: 2012.2~rc1~20120827.15815-0ubuntu1
[ Adam Gandelman ]
* New upstream release.

[ Chuck Short ]
* debian/patches/0001-Update-tools-hacking-for-pep8-1.2-and-
  beyond.patch: Dropped we dont run pep8 tests anymore.
* debian/control: Drop pep8 build depends
* debian/*.upstart.in: Make sure we transition correctly from runlevel
  1 to 2. (LP: #820694)

Show diffs side-by-side

added added

removed removed

Lines of Context:
144
144
    # Free Ram, amount of activity (resize, migration, boot, etc) and
145
145
    # the number of running VM's are a good starting point for what's
146
146
    # important when making scheduling decisions.
147
 
    #
148
 
    # NOTE(sandy): We'll need to make this extensible for other schedulers.
149
147
    free_ram_mb = Column(Integer)
150
148
    free_disk_gb = Column(Integer)
151
149
    current_workload = Column(Integer)
165
163
    disk_available_least = Column(Integer)
166
164
 
167
165
 
 
166
class ComputeNodeStat(BASE, NovaBase):
 
167
    """Stats related to the current workload of a compute host that are
 
168
    intended to aid in making scheduler decisions."""
 
169
    __tablename__ = 'compute_node_stats'
 
170
    id = Column(Integer, primary_key=True)
 
171
    key = Column(String(511))
 
172
    value = Column(String(255))
 
173
    compute_node_id = Column(Integer, ForeignKey('compute_nodes.id'))
 
174
 
 
175
    primary_join = ('and_(ComputeNodeStat.compute_node_id == '
 
176
                    'ComputeNode.id, ComputeNodeStat.deleted == False)')
 
177
    stats = relationship("ComputeNode", backref="stats",
 
178
            primaryjoin=primary_join)
 
179
 
 
180
    def __str__(self):
 
181
        return "{%d: %s = %s}" % (self.compute_node_id, self.key, self.value)
 
182
 
 
183
 
168
184
class Certificate(BASE, NovaBase):
169
185
    """Represents a x509 certificate"""
170
186
    __tablename__ = 'certificates'
320
336
    rxtx_factor = Column(Float, nullable=False, default=1)
321
337
    vcpu_weight = Column(Integer, nullable=True)
322
338
    disabled = Column(Boolean, default=False)
 
339
    is_public = Column(Boolean, default=True)
323
340
 
324
341
    instances = relationship(Instance,
325
342
                           backref=backref('instance_type', uselist=False),
805
822
                            primaryjoin=primary_join)
806
823
 
807
824
 
 
825
class InstanceTypeProjects(BASE, NovaBase):
 
826
    """Represent projects associated instance_types"""
 
827
    __tablename__ = "instance_type_projects"
 
828
    id = Column(Integer, primary_key=True)
 
829
    instance_type_id = Column(Integer, ForeignKey('instance_types.id'),
 
830
                              nullable=False)
 
831
    project_id = Column(String(255))
 
832
 
 
833
    instance_type = relationship(InstanceTypes, backref="projects",
 
834
                 foreign_keys=instance_type_id,
 
835
                 primaryjoin='and_('
 
836
                 'InstanceTypeProjects.instance_type_id == InstanceTypes.id,'
 
837
                 'InstanceTypeProjects.deleted == False)')
 
838
 
 
839
 
808
840
class InstanceTypeExtraSpecs(BASE, NovaBase):
809
841
    """Represents additional specs as key/value pairs for an instance_type"""
810
842
    __tablename__ = 'instance_type_extra_specs'