Bug 1478462

Summary: VM Migrate doesn't create notifications or log messages when migrations fail.
Product: Red Hat CloudForms Management Engine Reporter: William Fitzgerald <wfitzger>
Component: AutomateAssignee: William Fitzgerald <wfitzger>
Status: CLOSED CURRENTRELEASE QA Contact: Shveta <sshveta>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.8.0CC: jhardy, mkanoor, obarenbo, simaishi, sshveta, tfitzger, wfitzger
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.9.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.9.0.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1478520 (view as bug list) Environment:
Last Closed: 2018-03-06 15:29:32 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: 1478520    

Description William Fitzgerald 2017-08-04 15:34:07 UTC
Description of problem:
When you try to migrate a VM and it fails, CFME reports migration succeeded.
There are no notifications or error messages in the automation.log.

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

How reproducible:
always

Steps to Reproduce:
1. Get an VMWARE/RHV environment where you can try to migrate A VM.
2. Make it fail, you can do this by not entering data in any of the optional fields. 
3. wait for it to finish.

Actual results:
CFME reports migration succeeded
There are no notification messages.
There are no log messages showing error.  

Expected results:
CFME should report that migration failed.
CFME should create a notification and log messages for the error.


Additional info:

Comment 4 Shveta 2017-11-01 04:20:52 UTC
Tested in 5.9.0.4.20171024163837_ef71ea6 
======================================
When host specified and no datastore specified . Request succeeded with no error in logs.
Is this expected?



However, When no host specified migration failed with error :

Logs 
===========
----] I, [2017-11-01T00:17:36.201049 #13187:f87140]  INFO -- : Updated namespace [System/event_handlers/event_enforce_policy  ManageIQ/System]
[----] I, [2017-11-01T00:17:36.208249 #13187:f87140]  INFO -- : Invoking [builtin] method [/ManageIQ/System/event_handlers/event_enforce_policy] with inputs [{}]
[----] I, [2017-11-01T00:17:36.222039 #13187:f87140]  INFO -- : Followed  Relationship [miqaedb:/System/event_handlers/event_enforce_policy#create]
[----] I, [2017-11-01T00:17:36.222878 #13187:f87140]  INFO -- : Followed  Relationship [miqaedb:/System/Event/MiqEvent/POLICY/evm_worker_stop#create]
[----] I, [2017-11-01T00:17:36.788404 #26780:f87140]  INFO -- : Q-task_id([vm_migrate_task_57]) Updated namespace [Infrastructure/VM/Migrate/StateMachines/Methods/checkmigration  ManageIQ/Infrastructure/VM/Migrate/StateMachines]
[----] I, [2017-11-01T00:17:36.806629 #26780:f87140]  INFO -- : Q-task_id([vm_migrate_task_57]) Invoking [inline] method [/ManageIQ/Infrastructure/VM/Migrate/StateMachines/Methods/CheckMigration] with inputs [{}]
[----] I, [2017-11-01T00:17:36.813651 #26780:f87140]  INFO -- : Q-task_id([vm_migrate_task_57]) <AEMethod [/ManageIQ/Infrastructure/VM/Migrate/StateMachines/Methods/CheckMigration]> Starting 
[----] I, [2017-11-01T00:17:37.697076 #26780:f78d84]  INFO -- : <AEMethod checkmigration> CheckMigration returned <error> for state <finished> and status <Error>
[----] I, [2017-11-01T00:17:37.743054 #26780:f87140]  INFO -- : Q-task_id([vm_migrate_task_57]) <AEMethod [/ManageIQ/Infrastructure/VM/Migrate/StateMachines/Methods/CheckMigration]> Ending
[----] I, [2017-11-01T00:17:37.743291 #26780:f87140]  INFO -- : Q-task_id([vm_migrate_task_57]) Method exited with rc=MIQ_OK
[----] I, [2017-11-01T00:17:37.744030 #26780:f87140]  INFO -- : Q-task_id([vm_migrate_task_57]) Followed  Relationship [miqaedb:/Infrastructure/VM/Migrate/StateMachines/Methods/CheckMigration#create]
[----] I, [2017-11-01T00:17:37.744206 #26780:f87140]  INFO -- : Q-task_id([vm_migrate_task_57]) Processed  State=[CheckMigration] with Result=[error]
[----] W, [2017-11-01T00:17:37.744385 #26780:f87140]  WARN -- : Q-task_id([vm_migrate_task_57]) Error in State=[CheckMigration]
[----] I, [2017-11-01T00:17:37.744669 #26780:f87140]  INFO -- : Q-task_id([vm_migrate_task_57]) In State=[CheckMigration], invoking [on_error] method=[update_migration_status(status => 'Error Migrating VM')]
[----] I, [2017-11-01T00:17:39.399412 #26780:f87140]  INFO -- : Q-task_id([vm_migrate_task_57]) Updated namespace [Infrastructure/VM/Migrate/StateMachines/VMMigrate/update_migration_status  ManageIQ/Infrastructure/VM/Migrate/StateMachines]
[----] I, [2017-11-01T00:17:39.418141 #26780:f87140]  INFO -- : Q-task_id([vm_migrate_task_57]) Invoking [inline] method [/ManageIQ/Infrastructure/VM/Migrate/StateMachines/VMMigrate/update_migration_status] with inputs [{"status"=>"Error Migrating VM"}]
[----] I, [2017-11-01T00:17:39.420405 #26780:f87140]  INFO -- : Q-task_id([vm_migrate_task_57]) <AEMethod [/ManageIQ/Infrastructure/VM/Migrate/StateMachines/VMMigrate/update_migration_status]> Starting 
[----] I, [2017-11-01T00:17:40.226709 #26780:f78d84]  INFO -- : Validating Notification type: automate_user_error
[----] I, [2017-11-01T00:17:40.228773 #26780:f78d84]  INFO -- : Calling Create Notification type: automate_user_error subject type: User id: 1 options: {:message=>"VM Migration Error: Server [EVM] VM [dmisharo] Step [CheckMigration] Status [Error Migrating VM] Message [Error: Host not specified, unable to migrate VM] "}
[----] E, [2017-11-01T00:17:40.322754 #26780:f78d84] ERROR -- : <AEMethod update_migration_status> VM Migration Error: Server [EVM] VM [dmisharo] Step [CheckMigration] Status [Error Migrating VM] Message [Error: Host not specified, unable to migrate VM] 
[----] I, [2017-11-01T00:17:40.348542 #26780:f87140]  INFO -- : Q-task_id([vm_migrate_task_57]) <AEMethod [/ManageIQ/Infrastructure/VM/Migrate/StateMachines/VMMigrate/update_migration_status]> Ending
[----] I, [2017-11-01T00:17:40.348702 #26780:f87140]  INFO -- : Q-task_id([vm_migrate_task_57]) Method exited with rc=MIQ_OK
[----] I, [2017-11-01T00:17:40.349598 #26780:f87140]  INFO -- : Q-task_id([vm_migrate_task_57]) Followed  Relationship [miqaedb:/Infrastructure/VM/Migrate/StateMachines/VMMigrate/default#create]
[----] I, [2017-11-01T00:17:40.350390 #26780:f87140]  INFO -- : Q-task_id([vm_migrate_task_57]) Followed  Relationship [miqaedb:/infrastructure/VM/Lifecycle/Migrate#create]
[----] I, [2017-11-01T00:17:47.007216 #26780:f87140]  INFO -- : MiqAeEvent.build_evm_event >> event=<"evm_worker_start"> inputs=<{:event_details=>"Worker started: ID [9830], PID [], GUID [87cd7731-72f4-44f8-b9e1-de6218cda6fa]", :type=>"EmbeddedAnsibleWorker", "MiqEvent::miq_event"=>42334, :miq_event_id=>42334, "EventStream::event_stream"=>42334, :event_stream_id=>42334}>
[----] I, [2017-11-01T00:17:47.054425 #26780:f87140]  INFO -- : MiqAeEvent.build_evm_event >> event=<"evm_worker_start"> inputs=<{:event_details=>"Worker started: ID [9831], PID [27322], GUID [041c646a-3e11-4f7a-8bd1-2bf91ff98e57]", :type=>"MiqEmsRefreshCoreWorker", "MiqEvent::miq_event"=>42335, :miq_event_id=>42335, "EventStream::event_stream"=>42335, :event_stream_id=>42335}>
[----] I, [2017-11-01T00:17:47.0

Comment 5 William Fitzgerald 2017-11-02 17:49:20 UTC
Shveta,

If you just specify a host it might work.  None of the migration fields are required and in my testing, different combinations will work.  Currently if the migration fails early on in the process (no host or datastore), we will see the error and report it.

There is a case where it fails later on, (Someone was powering off the machine in the middle of the migration) and we would not catch that error.

Hope this helps ...

Billy

Comment 6 Shveta 2018-02-13 02:46:40 UTC
Fixed .
Verified in 5.9.0.20.20180206200727_d1873b9