Description of problem: For VMware that has the VMs, NOT under a cluster: Transform VM (any OS type) from VMware to RHV fail quickly on CFME side, on Automate Request Last message: "[EVM] VM [win_8] Step [Launch] Status [Error submitting VM Import to RHV] Message [Submitting VM Import to RHV]" evm.log contain this error: Error: [undefined method `hosts' for nil:NilClass] After changing the structure in VMware: From VMs not under cluster into Move the host containing the VMs to be under cluster, and removing the VMware and adding it back to CFME, VM v2v works OK. (There seem to be a problem with the refresh on CFME, to the new VMware cluster structure, as v2v still failed, and VMwre add/remove was required for v2v to work - another bug will be filed for this). Version-Release number of selected component (if applicable): CFME-5.8.4.2/RHV-4.2.2.5 Expected results: 1. v2v for a VMware VM that is not under cluster should work OK 2. The error seen on CFME UI (automate request) do not reflect the root cause, while it should. evm.log: [----] I, [2018-05-01T05:59:34.466032 #30930:df1114] INFO -- : MIQ(MiqQueue#deliver) Message id: [65838], Delivering... [----] E, [2018-05-01T05:59:34.479431 #30930:df1114] ERROR -- : MIQ(MiqQueue#deliver) Message id: [65838], Error: [undefined method `hosts' for nil:NilClass] [----] E, [2018-05-01T05:59:34.479674 #30930:df1114] ERROR -- : [NoMethodError]: undefined method `hosts' for nil:NilClass Method:[rescue in deliver] [----] E, [2018-05-01T05:59:34.479856 #30930:df1114] ERROR -- : /var/www/miq/vmdb/app/models/manageiq/providers/redhat/infra_manager/vm_import.rb:145:in `select_host' /var/www/miq/vmdb/app/models/manageiq/providers/redhat/infra_manager/vm_import.rb:130:in `vmware_import_url' /var/www/miq/vmdb/app/models/manageiq/providers/redhat/infra_manager/vm_import.rb:27:in `import_vm' /var/www/miq/vmdb/app/models/miq_queue.rb:347:in `block in deliver' /opt/rh/rh-ruby23/root/usr/share/ruby/timeout.rb:91:in `block in timeout' /opt/rh/rh-ruby23/root/usr/share/ruby/timeout.rb:33:in `block in catch' /opt/rh/rh-ruby23/root/usr/share/ruby/timeout.rb:33:in `catch' /opt/rh/rh-ruby23/root/usr/share/ruby/timeout.rb:33:in `catch' /opt/rh/rh-ruby23/root/usr/share/ruby/timeout.rb:106:in `timeout' /var/www/miq/vmdb/app/models/miq_queue.rb:343:in `deliver' /var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:106:in `deliver_queue_message' /var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:135:in `deliver_message' /var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:153:in `block in do_work' /var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:147:in `loop' /var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:147:in `do_work' /var/www/miq/vmdb/app/models/miq_worker/runner.rb:340:in `block in do_work_loop' /var/www/miq/vmdb/app/models/miq_worker/runner.rb:337:in `loop' /var/www/miq/vmdb/app/models/miq_worker/runner.rb:337:in `do_work_loop' /var/www/miq/vmdb/app/models/miq_worker/runner.rb:160:in `run' /var/www/miq/vmdb/app/models/miq_worker/runner.rb:134:in `start' /var/www/miq/vmdb/app/models/miq_worker/runner.rb:21:in `start_worker' /var/www/miq/vmdb/app/models/miq_worker.rb:358:in `block in start_runner' /opt/rh/cfme-gemset/gems/nakayoshi_fork-0.0.3/lib/nakayoshi_fork.rb:24:in `fork' /opt/rh/cfme-gemset/gems/nakayoshi_fork-0.0.3/lib/nakayoshi_fork.rb:24:in `fork' /var/www/miq/vmdb/app/models/miq_worker.rb:356:in `start_runner' /var/www/miq/vmdb/app/models/miq_worker.rb:367:in `start' /var/www/miq/vmdb/app/models/miq_worker.rb:266:in `start_worker' /var/www/miq/vmdb/app/models/miq_worker.rb:150:in `block in sync_workers' /var/www/miq/vmdb/app/models/miq_worker.rb:150:in `times' /var/www/miq/vmdb/app/models/miq_worker.rb:150:in `sync_workers' /var/www/miq/vmdb/app/models/miq_server/worker_management/monitor.rb:53:in `block in sync_workers' /var/www/miq/vmdb/app/models/miq_server/worker_management/monitor.rb:50:in `each' /var/www/miq/vmdb/app/models/miq_server/worker_management/monitor.rb:50:in `sync_workers' /var/www/miq/vmdb/app/models/miq_server/worker_management/monitor.rb:22:in `monitor_workers' /var/www/miq/vmdb/app/models/miq_server.rb:358:in `block in monitor' /opt/rh/cfme-gemset/bundler/gems/cfme-gems-pending-541e66ee86b7/lib/gems/pending/util/extensions/miq-benchmark.rb:11:in `realtime_store' /opt/rh/cfme-gemset/bundler/gems/cfme-gems-pending-541e66ee86b7/lib/gems/pending/util/extensions/miq-benchmark.rb:30:in `realtime_block' /var/www/miq/vmdb/app/models/miq_server.rb:358:in `monitor' /var/www/miq/vmdb/app/models/miq_server.rb:397:in `block (2 levels) in monitor_loop' /opt/rh/cfme-gemset/bundler/gems/cfme-gems-pending-541e66ee86b7/lib/gems/pending/util/extensions/miq-benchmark.rb:11:in `realtime_store' /opt/rh/cfme-gemset/bundler/gems/cfme-gems-pending-541e66ee86b7/lib/gems/pending/util/extensions/miq-benchmark.rb:30:in `realtime_block' /var/www/miq/vmdb/app/models/miq_server.rb:397:in `block in monitor_loop' /var/www/miq/vmdb/app/models/miq_server.rb:396:in `loop' /var/www/miq/vmdb/app/models/miq_server.rb:396:in `monitor_loop' /var/www/miq/vmdb/app/models/miq_server.rb:258:in `start' /var/www/miq/vmdb/lib/workers/evm_server.rb:65:in `start' /var/www/miq/vmdb/lib/workers/evm_server.rb:91:in `start' /var/www/miq/vmdb/lib/workers/bin/evm_server.rb:4:in `<main>' [----] I, [2018-05-01T05:59:34.480031 #30930:df1114] INFO -- : MIQ(MiqQueue#delivered) Message id: [65838], State: [error], Delivered in [0.014022938] seconds [----] I, [2018-05-01T05:59:34.481306 #30930:df1114] INFO -- : MIQ(MiqQueue#m_callback) Message id: [65838], Invoking Callback with args: ["Finished", "error", "undefined method `hosts' for nil:NilClass", "nil"] [----] I, [2018-05-01T05:59:34.481536 #30930:df1114] INFO -- : MIQ(MiqTask#update_status) Task: [412] [Finished] [Error] [undefined method `hosts' for nil:NilClass] Additional info: * The ailure described in this bug is on the CFME side. The v2v request do not reach the RHV/RHV host. * Maybe CFME assumes the VM is under some cluster/host, and this is what causing the failure. * RHV v2v, with same VMware (VMs not under cluster) works fine.
Created attachment 1429173 [details] evm.log
Created attachment 1429174 [details] automation.log
The exception occurs when building a VMWare import URL in vmware_import_url() method (see in https://github.com/ManageIQ/manageiq-providers-ovirt/blob/master/app/models/manageiq/providers/redhat/infra_manager/vm_import.rb): "vpx://#{escape_username(username)}@#{vcenter}/#{escape_cluster(cluster)}/#{host.ipaddress}?no_verify=1" Host here is determined as the first host in the cluster where VM is located: def select_host(vm) vm.ems_cluster.hosts.first # any host from the VM's cluster end As I understand, vm.ems_cluster is nil in this case and that's why the exception occurs. So need to change this method to get the host from the VM object without getting the cluster first.
VM transformation for single VM migration in CloudForms
This function is deprecated in favor of the new Infrastructure Migration Solution.