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

Implement VMware Cloud EventCatcher backend #11362

Merged

Conversation

@miha-plesko
Copy link
Contributor

miha-plesko commented Sep 19, 2016

This patch implements whole EventCatcher backend that connects to RabbitMQ where VMware Cloud Director drops notifications. Any registered event (i.e. if a fixture in 'System/Event/EmsEvent/VMWARE-VCLOUD.class' exists) triggers a full refresh of the ems.

This PR is a result of discussion from PR#10274.

Links [Optional]

Steps for Testing/QA [Optional]

Since GUI form to input Rabbit credentials is not yet implemented, one must create ems from Rails CLI as shown in this file.

Note that vCD installation must be configured to support event capturing thru RabbitMQ as described in this document.

require 'thread'

# Listens to RabbitMQ events
class ManageIQ::Providers::Vmware::CloudManager::EventCatcher::Stream

This comment has been minimized.

Copy link
@blomquisg

blomquisg Sep 27, 2016

Member

👍 definitely like this here ... better to have it namespaced and in the same place as the rest of the vmware cloud manager stuff.

app/models/manageiq/providers/vmware/cloud_manager/event_catcher/stream.rb Outdated
connection.start
return true
rescue Bunny::AuthenticationFailureError => e
$log.info("#{log_prefix} Failed testing rabbit amqp connection: #{e.message}")

This comment has been minimized.

Copy link
@blomquisg

blomquisg Sep 27, 2016

Member

The $log references should now switch to _log in order to reference the logger for evm.log. The $log from the OpenStack event monitor is somewhat of a vestige from back when we implemented some of the functionality outside of the main codebase and had to get global accessors to the logger.

This comment has been minimized.

Copy link
@blomquisg

blomquisg Sep 27, 2016

Member

... and I think you can drop the log_prefix everywhere as well, since _log should do that automatically for you.

You can learn more about the logging magic.

This comment has been minimized.

Copy link
@gberginc

gberginc Sep 28, 2016

Contributor

@blomquisg I had to add include Vmdb::Logging that was missing before and was also probably the reason why $log was used in the first place.

app/models/manageiq/providers/vmware/manager_events_mixin.rb Outdated
@@ -0,0 +1,30 @@
module ManageIQ::Providers::Vmware::ManagerEventsMixin

This comment has been minimized.

Copy link
@blomquisg

blomquisg Sep 27, 2016

Member

Push this down to the CloudManager namespace. There's a direct reference to the CloudManager below, which prevents this from being used by any other manager in vmware.

Also, I don't see the infra manager using AMQP for events, so I doubt it will ever be shared anyway.

This comment has been minimized.

Copy link
@blomquisg

blomquisg Sep 27, 2016

Member

Do the same for event_catcher_mixin...

miha-plesko and others added 2 commits Aug 5, 2016
This patch implements EventCatcher backend that connects to RabbitMQ
where VMware Cloud Director drops notifications. Any registered event
(i.e. if a fixture in 'System/Event/EmsEvent/VMWARE-VCLOUD.class' exists)
triggers a full refresh of the ems.

Signed-off-by: Miha Pleško <miha.plesko@xlab.si>
The `::Stream` class is now using the more commonly used `_log` instead
of `$log`. Explicit log prefixes were also removed in this patch.

This patch also moves the two mixins (`EventCatcherMixin` and
`MangerEventsMixin`) into VMware cloud manager namespace as they are
only used by the cloud provider.

Signed-off-by: Gregor Berginc <gregor.berginc@xlab.si>
@gberginc gberginc force-pushed the xlab-si:add_vmware_vcloud_event_catcher_full_refresh branch to a21e01e Sep 28, 2016
@miq-bot

This comment has been minimized.

Copy link
Member

miq-bot commented Sep 28, 2016

Checked commits xlab-si/manageiq@8be1054~...a21e01e with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1
11 files checked, 8 offenses detected

app/models/manageiq/providers/vmware/cloud_manager/event_catcher/runner.rb

app/models/manageiq/providers/vmware/cloud_manager/event_catcher/stream.rb

app/models/manageiq/providers/vmware/cloud_manager/event_catcher_mixin.rb

app/models/manageiq/providers/vmware/cloud_manager/event_parser.rb

app/models/manageiq/providers/vmware/manager_auth_mixin.rb

@gberginc

This comment has been minimized.

Copy link
Contributor

gberginc commented Sep 28, 2016

@blomquisg I have resolved your comments in a separate commit (a21e01e). I have tested the refresher using the procedure @miha-plesko suggested and it was successfully updating the provider after events were received from the vCloud provider (through RabittMQ).

@blomquisg blomquisg merged commit 066008e into ManageIQ:master Sep 28, 2016
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage decreased (-0.02%) to 36.723%
Details
@blomquisg blomquisg added the euwe/yes label Sep 29, 2016
chessbyte added a commit that referenced this pull request Sep 29, 2016
…r_full_refresh

Implement VMware Cloud EventCatcher backend
(cherry picked from commit 066008e)
@chessbyte

This comment has been minimized.

Copy link
Member

chessbyte commented Sep 29, 2016

Euwe Backport details:

$ git log
commit 4cbc9f4735a3e8d838572e1041ff217122d76375
Author: Greg Blomquist <blomquisg@gmail.com>
Date:   Wed Sep 28 10:44:56 2016 -0400

    Merge pull request #11362 from xlab-si/add_vmware_vcloud_event_catcher_full_refresh

    Implement VMware Cloud EventCatcher backend
    (cherry picked from commit 066008e96218948c8028a7d67a8b6e71b6fc526b)
@chessbyte chessbyte added euwe/backported and removed euwe/yes labels Sep 29, 2016
@tadeboro tadeboro deleted the xlab-si:add_vmware_vcloud_event_catcher_full_refresh branch Mar 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.