Bug 1573467 - [v2v] Transform a single VM from VMware to RHV fail with unclear error message, when VM is not under a cluster.
Summary: [v2v] Transform a single VM from VMware to RHV fail with unclear error messag...
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Providers
Version: 5.9.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: GA
: cfme-future
Assignee: Shmuel Melamud
QA Contact: Yadnyawalk Tale
Whiteboard: rhev,v2v
Depends On:
TreeView+ depends on / blocked
Reported: 2018-05-01 11:35 UTC by Ilanit Stein
Modified: 2019-04-24 13:12 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2018-07-29 09:57:49 UTC
Category: Bug
Cloudforms Team: RHEVM
Target Upstream Version:

Attachments (Terms of Use)
evm.log (1.12 MB, application/x-gzip)
2018-05-01 11:54 UTC, Ilanit Stein
no flags Details
automation.log (116.67 KB, application/x-gzip)
2018-05-01 11:57 UTC, Ilanit Stein
no flags Details

System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1573512 0 medium CLOSED [v2v] When moving VMware VMs to be under a cluster, it seems CFME\v2v is not fully updated with the change. 2021-02-22 00:41:40 UTC

Internal Links: 1573512

Description Ilanit Stein 2018-05-01 11:35:36 UTC
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):

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.  

[----] 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.

Comment 2 Ilanit Stein 2018-05-01 11:54:43 UTC
Created attachment 1429173 [details]

Comment 3 Ilanit Stein 2018-05-01 11:57:58 UTC
Created attachment 1429174 [details]

Comment 4 Shmuel Melamud 2018-05-01 15:14:03 UTC
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):


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

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.

Comment 9 Ilanit Stein 2018-05-24 06:41:59 UTC
VM transformation for single VM migration in CloudForms

Comment 10 Moran Goldboim 2018-07-29 09:57:49 UTC
This function is deprecated in favor of the new Infrastructure Migration Solution.

Note You need to log in before you can comment on or make changes to this bug.