Bug 1169930

Summary: Update miq_ae_service_snapshot.rb with new relationship of vm_or_template
Product: Red Hat CloudForms Management Engine Reporter: Josh Carter <jocarter>
Component: AutomateAssignee: Greg McCullough <gmccullo>
Status: CLOSED ERRATA QA Contact: Aziza Karol <akarol>
Severity: high Docs Contact:
Priority: unspecified    
Version: 5.2.0CC: akarol, gmccullo, mfeifer, ssainkar
Target Milestone: GA   
Target Release: 5.4.0   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: 5.4.0.0.11 Doc Type: Bug Fix
Doc Text:
In the previous version of CloudForms Management Engine, due to broken VM reference in snapshot service model, automate method to revert a VM’s snapshot failed with an error. Code has been updated to fix the reference and revert snapshot now completes successfully.
Story Points: ---
Clone Of:
: 1170682 (view as bug list) Environment:
Last Closed: 2015-06-16 12:45:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1170682    
Attachments:
Description Flags
sumulation
none
snapshot
none
automation log
none
automation log - snapshot reverted none

Description Josh Carter 2014-12-02 18:35:30 UTC
Description of problem:

Automate method to revert a vm's snapshot fails with the following error. 

[----] I, [2014-11-24T19:16:33.936495 #31692:3e23a6c]  INFO -- : Q-task_id([automation_task_13387]) <User-Defined Method> revertSnapshot - Reverting Snapshot:<sdlc0296> Description:<> Date:<2014-11-24 18:38:42 UTC> for VM:<sdlc0296>
[----] E, [2014-11-24T19:16:33.938632 #31692:3e23a6c] ERROR -- : Q-task_id([automation_task_13387]) The following error occurred during instance method <vm> for AR object <#<Snapshot id: 46565, uid: "2014-07-08T20:48:12.421667Z", parent_uid: nil, name: "sdlc0296", description: "", current: 1, total_size: 335754890, filename: nil, create_time: "2014-07-08 20:48:12", disks: [], created_on: "2014-09-14 07:15:33", updated_on: "2014-11-24 18:38:42", parent_id: nil, vm_or_template_id: 15863, uid_ems: "2014-07-08T20:48:12.421667Z", ems_ref_obj: "--- !ruby/string:VimString\nstr: snapshot-235579\nxsi...", ems_ref: "snapshot-235579">>
[----] E, [2014-11-24T19:16:33.939029 #31692:3e23a6c] ERROR -- : Q-task_id([automation_task_13387]) MiqAeServiceModelBase.ar_method raised: <NoMethodError>: <undefined method `vm' for #<Snapshot:0x0000000a9f4a48>>
[----] E, [2014-11-24T19:16:33.939171 #31692:3e23a6c] ERROR -- : Q-task_id([automation_task_13387]) /opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.13/lib/active_model/attribute_methods.rb:407:in `method_missing'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.13/lib/active_record/attribute_methods.rb:149:in `method_missing'

Appears this error is occurring from the split of vm/template. 

Version-Release number of selected component (if applicable): 5.2.5


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:


Temporary workaround;

Go to /var/www/miq/vmdb/lib/miq_automation_engine/service_models/
Edit the miq_ae_service_snapshot.rb
Replace the 3 references to vm with vm_or_template.

Comment 3 CFME Bot 2014-12-04 15:01:06 UTC
New commit detected on manageiq/master:
https://github.com/ManageIQ/manageiq/commit/30d1ceac2a35c2fdac5b4f950792100d2f17d375

commit 30d1ceac2a35c2fdac5b4f950792100d2f17d375
Author:     Greg McCullough <gmccullo>
AuthorDate: Tue Dec 2 16:32:28 2014 -0500
Commit:     Greg McCullough <gmccullo>
CommitDate: Tue Dec 2 16:54:07 2014 -0500

    Fixed broken vm reference in snapshot service model.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1169930

 .../miq_automation_engine/service_models/miq_ae_service_snapshot.rb | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comment 4 CFME Bot 2014-12-04 15:30:58 UTC
New commit detected on cfme/5.3.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=91556448907dd13024312f9e675cdd36a127cb07

commit 91556448907dd13024312f9e675cdd36a127cb07
Author:     Greg McCullough <gmccullo>
AuthorDate: Tue Dec 2 16:32:28 2014 -0500
Commit:     Greg McCullough <gmccullo>
CommitDate: Thu Dec 4 10:30:13 2014 -0500

    Fixed broken vm reference in snapshot service model.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1169930

 .../miq_automation_engine/service_models/miq_ae_service_snapshot.rb | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comment 7 Aziza Karol 2015-05-25 08:50:19 UTC
Created attachment 1029384 [details]
sumulation

Comment 8 Aziza Karol 2015-05-25 08:50:54 UTC
Created attachment 1029385 [details]
snapshot

Comment 9 Greg McCullough 2015-05-26 15:58:33 UTC
Hard to tell what actually happened without seeing the automation.log.  Can you please provide that as well.

Comment 10 Aziza Karol 2015-05-27 10:33:37 UTC
Created attachment 1030469 [details]
automation log

Comment 11 Aziza Karol 2015-05-27 10:34:11 UTC
Have attached the automation log.

Comment 12 Greg McCullough 2015-05-27 17:43:17 UTC
The automate method you are running is InspectMe which is designed to dump properties of objects to the automate log.  I saw that in the screenshots but thought maybe you were using that wiring but had overridden the method with the method you are trying to test.

So the question now is where is the actual method that is taking the VM and snap_shot name and trying to test the automate method?  One possibility is that you did override the InspectMe method but it is in a domain that is marked as disabled.

It is clear from the logging that the revertSnapshot method is not what is being executed.

Comment 13 Aziza Karol 2015-06-01 04:45:07 UTC
Yes,the domain was disabled.I retried in the enabled domain and the snapshot got reverted.

Comment 14 Aziza Karol 2015-06-01 04:46:30 UTC
Snapshot reverted.see attached automation.log

Verified:
5.4.0.4.20150528174021_88cc76c

Comment 15 Aziza Karol 2015-06-01 04:50:56 UTC
Created attachment 1033116 [details]
automation log - snapshot reverted

Comment 17 errata-xmlrpc 2015-06-16 12:45:37 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-1100.html