Bug 1620094

Summary: 'Associate VM' works but 'Associate VMs' does not
Product: Red Hat Satellite Reporter: Lukáš Hellebrandt <lhellebr>
Component: Compute Resources - RHEVAssignee: orabin
Status: CLOSED ERRATA QA Contact: Lukáš Hellebrandt <lhellebr>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.4CC: egolov, inecas, lhellebr, mhulan, mshira, oprazak, orabin, zhunting
Target Milestone: 6.4.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-fog-ovirt-1.1.2,foreman-1.18.0.19-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-16 18:55: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:

Description Lukáš Hellebrandt 2018-08-22 12:48:25 UTC
Description of problem:
It is possible to associate certain VM from a CR by going to VMS, opening VM details and clicking 'Associate VM'. However, clicking 'Associate VMs' on a VM list doesn't associate anything and says 'No VMs matched any host.' even when there is a matching Foreman host.

Version-Release number of selected component (if applicable):
Tested with Sat 6.4 snap 18 with RHEV CR.

How reproducible:
Deterministic

Steps to Reproduce:
1. Have a VM on CR
2. Create a Host in Foreman with MAC == VM_mac
3. Infrastructure -> Compute Resources -> <CR> -> Virtual Machines -> Associate VMs
4. "No VMs matched any host." green pop-up
5. Open the VM and click 'Associate VM', it gets associated

Actual results:
VM only gets associated when attempting to associate that certain VM as opposed to trying all the VMs

Expected results:
The VM should have been associated at step 3

Additional info:
In /usr/share/foreman/app/services/compute_resource_host_associator.rb , line 13, compute_resource.vms(:eager_loading => true) returns []

Comment 2 Lukáš Hellebrandt 2018-08-27 10:40:27 UTC
Yes, this is a regression. Tried with Sat 6.3.3.

Comment 5 Ivan Necas 2018-08-29 17:00:18 UTC
@Lukas: is this happening with RHV API v3 as well as v4?

Comment 6 orabin 2018-08-29 18:22:57 UTC
Created redmine issue https://projects.theforeman.org/issues/24746 from this bug

Comment 7 Satellite Program 2018-08-29 20:13:33 UTC
Upstream bug assigned to orabin

Comment 8 Satellite Program 2018-08-29 20:13:37 UTC
Upstream bug assigned to orabin

Comment 9 Lukáš Hellebrandt 2018-08-30 08:32:24 UTC
Ivan, I thought so but now I tested again to make sure and it only happens with v4 (I had my "rhev-v3" CR set to use v4...)

That means this bug is still valid, but only for v4 and is NOT a regression.

Comment 10 Satellite Program 2018-08-30 18:13:31 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/24746 has been resolved.

Comment 13 Lukáš Hellebrandt 2018-09-12 12:14:18 UTC
Verified with Sat 6.4 snap 21.

Used reproducer from OP with both APIv3 and APIv4. Also verified that listing VMs isn't broken and associating a specific VM isn't broken.

Comment 14 Bryan Kearney 2018-10-16 18:55: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-2018:2927