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 notifications for VM destroy, Cloud Volume and Cloud Volume Snapshot actions #85

Merged
merged 5 commits into from Oct 24, 2017
Merged

Add notifications for VM destroy, Cloud Volume and Cloud Volume Snapshot actions #85

merged 5 commits into from Oct 24, 2017

Conversation

petrblaho
Copy link

This adds generic with_notification method to be used to wrap call for fog-openstack actions.

@@ -8,7 +8,14 @@ module ManageIQ::Providers::Openstack::CloudManager::Vm::Operations

def raw_destroy
raise "VM has no #{ui_lookup(:table => "ext_management_systems")}, unable to destroy VM" unless ext_management_system
with_provider_object(&:destroy)
with_notification(:vm_destroy,
:options => {
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the PR, the approach looks good to me.

I think, :instance_name => ... should not be wrapped in :options => ...

Copy link
Author

Choose a reason for hiding this comment

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

In fact it should - with_notification uses keyword parameter :options not the ruby "options hash".

Copy link
Member

Choose a reason for hiding this comment

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

Ah, thanks, I forgot about this Ruby 2.0 update.

@petrblaho petrblaho changed the title [WIP] Add notifications Add notifications for VM destroy, Cloud Volume and Cloud Volume Snapshot actions Sep 22, 2017
@miq-bot miq-bot removed the wip label Sep 22, 2017
@miq-bot
Copy link
Member

miq-bot commented Oct 17, 2017

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

Adds with_notification method witch unifies the usage of Notifications
Uses ActiveSupport::Concern with HelperMethods
@tzumainn tzumainn closed this Oct 23, 2017
@tzumainn tzumainn reopened this Oct 23, 2017
@tzumainn
Copy link
Contributor

looks like the hash alignment issues are a false positive caused by a nested hash.

@tzumainn
Copy link
Contributor

I thought that re-running the tests might pass CI, but it looks like it doesn't. Do the notifications need the _success or _error suffix, or are those supposed to be automatically determined?

@petrblaho
Copy link
Author

@tzumainn w/r/t _success and _error suffixes - notification type definition do not need these but it is now convention to have (usually) pair of notifications. We have now definition for our notification there and they are with these suffixes. with_notification currently wraps some other call (fog-openstack) and fires up either success or error notification depending on the outcome and it handles adding _success and _error suffixes.

w/r/t failing tests I forgot to add NotificationType.seed to appropriate spec files.

Petr Blaho added 4 commits October 24, 2017 13:49
Also moves including HelperMethods module to main vm.rb file.
Adds notifications for attach, detach, create, update, and
delete actions on Cloud Volume.
@miq-bot
Copy link
Member

miq-bot commented Oct 24, 2017

Checked commits https://github.com/petrblaho/manageiq-providers-openstack/compare/69ed2fa2cd324490532c0f042847711576e7deb2~...f279591d7be2261092ebd70afdb18bd253dacb8c with ruby 2.3.3, rubocop 0.47.1, and haml-lint 0.20.0
9 files checked, 4 offenses detected

app/models/manageiq/providers/openstack/cloud_manager/cloud_volume/operations.rb

  • ❗ - Line 14, Col 25 - Style/AlignHash - Align the elements of a hash literal if they span more than one line.
  • ❗ - Line 26, Col 25 - Style/AlignHash - Align the elements of a hash literal if they span more than one line.

app/models/manageiq/providers/openstack/cloud_manager/cloud_volume_snapshot.rb

@@ -8,6 +8,8 @@
config.cassette_library_dir = File.join(ManageIQ::Providers::Openstack::Engine.root, 'spec/vcr_cassettes')
end

NotificationType.seed
Copy link
Member

@aufi aufi Oct 24, 2017

Choose a reason for hiding this comment

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

This should be moved to https://github.com/ManageIQ/manageiq/blob/master/lib/evm_database.rb in following PR, no merge blocker. Otherwise LGTM.

@aufi aufi merged commit a263778 into ManageIQ:master Oct 24, 2017
@aufi aufi added this to the Sprint 72 Ending Oct 30, 2017 milestone Oct 24, 2017
@Loicavenel
Copy link

@petrblaho I did not see this PR before but we should not call Destroy in CF but Delete.

@mansam
Copy link
Contributor

mansam commented Aug 9, 2018

@petrblaho @aufi do you know if it would be possible to backport this and ManageIQ/manageiq#15900 to Fine in order to fix https://bugzilla.redhat.com/show_bug.cgi?id=1524356?

@aufi
Copy link
Member

aufi commented Aug 10, 2018

It should be possible IMO (not sure about Seed in spec, but that's just a test).

@mansam
Copy link
Contributor

mansam commented Aug 10, 2018

Marked fine/yes. Needs to be backported for https://bugzilla.redhat.com/show_bug.cgi?id=1524356

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.

None yet

6 participants