Bug 1574444 - vm.storage only returns one storage id instead of list of storage ids that are associated with VM object.
Summary: vm.storage only returns one storage id instead of list of storage ids that ar...
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.9.0
Hardware: All
OS: All
Target Milestone: GA
: 5.10.0
Assignee: Patrik Kománek
QA Contact: Ganesh Hubale
Depends On:
TreeView+ depends on / blocked
Reported: 2018-05-03 10:51 UTC by Neha Chugh
Modified: 2019-02-07 23:02 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2019-02-07 23:02:08 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2019:0212 0 None None None 2019-02-07 23:02:12 UTC

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):

How reproducible:

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.


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