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

Fix event linking to a disconnected VM #16907

Merged

Conversation

agrare
Copy link
Member

@agrare agrare commented Jan 29, 2018

When linking events to a VM we first try [ems_id, ems_ref] which fails
to find a disconnected VM because the ems_id is nullified. Next we try
by uid_ems but no one was setting the field that we were using so this
standardizes on an event key :vm_uid_ems (similar to :vm_location) which
can be set by the EventParser to allow events to be connected to VMs
after they are disconnected.

Depends:

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1538996

@agrare
Copy link
Member Author

agrare commented Jan 29, 2018

I tried to find where we set event[:full_data][:vm][:uid_ems], it was added by @gmcculloug in 6af4509506a528b68595acb273b2fff8996216b7 (need historical_root, commit from 2009)

+  def add_vm_event(event_type, vm, data=nil)
+    event = {:vm => {:path => vm[:location], :name=>vm[:name], :uid_ems=>vm[:uid_ems]}, :data => data}

But we don't initialize event hashes like this anymore so I think it is safe to change to something more standard. If we want to be extra safe I can just do:

event.fetch_path(:full_data, :vm, :uid_ems) || event[:vm_uid_ems]

@agrare agrare force-pushed the bz_1538996_vm_destroy_event_missing branch from 07f0d22 to f1e873b Compare January 29, 2018 20:18
When linking events to a VM we first try [ems_id, ems_ref] which fails
to find a disconnected VM because the ems_id is nullified.  Next we try
by uid_ems but no one was setting the field that we were using so this
standardizes on an event key :vm_uid_ems (similar to :vm_location) which
can be set by the EventParser to allow events to be connected to VMs
after they are disconnected.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1538996
@agrare agrare force-pushed the bz_1538996_vm_destroy_event_missing branch from f1e873b to 5bea3d8 Compare January 29, 2018 20:56
@miq-bot
Copy link
Member

miq-bot commented Jan 29, 2018

Checked commit agrare@5bea3d8 with ruby 2.3.3, rubocop 0.52.0, haml-lint 0.20.0, and yamllint 1.10.0
2 files checked, 0 offenses detected
Everything looks fine. 🏆

@blomquisg blomquisg merged commit 4f06547 into ManageIQ:master Feb 7, 2018
@agrare agrare deleted the bz_1538996_vm_destroy_event_missing branch February 7, 2018 21:52
@simaishi
Copy link
Contributor

simaishi commented Feb 9, 2018

gaprindashvili/yes ?

@agrare agrare added this to the Sprint 79 Ending Feb 12, 2018 milestone Feb 23, 2018
simaishi pushed a commit that referenced this pull request Mar 7, 2018
@simaishi
Copy link
Contributor

simaishi commented Mar 7, 2018

Gaprindashvili backport details:

$ git log -1
commit 679eef556990e5254e415bd16e808639deb3083e
Author: Greg Blomquist <[email protected]>
Date:   Wed Feb 7 16:50:36 2018 -0500

    Merge pull request #16907 from agrare/bz_1538996_vm_destroy_event_missing
    
    Fix event linking to a disconnected VM
    (cherry picked from commit 4f0654726ad03a9dbed829d4194791e0be3117f5)
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1552677

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.

4 participants