Bug 1537122

Summary: Provisioning discovered host from engine takes first installation media in list but that media isn't associated with operating system in hostgroup.
Product: [oVirt] ovirt-engine Reporter: Petr Kubica <pkubica>
Component: GeneralAssignee: Moti Asayag <masayag>
Status: CLOSED WORKSFORME QA Contact: Petr Kubica <pkubica>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.1.9CC: bugs, lsvaty, mgoldboi, mperina, pkubica
Target Milestone: ovirt-4.3.0Flags: rule-engine: ovirt-4.3+
mgoldboi: testing_plan_complete?
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-12-19 12:08:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1506547, 1581590    
Bug Blocks:    

Description Petr Kubica 2018-01-22 13:32:26 UTC
Description of problem:
Provisioning discovered host from engine takes first installation media in list but that media isn't associated with operating system in hostgroup.

2018-01-22 07:45:22 a544d7f0 [app] [I] Started PUT "/api/v2/discovered_hosts/mac525400106e16" for 192.168.100.59 at 2018-01-22 07:45:22 -0500
2018-01-22 07:45:22 a544d7f0 [app] [I] Processing by Api::V2::DiscoveredHostsController#update as JSON
2018-01-22 07:45:22 a544d7f0 [app] [I]   Parameters: {"discovered_host"=>{"name"=>"host-01", "hostgroup_id"=>"1", "environment_id"=>"1", "mac"=>"52:54:00:10:6e:16", "domain_id"=>"1", "subnet_id"=>"1", "ip"=>"192.168.100.26", "architecture_id"=>"1", "operatingsystem_id"=>"1", "medium_id"=>"9", "ptable_id"=>"61", "puppet_proxy_id"=>"1", "puppet_ca_proxy_id"=>"1", "root_pass"=>"[FILTERED]", "host_parameters_attributes"=>[{"name"=>"host_ovirt_id", "value"=>"[FILTERED]", "_destroy"=>"false"}, {"name"=>"compute_resource_id", "value"=>"[FILTERED]", "_destroy"=>"false"}, {"name"=>"pass", "value"=>"[FILTERED]", "_destroy"=>"false"}, {"name"=>"management", "value"=>"[FILTERED]", "_destroy"=>"false"}]}, "apiv"=>"v2", "id"=>"mac525400106e16"}
2018-01-22 07:45:22 a544d7f0 [app] [I] Authorized user admin(Admin User)
2018-01-22 07:45:22 a544d7f0 [app] [E] Unprocessable entity Host::Discovered (id: 31):
 |   Medium RHEL7.4 does not belong to RedHat 7.4 operating system


medium RHEL7.4 wasn't associated with RedHat 7.4 due to using synced image from subscriptions

manual provisioning in Satellite works

Version-Release number of selected component (if applicable):
Satellite 6.2.12
ovirt-engine-4.1.9.1-0.1.el7.noarch

How reproducible:
always

Steps to Reproduce:
1. have clean engine
2. in satellite have two media, alphabetically first isn't assocciated with operating system defined in host group
	
Actual results:
Cannot provision a host with different media until alphabetically first media was removed from

Expected results:
should provision only with associated media

Comment 1 Moti Asayag 2018-11-19 08:56:24 UTC
Isn't installation media being determined by the host group on Foreman's side ?
On ovirt's end we don't perform any specific logic about the available installation media, rather pass the installation media associated with the host group or by associated to its ancestries in case the host group doesn't have one.

Please paste the output of the selected host group from foreman's api - so we can figure out why the wanted installation media wasn't picked correctly:

{foreman_url}/api/hostgroups/{host_group_id}
and also the output of:
{foreman_url}/api/media


As a side note, if we wish to expose the installation media on ovirt's side, we should add it as RFE.

Comment 2 Martin Perina 2018-12-19 12:08:25 UTC
As QE cannot reproduce it now, closing as worksforme. If ever reproduced, feel free to reopen and attach all details