[WIP] Normalize event_where_clause to return relations for EventStream subclasses
Note: This is WIP. The goal is to be able to get EventStream results for a specific Vm, Template, Host, etc. or just the EmsEvents or just the MiqEvents.
TODO:
- [ ] Figure out what to do with policy_events (did we really want to get PolicyEvent records or were we really interested in event_streams of the MiqEvent type?
- [ ] Some classes are implemented strangely:
- [ ] Storage, ContainerImage, ResourcePool:
- Do NOT have _id columns in event_streams
- Do NOT include EventMixin
- Are included in MiqEvent::SUPPORTED_POLICY_AND_ALERT_CLASSES
- [ ] AvailabilityZone, Container, PhysicalChassis, PhysicalSwitch
- Do have id columns in event_streams
- Do include EventMixin
- Are NOT included in MiqEvent::SUPPORTED_POLICY_AND_ALERT_CLASSES
- [ ] Storage, ContainerImage, ResourcePool:
- [x] Refactor the common cases where event_where_clause looks for class's _id column in event_streams. For example: PhysicalSwitch has a physical_switch_id column in EventStream so it's easy to default to do
EmsEvent.where(:physical_switch_id => id)andMiqEvent.where(:physical_switch_id => id) - [ ] Update callers to use the new interface for event_where_clause:
["ems_id = ?", 1]is nowEmsEvent.where(:ems_id => 1)
Think we are missing ids in event streams because we tend to avoid db migrations, so we are missing the columns for newer classes
too bad this lost steam. Was really excited about this PR. (though guess we have bigger initiatives at this time)
I think this is largely replaced by #22388 and https://github.com/ManageIQ/manageiq/pull/22361