Bug 1170358

Summary: scvmm inventory fails when vm has no virtual dvd
Product: Red Hat CloudForms Management Engine Reporter: Josh Carter <jocarter>
Component: ProvidersAssignee: Bronagh Sorota <bsorota>
Status: CLOSED ERRATA QA Contact: Milan Falešník <mfalesni>
Severity: medium Docs Contact:
Priority: low    
Version: 5.2.0CC: dclarizi, gblomqui, jfrey, jhardy, mfalesni, mfeifer, obarenbo
Target Milestone: GA   
Target Release: 5.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-06-16 12:45:46 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:

Description Josh Carter 2014-12-03 21:31:07 UTC
Description of problem:

CFME fails to collect scvmm inventory with the following errors. 

[----] E, [2014-12-03T13:06:36.491503 #60005:ce1030] ERROR -- : MIQ(MiqQueue.deliver)    Message id: [1000000222915], Error: [undefined method `[]' for nil:NilClass]
[----] E, [2014-12-03T13:06:36.491723 #60005:ce1030] ERROR -- : [NoMethodError]: undefined method `[]' for nil:NilClass  Method:[rescue in deliver]
[----] E, [2014-12-03T13:06:36.492078 #60005:ce1030] ERROR -- : /var/www/miq/vmdb/app/models/ems_refresh/parsers/scvmm.rb:344:in `process_vm_guest_devices'
/var/www/miq/vmdb/app/models/ems_refresh/parsers/scvmm.rb:276:in `process_vm_hardware'
/var/www/miq/vmdb/app/models/ems_refresh/parsers/scvmm.rb:154:in `parse_vm'
/var/www/miq/vmdb/app/models/ems_refresh/parsers/scvmm.rb:65:in `block in get_vms'
/var/www/miq/vmdb/app/models/ems_refresh/parsers/scvmm.rb:547:in `block in process_collection'
/var/www/miq/vmdb/app/models/ems_refresh/parsers/scvmm.rb:546:in `each'
/var/www/miq/vmdb/app/models/ems_refresh/parsers/scvmm.rb:546:in `process_collection'
/var/www/miq/vmdb/app/models/ems_refresh/parsers/scvmm.rb:65:in `get_vms'
/var/www/miq/vmdb/app/models/ems_refresh/parsers/scvmm.rb:32:in `ems_inv_to_hashes'
/var/www/miq/vmdb/app/models/ems_refresh/parsers/scvmm.rb:8:in `ems_inv_to_hashes'
/var/www/miq/vmdb/app/models/ems_refresh/refreshers/scvmm_refresher.rb:23:in `block in refresh'
/var/www/miq/vmdb/app/models/ems_refresh/refreshers/scvmm_refresher.rb:12:in `each'
/var/www/miq/vmdb/app/models/ems_refresh/refreshers/scvmm_refresher.rb:12:in `refresh'
/var/www/miq/vmdb/app/models/ems_refresh/refreshers/base_refresher.rb:8:in `refresh'
/var/www/miq/vmdb/app/models/ems_refresh.rb:76:in `block in refresh'
/var/www/miq/vmdb/app/models/ems_refresh.rb:75:in `each'
/var/www/miq/vmdb/app/models/ems_refresh.rb:75:in `refresh'
/var/www/miq/vmdb/app/models/miq_queue.rb:361:in `block in deliver'
/opt/rh/ruby193/root/usr/share/ruby/timeout.rb:69:in `timeout'
/var/www/miq/vmdb/app/models/miq_queue.rb:357: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:317:in `block in do_work_loop'
/var/www/miq/vmdb/lib/workers/worker_base.rb:314:in `loop'
/var/www/miq/vmdb/lib/workers/worker_base.rb:314:in `do_work_loop'
/var/www/miq/vmdb/lib/workers/worker_base.rb:135:in `run'
/var/www/miq/vmdb/lib/workers/worker_base.rb:123:in `start'
/var/www/miq/vmdb/lib/workers/worker_base.rb:23:in `start_worker'
/var/www/miq/vmdb/lib/workers/bin/worker.rb:5:in `<top (required)>'
/opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.17/lib/rails/commands/runner.rb:52:in `eval'
/opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.17/lib/rails/commands/runner.rb:52:in `<top (required)>'
/opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.17/lib/rails/commands.rb:64:in `require'
/opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.17/lib/rails/commands.rb:64:in `<top (required)>'
script/rails:6:in `require'
script/rails:6:in `<main>'


SCVMM errors. 

Virtual machine  cannot be modified because Virtual Guest Services is not installed on the guest operating system or because the installed Virtual Guest Services does not support the Heartbeat and Data Exchange Integration Services in the current virtual machine status. Error">ID: 30101 Verify the virtual machine is in a Running status, the Virtual Guest Services is installed, and the Heartbeat and Data Exchange Integration Services are enabled.



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


How reproducible:
very

Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:
 test fix 

Delete this method 

def process_vm_guest_devices(vm)
dvdprops = vm[:Properties][:Props][:VirtualDVDDrives][0][:Props]
connection = dvdprops[:Connection]
devices = []
devices << case connection
when "HostDrive" then process_vm_physical_dvd_drive(dvdprops)
when "ISOImage" then process_iso_image(vm)
end
devices.compact
end

Paste in this new method

def process_vm_guest_devices(vm)
      dvds = vm[:Properties][:Props][:VirtualDVDDrives]
      return nil if dvds.empty?

      dvdprops   = dvds[0][:Props]
      connection = dvdprops[:Connection]
      devices    = []

      devices << case connection
                 when "HostDrive" then process_vm_physical_dvd_drive(dvdprops)
                 when "ISOImage"  then process_iso_image(vm)
                 end

      devices.compact
    end


Save the file. 


Restart the evmserverd service 

-service evmserverd restart

Comment 3 Bronagh Sorota 2015-04-02 12:06:26 UTC
The fix for this ticket was verified in https://bugzilla.redhat.com/show_bug.cgi?id=1166861

Comment 4 Bronagh Sorota 2015-04-02 12:06:41 UTC
New commit detected on manageiq/master:
https://github.com/ManageIQ/manageiq/commit/ffab376f0134a72d0143e593ff288ddccdf19440

commit ffab376f0134a72d0143e593ff288ddccdf19440
Author:     Bronagh Sorota <bsorota>
AuthorDate: Wed Dec 10 12:56:49 2014 -0500
Commit:     Bronagh Sorota <bsorota>
CommitDate: Wed Dec 10 12:56:49 2014 -0500

    SCVMM: Virtual DVD drive support fix
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1166861

 vmdb/app/models/ems_refresh/parsers/ps_scripts/get_inventory.ps1 | 2 ++
 vmdb/app/models/ems_refresh/parsers/scvmm.rb                     | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

Comment 6 Milan Falešník 2015-05-07 08:13:20 UTC
Verified in 5.4.0.0.25. I created a VM without a DVD drive and added the scvmm provider. The inventory refresh went smooth and without errors.

Comment 8 errata-xmlrpc 2015-06-16 12:45:46 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://rhn.redhat.com/errata/RHBA-2015-1100.html