Bug 1234871

Summary: SCVMM provider refresh fails where VM disks are not present
Product: Red Hat CloudForms Management Engine Reporter: ncatling
Component: ProvidersAssignee: Bronagh Sorota <bsorota>
Status: CLOSED ERRATA QA Contact: Milan Falešník <mfalesni>
Severity: high Docs Contact:
Priority: high    
Version: 5.4.0CC: cpelland, dclarizi, gblomqui, jfrey, jhardy, mfeifer, obarenbo, snansi
Target Milestone: GAKeywords: ZStream
Target Release: 5.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.5.0.1 Doc Type: Bug Fix
Doc Text:
The previous version of CloudForms Management Engine would report an undefined method error when discovering virtual machines on a Microsoft system center virtual machine manager (SCVMM) provider, if it found a disk-less virtual machine. This bug was a result of the virtual machine storage discovery code always expecting virtual machines to have disks. This bug was fixed by changing the code to handle the case of disk-less virtual machines gracefully. Virtual machine discovery on SCVMM providers completes successfully in the new version of CloudForms Management Engine.
Story Points: ---
Clone Of:
: 1241656 (view as bug list) Environment:
Last Closed: 2015-12-08 13:18:00 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:
Bug Depends On:    
Bug Blocks: 1241656    

Description ncatling 2015-06-23 12:20:03 UTC
Description of problem:
SCVMM provider discovery fails where VM disks are not present, producing the following error:

ERROR -- : [NoMethodError]: undefined method `collect' for nil:NilClass  Method:[rescue in block in refresh]
ERROR -- : /var/www/miq/vmdb/app/models/ems_refresh/parsers/scvmm.rb:443:in `process_vm_storages

Version-Release number of selected component (if applicable):
CFME 5.4.0
SCVMM SP1

How reproducible:
Discover SCVMM provider where VMs exist with no disk/s.

Steps to Reproduce:
1.
2.
3.

Actual results:
Discover fails, producing the error above.

Expected results:
Discovery completes.

Additional info:

Comment 2 ncatling 2015-06-24 10:51:37 UTC
Fix is to amend process_vm_storages procedure in scvmm.rb as follows:

    def process_vm_storages(properties)
      return if properties[:VirtualHardDisks].nil?
      
      properties[:VirtualHardDisks].collect do |vhd|
        @data_index.fetch_path(:storages, vhd[:Props][:HostVolumeId])
      end.compact.uniq
    end

Comment 3 Oleg Barenboim 2015-07-08 14:57:46 UTC
Pull Request: https://github.com/ManageIQ/manageiq/pull/3388

Comment 4 CFME Bot 2015-07-09 15:47:18 UTC
New commit detected on manageiq/master:
https://github.com/ManageIQ/manageiq/commit/bf119d024009ebacebc16cc5ff7ed92d9ccdf065

commit bf119d024009ebacebc16cc5ff7ed92d9ccdf065
Author:     Bronagh Sorota <bsorota>
AuthorDate: Tue Jul 7 15:46:58 2015 -0400
Commit:     Bronagh Sorota <bsorota>
CommitDate: Tue Jul 7 15:46:58 2015 -0400

    returns if no disks are present on the VM
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1234871

 app/models/ems_refresh/parsers/scvmm.rb | 2 ++
 1 file changed, 2 insertions(+)

Comment 5 CFME Bot 2015-07-15 19:59:33 UTC
New commit detected on cfme/5.4.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=14de85df7d8cf0377ac692bc29b5fb3590730287

commit 14de85df7d8cf0377ac692bc29b5fb3590730287
Author:     Bronagh Sorota <bsorota>
AuthorDate: Tue Jul 7 15:46:58 2015 -0400
Commit:     Bronagh Sorota <bsorota>
CommitDate: Wed Jul 15 12:13:21 2015 -0400

    returns if no disks are present on the VM
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1234871

 vmdb/app/models/ems_refresh/parsers/scvmm.rb | 2 ++
 1 file changed, 2 insertions(+)

Comment 6 Milan Falešník 2015-10-26 09:38:57 UTC
Verified in 5.5.0.7.

Comment 8 errata-xmlrpc 2015-12-08 13:18:00 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