manageiq icon indicating copy to clipboard operation
manageiq copied to clipboard

[WIP] Normalize event_where_clause to return relations for EventStream subclasses

Open jrafanie opened this issue 4 years ago • 3 comments

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
  • [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) and MiqEvent.where(:physical_switch_id => id)
  • [ ] Update callers to use the new interface for event_where_clause: ["ems_id = ?", 1] is now EmsEvent.where(:ems_id => 1)

jrafanie avatar Dec 02 '21 18:12 jrafanie

Checked commits https://github.com/jrafanie/manageiq/compare/c33b4dfece8b2b4f0a951ff4c69d774c0ccf7c95~...df760c98ae95ee6d4820eddf703d9ec252f548e2 with ruby 2.6.3, rubocop 1.13.0, haml-lint 0.35.0, and yamllint 19 files checked, 0 offenses detected Everything looks fine. :star:

miq-bot avatar Dec 21 '21 16:12 miq-bot

Think we are missing ids in event streams because we tend to avoid db migrations, so we are missing the columns for newer classes

kbrock avatar Dec 21 '21 17:12 kbrock

too bad this lost steam. Was really excited about this PR. (though guess we have bigger initiatives at this time)

kbrock avatar Feb 28 '22 21:02 kbrock

This pull request is not mergeable. Please rebase and repush.

miq-bot avatar Feb 22 '23 23:02 miq-bot

I think this is largely replaced by #22388 and https://github.com/ManageIQ/manageiq/pull/22361

jrafanie avatar Mar 14 '23 18:03 jrafanie