コード例 #1
0
    def __str__(self):
        t = ""
        t += '<Command>['
        t += 'id:%s, ' % (self.id)
        t += 'command:%s, ' % (self.command)
        t += 'service_id:%s, ' % (self.service_id)
        t += 'service_instance_id:%s' % (self.service_instance_id)
        t += ']'
        return t


NetworkInstance_SecurityGroup = Table('NetworkInstance_SecurityGroup', Base.metadata,
                                      Column('Network_Instance_id', Integer, ForeignKey('Network_Instance.id', ondelete='SET NULL')),
                                      Column('SecurityGroup_id', Integer, ForeignKey('SecurityGroup.id', ondelete='SET NULL'))
)
NetworkInstance_SecurityGroup.__name__ = 'NetworkInstance_SecurityGroup'


class ServiceInstance(AbstractService, Base):
    __tablename__ = 'ServiceInstance'

    id = Column(Integer, primary_key=True)
    topology_id = Column(Integer, ForeignKey('Topology.id'))
    networks = relationship('Network_Instance', cascade="all, delete-orphan", lazy='immediate')
    policies = relationship('Policy', cascade="all, delete-orphan", lazy='select')
    requirements = relationship('Requirement', cascade="all, delete-orphan", lazy='select')
    units = relationship('Unit', cascade="all, delete-orphan", lazy='select')
    user_data = relationship('Command', cascade="all, delete-orphan", lazy='select')
    configuration = Column(PickleType)
    flavor_id = Column(Integer, ForeignKey('Flavor.id'))
    flavor = relationship('Flavor', cascade='save-update, merge, refresh-expire, expunge', lazy='select')