Bug 1574444

Summary: vm.storage only returns one storage id instead of list of storage ids that are associated with VM object.
Product: Red Hat CloudForms Management Engine Reporter: Neha Chugh <nchugh>
Component: AutomateAssignee: Patrik Kománek <pkomanek>
Status: CLOSED ERRATA QA Contact: Ganesh Hubale <ghubale>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.9.0CC: cpelland, ghubale, mkanoor, obarenbo, pmcgowan, simaishi, tfitzger
Target Milestone: GA   
Target Release: 5.10.0   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: 5.10.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-02-07 23:02:08 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 Neha Chugh 2018-05-03 10:51:40 UTC
Description of problem:
vm.storage only returns one storage id instead of list of storage ids that are associated with VM object.

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

How reproducible:
Always

Steps to Reproduce:

1. Create a VM under Vmware provider and another hard disk under different storage domain then the one where VM is deployed. In that way, you will have multiple storage ids associated with that vm.

2. Go to Rails console and perform below commands:

# vmware = $evm.vmdb('ems').find_by_name('vmware-admin') ; 
# vm = vmware.vms.select { |v| v.name == 'nchugh-cfme59' }.first ; 
# vm.storage ( only one storage id returns)

Though the vm object is associated with multiple storage ids but it shows only one storage id in which Vm is deployed. 

But VM's active record object has inbuilt method i.e. "storage_ids" which provides the list of storage ids associated with it.

#vm = VmOrTemplate.find_by_id(<vm id>)
#vm.storage_ids ( will list out the storage ids assciated with it)

We cannot use Active record object types directly in the automation so we need inbuilt functionality under service model object which can provide the list of the storage ids.

Actual results:
It returns only one storage id where the VM is deployed.

Expected results:
Vm.storage should return the list of storage ids associated with the VM.

Additional info:

Comment 2 Greg McCullough 2018-05-03 12:10:01 UTC
The storage property of the VmOrTemplate object by design only returns a single storage element, usually a reference to where the configuration file is stored or maybe the first disk.  This object returned from this method should not change.

The active record object for VmOrTemplate does expose a "storages" property to return more storage instances for the VM.  This need just needs to be exposed to through the VmOrTemplate service model.

Comment 3 Patrik Kománek 2018-06-11 15:08:39 UTC
solved in: https://github.com/ManageIQ/manageiq-automation_engine/pull/187

`storages` attribute was exposed into the MiqAeServiceVmOrTemplate

Comment 6 errata-xmlrpc 2019-02-07 23:02:08 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-2019:0212