Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add alerts on container nodes #13323

Merged
merged 1 commit into from
Jan 11, 2017
Merged

Conversation

moolitayer
Copy link

@moolitayer moolitayer commented Dec 29, 2016

No description provided.

@moolitayer
Copy link
Author

@miq-bot add_label providers/containers, enhancement

@moolitayer
Copy link
Author

moolitayer commented Jan 4, 2017

@simon3z please review, this was not mentioned but is also required for next week's goal

@moolitayer moolitayer mentioned this pull request Jan 4, 2017
@simon3z
Copy link
Contributor

simon3z commented Jan 5, 2017

@moolitayer I assume we'll have more of these depending on what entities we can attach alerts to. Do we support nodes at this point?

@@ -19,6 +19,7 @@ class ContainerManager < BaseManager
has_many :container_build_pods, :foreign_key => :ems_id, :dependent => :destroy
has_many :container_templates, :foreign_key => :ems_id, :dependent => :destroy
has_one :container_deployment, :foreign_key => :deployed_ems_id, :inverse_of => :deployed_ems
has_many :miq_alert_statuses, :through => :container_nodes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@moolitayer I don't think this is optimal as we grow in number of entities supporting alerts. You should probably take all the MiqAlertStatuses that are related to this provider (not just the nodes ones).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can handle that when we add more entities?

What I was thinking of doing when we add more container entities that have miq_alert_statuses is writing custom code for the join that will look at multiple tables (I think conceptually join is the best solution here).

@kbrock is there a better solution? we will need a way to has_many through multiple tables basically.
(=== has_many :miq_alert_statuses, :through => [:container_nodes, :container_groups ...])

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I've got nothing here.
Either associate all alert statuses directly to the container (or container_node) or modify the table to add a manager_id - even if you could define this in an active record way, the performance would be terrible.

@moolitayer
Copy link
Author

@moolitayer I assume we'll have more of these depending on what entities we can attach alerts to. Do we support nodes at this point?

Right we will have more, see response to your code comment. We will support nodes after this pr (the actual collection bringing in miq_alert_statuses on nodes as well as code allowing to define miq_alerts on them is in #12773)

@moolitayer
Copy link
Author

@simon3z This is only to add the link now after suggested changes PTAL

@miq-bot
Copy link
Member

miq-bot commented Jan 10, 2017

Checked commit moolitayer@fb24cc7 with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1
1 file checked, 0 offenses detected
Everything looks good. 👍

@simon3z
Copy link
Contributor

simon3z commented Jan 10, 2017

@moolitayer I have the feeling we don't want to lose the alerts statuses when a resource disappears (:dependent => :destroy). Isn't it also containing all the history (I suppose that if you drop this you will also drop all the life-cycle history of actions related to the status).

@moolitayer
Copy link
Author

@simon3z note this is how miq_alerts_statuses are attached to all other objects in the system.

@blomquisg can you please point me to somewhere where we purge data that is not dependent destroy?

@simon3z
Copy link
Contributor

simon3z commented Jan 10, 2017

@simon3z note this is how miq_alerts_statuses are attached to all other objects in the system.

@moolitayer if we end up dropping the history when entities disappear (not suggesting to go that way, just saying) then we need it (at the very least) to be very well documented and understood by the end user.

@moolitayer
Copy link
Author

@simon3z Created #13430 to purge the alert statuses, we could remove the dependent destroy after that merges.
We should discuss what should show up on the screens at that point.

Are you ok with merging this one now?

@simon3z
Copy link
Contributor

simon3z commented Jan 11, 2017

LGTM 👍 cc @chessbyte
Assigning to @blomquisg for review/merge

@miq-bot assign blomquisg

@miq-bot miq-bot assigned blomquisg and unassigned simon3z Jan 11, 2017
Copy link
Member

@gtanzillo gtanzillo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 This seems fine

@gtanzillo gtanzillo added this to the Sprint 52 Ending Jan 16, 2017 milestone Jan 11, 2017
@gtanzillo gtanzillo merged commit 59e38cf into ManageIQ:master Jan 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants