Bug 1255190

Summary: Vm Clone : Need ISO image selection validation when provision_type ISO is selected in cloning
Product: Red Hat CloudForms Management Engine Reporter: Shveta <sshveta>
Component: ProvisioningAssignee: Drew Bomhof <dbomhof>
Status: CLOSED ERRATA QA Contact: Pete Savage <psavage>
Severity: high Docs Contact:
Priority: medium    
Version: 5.4.0CC: gmccullo, jhardy, obarenbo, simaishi, sshveta
Target Milestone: GA   
Target Release: 5.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.5.0.11 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-08 13:28:07 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:
Attachments:
Description Flags
evm log none

Description Shveta 2015-08-19 22:11:25 UTC
Description of problem:


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


How reproducible:


Steps to Reproduce:
1. Create a VM on RHEVM and clone that VM from Infrastructure - Lifecycle
2. Request fails with error : [NoMethodError]: undefined method `name' for nil:NilClass 
3.

Actual results:


Expected results:


Additional info:
Automation.log
============================
nfrastructure/VM/Provisioning/StateMachines]
[----] I, [2015-08-19T18:05:40.929423 #2875:629ea4]  INFO -- : Q-task_id([miq_provision_16]) Processing State=[CheckProvisioned]
[----] I, [2015-08-19T18:05:40.929795 #2875:629ea4]  INFO -- : Q-task_id([miq_provision_16]) Following Relationship [miqaedb:/Infrastructure/VM/Provisioning/StateMachines/Methods/CheckProvisioned#create]
[----] I, [2015-08-19T18:05:40.940922 #2875:629ea4]  INFO -- : Q-task_id([miq_provision_16]) Updated namespace [miqaedb:/Infrastructure/VM/Provisioning/StateMachines/Methods/CheckProvisioned#create  ManageIQ/Infrastructure/VM/Provisioning/StateMachines]
[----] I, [2015-08-19T18:05:40.952839 #2875:629ea4]  INFO -- : Q-task_id([miq_provision_16]) Updated namespace [Infrastructure/VM/Provisioning/StateMachines/Methods/check_provisioned  ManageIQ/Infrastructure/VM/Provisioning/StateMachines]
[----] I, [2015-08-19T18:05:40.964600 #2875:629ea4]  INFO -- : Q-task_id([miq_provision_16]) Invoking [inline] method [/ManageIQ/Infrastructure/VM/Provisioning/StateMachines/Methods/check_provisioned] with inputs [{}]
[----] I, [2015-08-19T18:05:40.980637 #2875:629ea4]  INFO -- : Q-task_id([miq_provision_16]) <AEMethod [/ManageIQ/Infrastructure/VM/Provisioning/StateMachines/Methods/check_provisioned]> Starting
[----] I, [2015-08-19T18:05:41.521169 #2875:60aa11c]  INFO -- : Q-task_id([miq_provision_16]) <AEMethod check_provisioned> ProvisionCheck returned <error> for state <finished> and status <Error>
[----] I, [2015-08-19T18:05:41.550740 #2875:629ea4]  INFO -- : Q-task_id([miq_provision_16]) <AEMethod [/ManageIQ/Infrastructure/VM/Provisioning/StateMachines/Methods/check_provisioned]> Ending
[----] I, [2015-08-19T18:05:41.550944 #2875:629ea4]  INFO -- : Q-task_id([miq_provision_16]) Method exited with rc=MIQ_OK
[----] I, [2015-08-19T18:05:41.551529 #2875:629ea4]  INFO -- : Q-task_id([miq_provision_16]) Followed  Relationship [miqaedb:/Infrastructure/VM/Provisioning/StateMachines/Methods/CheckProvisioned#create]
[----] I, [2015-08-19T18:05:41.551779 #2875:629ea4]  INFO -- : Q-task_id([miq_provision_16]) Processed  State=[CheckProvisioned] with Result=[error]
[----] W, [2015-08-19T18:05:41.552013 #2875:629ea4]  WARN -- : Q-task_id([miq_provision_16]) Error in State=[CheckProvisioned]
[----] I, [2015-08-19T18:05:41.552496 #2875:629ea4]  INFO -- : Q-task_id([miq_provision_16]) In State=[CheckProvisioned], invoking [on_error] method=[update_provision_status(status => '[NoMethodError]: undefined method `name' for nil:NilClass')]
[----] I, [2015-08-19T18:05:41.557103 #2875:629ea4]  INFO -- : Q-task_id([miq_provision_16]) Updated namespace [Infrastructure/VM/Provisioning/StateMachines/VMProvision_vm/update_provision_status  ManageIQ/Infrastructure/VM/Provisioning/StateMachines]
[----] I, [2015-08-19T18:05:41.569491 #2875:629ea4]  INFO -- : Q-task_id([miq_provision_16]) Invoking [inline] method [/ManageIQ/Infrastructure/VM/Provisioning/StateMachines/VMProvision_VM/update_provision_status] with inputs [{"status"=>"[NoMethodError]: undefined method `name"}]
[----] I, [2015-08-19T18:05:41.570502 #2875:629ea4]  INFO -- : Q-task_id([miq_provision_16]) <AEMethod [/ManageIQ/Infrastructure/VM/Provisioning/StateMachines/VMProvision_VM/update_provision_status]> Starting
[----] I, [2015-08-19T18:05:42.112290 #2875:629ea4]  INFO -- : Q-task_id([miq_provision_16]) <AEMethod [/ManageIQ/Infrastructure/VM/Provisioning/StateMachines/VMProvision_VM/update_provision_status]> Ending
[----] I, [2015-08-19T18:05:42.112441 #2875:629ea4]  INFO -- : Q-task_id([miq_provision_16]) Method exited with rc=MIQ_OK
[----] I, [2015-08-19T18:05:42.113299 #2875:629ea4]  INFO -- : Q-task_id([miq_provision_16]) Followed  Relationship [miqaedb:/Infrastructure/VM/Provisioning/StateMachines/VMProvision_vm/clone_to_vm#create]
[----] I, [2015-08-19T18:05:42.114110 #2875:629ea4]  INFO -- : Q-task_id([miq_provision_16]) Followed  Relationship [miqaedb:/infrastructure/VM/Lifecycle/Provisioning#create]
[----] I, [2015-08-19T18:05:49.520564 #2872:825e9c]  INFO -- : Instantiating [/System/Process/Event?EmsEvent%3A%3Aems_event=1553&MiqServer%3A%3Amiq_server=1&VmOrTemplate%3A%3Avm=1221&event_id=1553&event_type=NETWORK_INTERFACE_PLUGGED_INTO_VM&object_name=Event&vm_id=1221&vmdb_object_type=ems_event]
[----] I, [2015-08-19T18:05:49.532695 #2872:825e9c]  INFO -- : Updated namespace [/System/Process/Event?EmsEvent%3A%3Aems_event=1553&MiqServer%3A%3Amiq_server=1&VmOrTemplate%3A%3Avm=1221&event_id=1553&event_type=NETWORK_INTERFACE_PLUGGED_INTO_VM&object_name=Event&vm_id=1221&vmdb_object_type=ems_event  ManageIQ/System]
[----] I, [2015-08-19T18:05:49.597141 #2872:825e9c]  INFO -- : Following Relationship [miqaedb:/System/Event/NETWORK_INTERFACE_PLUGGED_INTO_VM#create]
[----] I, [2015-08-19T18:05:49.602028 #2872:825e9c]  INFO -- : Updated namespace [miqaedb:/System/Event/NETWORK_INTERFACE_PLUGGED_INTO_VM#create  ManageIQ/System]
[----] I, [2015-08-19T18:05:49.602497 #2872:825e9c]  INFO -- : Instance [/ManageIQ/System/Event/NETWORK_INTERFACE_PLUGGED_INTO_VM] not found in MiqAeDatastore - trying [.missing]
[----] I, [2015-08-19T18:05:49.613041 #2872:825e9c]  INFO -- : Followed  Relationship [miqaedb:/System/Event/NETWORK_INTERFACE_PLUGGED_INTO_VM#create]
[----] I, [2015-08-19T18:05:53.224079 #2872:825e9c]  INFO -- : Instantiating [/System/Process/Event?EmsEvent%3A%3Aems_event=1554&MiqServer%3A%3Amiq_server=1&VmOrTemplate%3A%3Avm=1221&event_id=1554&event_type=NETWORK_ADD_VM_INTERFACE&object_name=Event&vm_id=1221&vmdb_object_type=ems_event]
[----] I, [2015-08-19T18:05:53.247704 #2872:825e9c]  INFO -- : Updated namespace [/System/Process/Event?EmsEvent%3A%3Aems_event=1554&MiqServer%3A%3Amiq_server=1&VmOrTemplate%3A%3Avm=1221&event_id=1554&event_type=NETWORK_ADD_VM_INTERFACE&object_name=Event&vm_id=1221&vmdb_object_type=ems_event  ManageIQ/System]
[----] I, [2015-08-19T18:05:53.340631 #2872:825e9c]  INFO -- : Following Relationship [miqaedb:/System/Event/NETWORK_ADD_VM_INTERFACE#create]
[----] I, [2015-08-19T18:05:53.346168 #2872:825e9c]  INFO -- : Updated namespace [miqaedb:/System/Event/NETWORK_ADD_VM_INTERFACE#create  ManageIQ/System]
[----] I, [2015-08-19T18:05:53.346607 #2872:825e9c]  INFO -- : Instance [/ManageIQ/System/Event/NETWORK_ADD_VM_INTERFACE] not found in MiqAeDatastore - trying [.missing]
[----] I, [2015-08-19T18:05:53.354757 #2872:825e9c]  INFO -- : Followed  Relationship [miqaedb:/System/Event/NETWORK_ADD_VM_INTERFACE#create]
[----] I, [2015-08-19T18:05:53.596877 #2872:825e9c]  INFO -- : Instantiating [/System/Process/Event?EmsEvent%3A%3Aems_event=1555&ExtManagementSystem%3A%3Aems=4&Host%3A%3Ahost=6&MiqServer%3A%3Amiq_server=1&VmOrTemplate%3A%3Avm=885&ems_id=4&event_id=1555&event_type=VmResourceReallocatedEvent&host_id=6&object_name=Event&vm_id=885&vmdb_object_type=ems_event]
[----] I, [2015-08-19T18:05:53.609479 #2872:825e9c]  INFO -- : Updated namespace [/System/Process/Event?EmsEvent%3A%3Aems_event=1555&ExtManagementSystem%3A%3Aems=4&Host%3A%3Ahost=6&MiqServer%3A%3Amiq_server=1&VmOrTemplate%3A%3Avm=885&ems_id=4&event_id=1555&event_type=VmResourceReallocatedEvent&host_id=6&object_name=Event&vm_id=885&vmdb_object_type=ems_event  ManageIQ/System]
[----] I, [2015-08-19T18:05:53.677105 #2872:825e9c]  INFO -- : Following Relationship [miqaedb:/System/Event/VmResourceReallocatedEvent#create]
[----] I, [2015-08-19T18:05:53.683450 #2872:825e9c]  INFO -- : Updated namespace [miqaedb:/System/Event/VmResourceReallocatedEvent#create  ManageIQ/System]

Comment 2 Greg McCullough 2015-08-20 12:34:29 UTC
The original error with a stack trace should exist in the evm.log. Can you try to locate that information as this logging is just showing the error handling in automate which does not provide any root cause information.

Comment 3 Shveta 2015-08-20 14:14:46 UTC
Stack trace from evm.log 
[----] E, [2015-08-20T10:08:46.715099 #2875:629ea4] ERROR -- : Q-task_id([miq_provision_23]) MIQ(MiqProvisionRedhatViaIso#provision_error) [[NoMethodError]: undefined method `name' for nil:NilClass] encountered during phase [boot_from_cdrom]
[----] E, [2015-08-20T10:08:46.715329 #2875:629ea4] ERROR -- : Q-task_id([miq_provision_23]) /var/www/miq/vmdb/app/models/miq_provision_redhat_via_iso/state_machine.rb:19:in `boot_from_cdrom'
/var/www/miq/vmdb/app/models/miq_request_task/state_machine.rb:26:in `signal'
/var/www/miq/vmdb/app/models/miq_provision_redhat_via_iso/state_machine.rb:10:in `customize_destination'
/var/www/miq/vmdb/app/models/miq_request_task/state_machine.rb:26:in `signal'
/var/www/miq/vmdb/app/models/miq_provision/state_machine.rb:26:in `poll_destination_in_vmdb'
/var/www/miq/vmdb/app/models/miq_queue.rb:356:in `block in deliver'
/opt/rh/ruby200/root/usr/share/ruby/timeout.rb:66:in `timeout'
/var/www/miq/vmdb/app/models/miq_queue.rb:352:in `deliver'
/var/www/miq/vmdb/lib/workers/queue_worker_base.rb:107:in `deliver_queue_message'
/var/www/miq/vmdb/lib/workers/queue_worker_base.rb:135:in `deliver_message'
/var/www/miq/vmdb/lib/workers/queue_worker_base.rb:152:in `block in do_work'
/var/www/miq/vmdb/lib/workers/queue_worker_base.rb:146:in `loop'
/var/www/miq/vmdb/lib/workers/queue_worker_base.rb:146:in `do_work'
/var/www/miq/vmdb/lib/workers/worker_base.rb:323:in `block in do_work_loop'
/var/www/miq/vmdb/lib/workers/worker_base.rb:320:in `loop'
/var/www/miq/vmdb/lib/workers/worker_base.rb:320:in `do_work_loop'
/var/www/miq/vmdb/lib/workers/worker_base.rb:141:in `run'
/var/www/miq/vmdb/lib/workers/worker_base.rb:122:in `start'
/var/www/miq/vmdb/lib/workers/worker_base.rb:23:in `start_worker'
/var/www/miq/vmdb/lib/workers/bin/worker.rb:3:in `<top (required)>'
/opt/rh/cfme-gemset/bundler/gems/rails-4842a8377644/railties/lib/rails/commands/runner.rb:52:in `eval'
/opt/rh/cfme-gemset/bundler/gems/rails-4842a8377644/railties/lib/rails/commands/runner.rb:52:in `<top (required)>'
/opt/rh/cfme-gemset/bundler/gems/rails-4842a8377644/railties/lib/rails/commands.rb:64:in `require'
/opt/rh/cfme-gemset/bundler/gems/rails-4842a8377644/railties/lib/rails/commands.rb:64:in `<top (required)>'
script/rails:6:in `require'

Comment 4 Shveta 2015-08-20 14:15:15 UTC
Created attachment 1065286 [details]
evm log

Comment 5 Greg McCullough 2015-08-20 15:28:14 UTC
Looks like you are selecting ISO provisioning but not selecting an ISO image.  Can you confirm that is the case and if selecting an ISO image resolves this issue.

We will still need to resolve the issue that the dialog is not enforcing that the ISO Image dialog field is required when ISO provisioning is selected.

Comment 6 Shveta 2015-08-20 18:06:31 UTC
Right , issue is only no ISO image selection enforcement when provision_type ISO is selected. 
Changing the title

Comment 7 Greg McCullough 2015-10-22 21:00:41 UTC
Drew - As I recall the core of the issue is the handling of the required field in the update_field_required method in app/models/miq_provision_virt_workflow.rb.  The current logic resets the required field to false, and later depending on the result of the support_pxe?/support_iso? method tries to restore the field's previous required value, but that has already been overwritten.

I was thinking about storing/restoring the default value from a different key as a possible solution.  We could look at implementing a special validation method for the field which we already do for several other fields.

Comment 9 CFME Bot 2015-11-12 18:35:34 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/74d46d2b5d0dece5169474ed84546e1d586ca09f

commit 74d46d2b5d0dece5169474ed84546e1d586ca09f
Author:     Drew Bomhof <dbomhof>
AuthorDate: Wed Nov 11 17:17:01 2015 -0500
Commit:     Drew Bomhof <dbomhof>
CommitDate: Thu Nov 12 09:56:54 2015 -0500

    Validate Iso and Pxe child dialogs
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1255190
    
    Refactored how the update_field_required method validates if supports_pxe?
    or supports_iso? are required fields.
    
    Renamed the method to update_field_visibility_pxe_iso
    
    We now simply apply the :edit, or :hide flags to the MiqProvisionVirtDialog class
    which implicitly does not validate on hidden fields

 app/models/miq_provision_virt_workflow.rb       | 16 ++++++------
 spec/models/miq_provision_virt_workflow_spec.rb | 33 +++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 8 deletions(-)

Comment 10 CFME Bot 2015-11-16 21:18:10 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=e50013377400a98e42910044085a425457014521

commit e50013377400a98e42910044085a425457014521
Author:     Drew Bomhof <dbomhof>
AuthorDate: Wed Nov 11 17:17:01 2015 -0500
Commit:     Drew Bomhof <dbomhof>
CommitDate: Fri Nov 13 15:33:43 2015 -0500

    Validate Iso and Pxe child dialogs
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1255190
    
    Refactored how the update_field_required method validates if supports_pxe?
    or supports_iso? are required fields.
    
    Renamed the method to update_field_visibility_pxe_iso
    
    We now simply apply the :edit, or :hide flags to the MiqProvisionVirtDialog class
    which implicitly does not validate on hidden fields

 app/models/miq_provision_virt_workflow.rb       | 16 ++++++------
 spec/models/miq_provision_virt_workflow_spec.rb | 33 +++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 8 deletions(-)

Comment 11 CFME Bot 2015-11-16 21:18:46 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=f115304ec432d7cbfe223cc58aa816444d95d9bd

commit f115304ec432d7cbfe223cc58aa816444d95d9bd
Merge: 45ae51e e500133
Author:     Greg McCullough <gmccullo>
AuthorDate: Fri Nov 13 16:50:58 2015 -0500
Commit:     Greg McCullough <gmccullo>
CommitDate: Fri Nov 13 16:50:58 2015 -0500

    Merge branch '5.5.z_iso_image_selection_validation' into '5.5.z'
    
    Validate Iso and Pxe child dialogs
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1255190
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1241890
    
    Refactored how the update_field_required method validates if supports_pxe?
    or supports_iso? are required fields.
    
    Renamed the method to update_field_visibility_pxe_iso
    
    We now simply apply the :edit, or :hide flags to the MiqProvisionVirtDialog class
    which implicitly does not validate on hidden fields
    
    PR:https://github.com/ManageIQ/manageiq/pull/5395
    
    Cherry-Pick was clean
    
    See merge request !431

 app/models/miq_provision_virt_workflow.rb       | 16 ++++++------
 spec/models/miq_provision_virt_workflow_spec.rb | 33 +++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 8 deletions(-)

Comment 12 Pete Savage 2015-11-25 10:56:28 UTC
Verified in 5.5.0.12

Comment 14 errata-xmlrpc 2015-12-08 13:28:07 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://access.redhat.com/errata/RHSA-2015:2551