Store all event data in DB
Fixes #64 Signed-off-by: Zane Bitter <zbitter@redhat.com>
This commit is contained in:
parent
c2ab4a39d1
commit
4993b5dfa0
@ -0,0 +1,24 @@
|
|||||||
|
from sqlalchemy import *
|
||||||
|
from migrate import *
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade(migrate_engine):
|
||||||
|
meta = MetaData(bind=migrate_engine)
|
||||||
|
event = Table('event', meta, autoload=True)
|
||||||
|
|
||||||
|
Column('logical_resource_id', String(255)).create(event)
|
||||||
|
Column('physical_resource_id', String(255)).create(event)
|
||||||
|
Column('resource_status_reason', String(255)).create(event)
|
||||||
|
Column('resource_type', String(255)).create(event)
|
||||||
|
Column('resource_properties', PickleType).create(event)
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade(migrate_engine):
|
||||||
|
meta = MetaData(bind=migrate_engine)
|
||||||
|
event = Table('event', meta, autoload=True)
|
||||||
|
|
||||||
|
event.c.logical_resource_id.drop()
|
||||||
|
event.c.physical_resource_id.drop()
|
||||||
|
event.c.resource_status_reason.drop()
|
||||||
|
event.c.resource_type.drop()
|
||||||
|
event.c.resource_properties.drop()
|
@ -144,6 +144,12 @@ class Event(BASE, HeatBase):
|
|||||||
backref=backref('events'), cascade="all, delete", passive_deletes=True)
|
backref=backref('events'), cascade="all, delete", passive_deletes=True)
|
||||||
|
|
||||||
name = Column(String)
|
name = Column(String)
|
||||||
|
logical_resource_id = Column(String)
|
||||||
|
physical_resource_id = Column(String)
|
||||||
|
resource_status_reason = Column(String)
|
||||||
|
resource_type = Column(String)
|
||||||
|
resource_properties = Column(PickleType)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Resource(BASE, HeatBase):
|
class Resource(BASE, HeatBase):
|
||||||
|
@ -181,12 +181,15 @@ class EngineManager(manager.Manager):
|
|||||||
|
|
||||||
def parse_event(e):
|
def parse_event(e):
|
||||||
s = e.stack
|
s = e.stack
|
||||||
# TODO Missing LogicalResourceId, PhysicalResourceId, ResourceType,
|
|
||||||
# ResourceStatusReason
|
|
||||||
return {'EventId': e.id,
|
return {'EventId': e.id,
|
||||||
'StackId': e.stack_id,
|
'StackId': e.stack_id,
|
||||||
'StackName': s.name,
|
'StackName': s.name,
|
||||||
'Timestamp': str(e.created_at),
|
'Timestamp': str(e.created_at),
|
||||||
'ResourceStatus': str(e.name)}
|
'LogicalResourceId': e.logical_resource_id,
|
||||||
|
'PhysicalResourceId': e.physical_resource_id,
|
||||||
|
'ResourceType': e.resource_type,
|
||||||
|
'ResourceStatusReason': e.resource_status_reason,
|
||||||
|
'ResourceProperties': e.resource_properties,
|
||||||
|
'ResourceStatus': e.name}
|
||||||
|
|
||||||
return {'events': [parse_event(e) for e in events]}
|
return {'events': [parse_event(e) for e in events]}
|
||||||
|
@ -20,8 +20,8 @@ except ImportError:
|
|||||||
'revision_id': 'LOCALREVISION',
|
'revision_id': 'LOCALREVISION',
|
||||||
'revno': 0}
|
'revno': 0}
|
||||||
|
|
||||||
GLANCE_VERSION = ['0.0', '1']
|
GLANCE_VERSION = ['0.0', '2']
|
||||||
COUNT, REVSISION = GLANCE_VERSION
|
COUNT, REVISION = GLANCE_VERSION
|
||||||
|
|
||||||
FINAL = False # This becomes true at Release Candidate time
|
FINAL = False # This becomes true at Release Candidate time
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user