-
Notifications
You must be signed in to change notification settings - Fork 92
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
Improve Targeted Refresh for Cloud and Network managers #175
Improve Targeted Refresh for Cloud and Network managers #175
Conversation
# @param ems_event [EmsEvent] EmsEvent object | ||
# @return [Array] Array of ManagerRefresh::Target objects | ||
def parse_ems_event_targets(ems_event) | ||
target_collection = ManagerRefresh::TargetCollection.new(:manager => ems_event.ext_management_system, :event => ems_event) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, the separate event catcher for network manager complicates stuff.
I think we need to set here parent_manager:
ManagerRefresh::TargetCollection.new(:manager => ems_event.ext_management_system.parent_manager, :event => ems_event)
Since all of the targeted refresh runs in the cloud manager and the targets are bucketed based on manager. Storage wise, this doesn't matter, since each persistor assigns the right manager for saving. So this is more for which ems and therefore worker should process it.
@mansam so for But if we could base it on generic definition like https://github.com/openstack/ceilometer/blob/master/ceilometer/pipeline/data/event_definitions.yaml, that would be awesome. That would mean it will work for more events than defined in our automate. |
@Ladas @aufi The list of events from manageiq-content is very helpful, but unfortunately I'm not sure it's sufficient. If I understand correctly, we capture events from Ceilometer, and Ceilometer changes the format of the events from the actual services quite a bit. Without more detail about the actual event definitions we get from Ceilometer it's not really possible to parse the events (since I don't know what fields are available, and they are not consistently named), and not every event in manageiq-content has an equivalent in the default Ceilometer event definition yaml. I've done a lot of looking over the past couple days and in the past when first working on this and am coming up empty handed for better documentation. (as a concrete example-- what are the fields on the |
a202ee8
to
e016c56
Compare
@mansam right so, AWS has no docs for the event payloads, so what I ended up doing was
Then I was clicking around, recording the real events. Then I am using the payload of the real events for the specs, to make sure I am parsing the right targets. Also, for CloudWatch events, the ids are in a form of "instance_id, image_id", so I don't even care what kind of event it is. Any event referencing instance_id, will produce VM target. So yeah, if the event payloads are different in AMQP/Ceilometer/WhatIsTheNewServiceName, than this kind of sucks. The AWS has similar issue, sometimes the event has VpcID, other times vpcId https://github.com/Ladas/manageiq-providers-amazon/blob/4c66893fd1a91dc5fd3aa259a7c0ddd044c65576/app/models/manageiq/providers/amazon/cloud_manager/event_target_parser.rb#L96 |
@Ladas Hrm, good point that if the IDs are named in a recognizable fashion then it doesn't matter at all what event it came from. |
5875a5e
to
4209c87
Compare
This pull request is not mergeable. Please rebase and repush. |
b401bf4
to
6ba0a3b
Compare
fc910da
to
4437dd7
Compare
This pull request is not mergeable. Please rebase and repush. |
@mansam, can you rebase and repush? |
4437dd7
to
9b4dbfd
Compare
Some comments on commits mansam/manageiq-providers-openstack@6a91a7e~...9b4dbfd spec/models/manageiq/providers/openstack/cloud_manager/event_target_parser_spec.rb
spec/models/manageiq/providers/openstack/network_manager/event_target_parser_spec.rb
|
Checked commits mansam/manageiq-providers-openstack@6a91a7e~...9b4dbfd with ruby 2.3.3, rubocop 0.47.1, haml-lint 0.20.0, and yamllint 1.10.0 **
|
@blomquisg updated |
@Ladas, do you still have outstanding changes you're looking for? If not, can you clear/change your review? |
ManageIQ::Providers::Openstack::CloudManager::RefreshParser.ems_inv_to_hashes(ems, refresher_options) | ||
end | ||
|
||
class Openstack::CloudManager::Refresher < ManageIQ::Providers::BaseManager::ManagerRefresher | ||
def save_inventory(ems, target, inventory_collections) | ||
super | ||
EmsRefresh.queue_refresh(ems.network_manager) if target.kind_of?(ManageIQ::Providers::BaseManager) | ||
EmsRefresh.queue_refresh(ems.cinder_manager) if target.kind_of?(ManageIQ::Providers::BaseManager) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so maybe, we will have to do a cinder full refresh always here, we should track that as a separate issue though
@@ -3,15 +3,15 @@ module Openstack | |||
module RefreshParserCommon | |||
module HelperMethods | |||
def openstack_admin? | |||
::Settings.ems.ems_refresh.openstack.try(:is_admin) | |||
::Settings.ems_refresh.openstack.try(:is_admin) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a nit for other PR probably:
we usually abstract ::Settings.ems_refresh.openstack
as a method , in new refresh parser it available on collector https://github.com/Ladas/manageiq/blob/b9e6b294604d744f59e3bf270e16264f067fb85a/app/models/manager_refresh/inventory/collector.rb#L11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that it should be abstracted out in the future.
@@ -49,16 +49,16 @@ | |||
|
|||
assert_common | |||
end | |||
::Settings.ems.ems_refresh.openstack.is_admin = false | |||
::Settings.ems.ems_refresh.openstack_network.is_admin = false | |||
::Settings.ems_refresh.openstack.is_admin = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as commented in other PR, this should use
Best to clean them all up in a refactoring PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. 👍
@mansam I have commented several nits though, that should be fixed in other PRs.
Also for other PRs, seems like we are mostly doing API query for 1 target, so we should talk about how to optimize that and probably set upper limit of targets for now, before we would switch to full refresh. (we do not need it for AWS since there is 1 API for N targets)
Also, it's good to read the targeted VCRs to verify it collects what it should. In targeted_vm I see we collect the same port several times. Also we fetch all subnets,
so API filtering probably doesn't work. (these are minor perf issues though)
@Ladas Thanks for the review. In the future for APIs that support filtering correctly, it might make sense to make a list request that is filtered by the desired IDs. Unfortunately filtering doesn't seem to be supported everywhere (like networking, it seems). |
LGTM, merging! |
Improve Targeted Refresh for Cloud and Network managers (cherry picked from commit 92aed61) https://bugzilla.redhat.com/show_bug.cgi?id=1533225
Gaprindashvili backport details:
|
https://bugzilla.redhat.com/show_bug.cgi?id=1519214
I'm basing the events I catch on ceilometer event definitions, but I'm not sure that I have a complete list. @aufi, do you know if there is a better source than https://github.com/openstack/ceilometer/blob/master/ceilometer/pipeline/data/event_definitions.yaml ?