Description of problem: When provisioning certain templates against vmware the error "multiple parents found" stops the provision entirely Version-Release number of selected component (if applicable): 5.7.2.15 How reproducible: all the time Steps to Reproduce: 1. provision the affected template 2. 3. Actual results: [----] E, [2017-07-24T11:25:08.095293 #857:b9b130] ERROR -- : <AutomationEngine> The following error occurred during instance method <parent_blue_folder_1_name> for AR object <#<ManageIQ::Providers::Vmware::InfraManager::Template id: 21000000004868, vendor: "vmware", format: nil, version: nil, name: "rhel_6.7_64_STD_V170720", description: nil, location: "rhel_6.7_64_STD_V170720/rhel_6.7_64_STD_V170720.vm...", config_xml: nil, autostart: nil, host_id: 21000000000402, last_sync_on: nil, created_on: "2017-07-21 11:50:29", updated_on: "2017-07-21 11:53:59", storage_id: 21000000001822, guid: "cb1c93c8-6e0a-11e7-a617-0050568355de", ems_id: 21000000000013, last_scan_on: nil, last_scan_attempt_on: nil, uid_ems: "422094e8-e248-4731-d7fa-c58ec3118156", retires_on: nil, retired: nil, boot_time: nil, tools_status: "toolsNotRunning", standby_action: "checkpoint", power_state: "never", state_changed_on: "2017-07-21 11:50:31", previous_state: "poweredOff", connection_state: "connected", last_perf_capture_on: nil, registered: nil, busy: nil, smart: nil, memory_reserve: 0, memory_reserve_expand: false, memory_limit: -1, memory_shares: 40960, memory_shares_level: "normal", cpu_reserve: 0, cpu_reserve_expand: false, cpu_limit: -1, cpu_shares: 2000, cpu_shares_level: "normal", cpu_affinity: nil, ems_created_on: nil, template: true, evm_owner_id: nil, ems_ref_obj: "--- !ruby/string:VimString\nstr: vm-59862\nxsiType: ...", miq_group_id: 21000000000001, linked_clone: false, fault_tolerance: false, type: "ManageIQ::Providers::Vmware::InfraManager::Templat...", ems_ref: "vm-59862", ems_cluster_id: 21000000000140, retirement_warn: nil, retirement_last_warn: nil, vnc_port: nil, flavor_id: nil, availability_zone_id: nil, cloud: false, retirement_state: nil, cloud_network_id: nil, cloud_subnet_id: nil, cloud_tenant_id: nil, raw_power_state: "never", publicly_available: nil, orchestration_stack_id: nil, retirement_requester: nil, tenant_id: 21000000000001, resource_group_id: nil, deprecated: nil, storage_profile_id: nil>> [----] E, [2017-07-24T11:25:08.095736 #857:b9b130] ERROR -- : <AutomationEngine> MiqAeServiceModelBase.ar_method raised: <RuntimeError>: <Multiple parents found.> [----] E, [2017-07-24T11:25:08.095930 #857:b9b130] ERROR -- : <AutomationEngine> /var/www/miq/vmdb/app/models/mixins/relationship_mixin.rb:158:in `parent' /var/www/miq/vmdb/app/models/vm_or_template.rb:743:in `block in parent_blue_folder' /var/www/miq/vmdb/app/models/mixins/relationship_mixin.rb:84:in `with_relationship_type' /var/www/miq/vmdb/app/models/vm_or_template.rb:742:in `parent_blue_folder' /var/www/miq/vmdb/app/models/vm_or_template.rb:749:in `parent_blue_folders' /var/www/miq/vmdb/app/models/vm_or_template.rb:250:in `block (2 levels) in <class:VmOrTemplate>' /var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:270:in `public_send' /var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:270:in `block in object_send' /var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:289:in `ar_method' /var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:299:in `ar_method' /var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:268:in `object_send' /var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:123:in `block (2 levels) in expose' (irb):3:in `block in irb_binding' (irb):1:in `each' (irb):1:in `irb_binding' /opt/rh/rh-ruby23/root/usr/share/ruby/irb/workspace.rb:87:in `eval' /opt/rh/rh-ruby23/root/usr/share/ruby/irb/workspace.rb:87:in `evaluate' /opt/rh/rh-ruby23/root/usr/share/ruby/irb/context.rb:380:in `evaluate' /opt/rh/rh-ruby23/root/usr/share/ruby/irb.rb:489:in `block (2 levels) in eval_input' /opt/rh/rh-ruby23/root/usr/share/ruby/irb.rb:623:in `signal_status' /opt/rh/rh-ruby23/root/usr/share/ruby/irb.rb:486:in `block in eval_input' /opt/rh/rh-ruby23/root/usr/share/ruby/irb/ruby-lex.rb:246:in `block (2 levels) in each_top_level_statement' /opt/rh/rh-ruby23/root/usr/share/ruby/irb/ruby-lex.rb:232:in `loop' /opt/rh/rh-ruby23/root/usr/share/ruby/irb/ruby-lex.rb:232:in `block in each_top_level_statement' /opt/rh/rh-ruby23/root/usr/share/ruby/irb/ruby-lex.rb:231:in `catch' /opt/rh/rh-ruby23/root/usr/share/ruby/irb/ruby-lex.rb:231:in `each_top_level_statement' /opt/rh/rh-ruby23/root/usr/share/ruby/irb.rb:485:in `eval_input' /opt/rh/rh-ruby23/root/usr/share/ruby/irb.rb:395:in `block in start' /opt/rh/rh-ruby23/root/usr/share/ruby/irb.rb:394:in `catch' /opt/rh/rh-ruby23/root/usr/share/ruby/irb.rb:394:in `start' /opt/rh/cfme-gemset/gems/railties-5.0.2/lib/rails/commands/console.rb:65:in `start' /opt/rh/cfme-gemset/gems/railties-5.0.2/lib/rails/commands/console_helper.rb:9:in `start' /opt/rh/cfme-gemset/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:78:in `console' /opt/rh/cfme-gemset/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:49:in `run_command!' /opt/rh/cfme-gemset/gems/railties-5.0.2/lib/rails/commands.rb:18:in `<top (required)>' bin/rails:4:in `require' bin/rails:4:in `<main>' Expected results: provision completes Additional info:
https://github.com/ManageIQ/manageiq/pull/15671
New commit detected on ManageIQ/manageiq/master: https://github.com/ManageIQ/manageiq/commit/b1ed3c82bfc7760eeba9464775c636edda23661f commit b1ed3c82bfc7760eeba9464775c636edda23661f Author: Adam Grare <agrare> AuthorDate: Thu Jul 27 15:09:54 2017 -0400 Commit: Adam Grare <agrare> CommitDate: Thu Jul 27 15:28:20 2017 -0400 Return VMs and Templates for EMS prev_relats When retrieving vmdb_relats_ems we weren't including templates in the list of children for folders. This isn't an issue for clusters, hosts, and resource_pools because templates don't belong to any of these but they do belong to folders. If a VM was marked as a template and moved into a new folder it was not being included in the prev_relats which meant that its previous resource_pool and folder relat were not being deleted, but we were adding a new folder relationship. This caused the "multiple parents found" exception seen occasionally on the UI while provisioning. https://bugzilla.redhat.com/show_bug.cgi?id=1475405 app/models/ems_refresh/metadata_relats.rb | 13 ++++++- spec/models/ems_refresh/metadata_relats_spec.rb | 51 +++++++++++++++---------- 2 files changed, 41 insertions(+), 23 deletions(-)
I was able to reproduce this by just moving a template into a different folder and running a full refresh, it was not required to mark as a template and move into a new folder so the reproduction steps are a little simpler than originally thought.
*** Bug 1465612 has been marked as a duplicate of this bug. ***