Bug 1513327

Summary: Creating a host w/ Boot disk provisioning method failed at medium selection
Product: Red Hat Satellite Reporter: Sachin Ghai <sghai>
Component: Bootdisk PluginAssignee: Lukas Zapletal <lzap>
Status: CLOSED ERRATA QA Contact: Sachin Ghai <sghai>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.3.0CC: bbuckingham, ehelms, ldelouw, lzap, pcreech, shisingh, zhunting
Target Milestone: UnspecifiedKeywords: Reopened, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/14797
Whiteboard:
Fixed In Version: foreman_bootdisk-10.0.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1708326 (view as bug list) Environment:
Last Closed: 2019-04-17 12:32:47 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:
Attachments:
Description Flags
Note the setttings before submitting create host form
none
After submitting create host form, media selection changed none

Description Sachin Ghai 2017-11-15 08:24:39 UTC
Description of problem:

I was trying to create a host using newly added bootdisk provisioning method from UI. I associated all required fields and simply selected the "Boot disk based" provisioning method. All other fields on "operating system" tab were appeared same as for "network based".

Under "Media selection" -> "Synced contents" was selected and Kickstart media was auto populated. The moment I submitted the create host form, UI raised error on Media under "operating system" tab: 

Media can't be blank

And "All Media" is selected under media selection.

Version-Release number of selected component (if applicable):
sat6.3 beta snap24

How reproducible:


Steps to Reproduce:
1. create a host using Bootdisk method on "vmware" CR
2.
3.

Actual results:


[app] [I] Started POST "/hosts" for 10.67.116.23 at 2017-11-15 01:19:28 -0500
2017-11-15 01:19:28 8411c665 [app] [I] Processing by HostsController#create as */*
2017-11-15 01:19:28 8411c665 [app] [I]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"25PREge0KGks2VMUKV7o0f1pMGQc0+XFAw4F6PCIvC3w+WFQkqiS/2utq3p0524btcoDpnDX6UXJTaiWxHXVEA==", "host"=>{"name"=>"sghaibootdhost", "organization_id"=>"1", "location_id"=>"2", "hostgroup_id"=>"", "compute_resource_id"=>"4", "compute_profile_id"=>"", "content_facet_attributes"=>{"lifecycle_environment_id"=>"2", "content_view_id"=>"2", "content_source_id"=>"1", "kickstart_repository_id"=>"16"}, "environment_id"=>"1", "puppet_proxy_id"=>"1", "puppet_ca_proxy_id"=>"1", "openscap_proxy_id"=>"", "puppetclass_ids"=>[""], "managed"=>"true", "progress_report_id"=>"[FILTERED]", "type"=>"Host::Managed", "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "type"=>"Nic::Managed", "mac"=>"", "identifier"=>"", "name"=>"sghaibootdhost", "domain_id"=>"1", "subnet_id"=>"2", "ip"=>"10.8.113.50", "ip6"=>"", "managed"=>"1", "primary"=>"1", "provision"=>"1", "execution"=>"1", "virtual"=>"0", "tag"=>"", "attached_to"=>"", "compute_attributes"=>{"type"=>"VirtualVmxnet3", "network"=>"network-154"}}}, "compute_attributes"=>{"cpus"=>"1", "corespersocket"=>"1", "memory_mb"=>"1024", "firmware"=>"bios", "cluster"=>"", "path"=>"/Datacenters/RH_Engineering/vm", "guest_id"=>"otherGuest", "scsi_controller_type"=>"VirtualLsiLogicController", "hardware_version"=>"Default", "memoryHotAddEnabled"=>"0", "cpuHotAddEnabled"=>"0", "add_cdrom"=>"0", "start"=>"1", "annotation"=>"", "volumes_attributes"=>{"0"=>{"_delete"=>"", "storage_pod"=>"", "datastore"=>"Local-Bulgaria", "name"=>"Hard disk", "size_gb"=>"10", "thin"=>"true", "eager_zero"=>"false", "mode"=>"persistent"}}}, "architecture_id"=>"1", "operatingsystem_id"=>"1", "provision_method"=>"bootdisk", "build"=>"1", "ptable_id"=>"90", "pxe_loader"=>"PXELinux BIOS", "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"3-Users", "enabled"=>"1", "comment"=>"", "overwrite"=>"false"}, "capabilities"=>"build image bootdisk", "provider"=>"Vmware", "media_selector"=>"synced_content", "bare_metal_capabilities"=>"build"}
2017-11-15 01:19:28 8411c665 [app] [I] Current user: admin (administrator)
2017-11-15 01:19:28 8411c665 [app] [I] Failed to save: Medium can't be blank
2017-11-15 01:19:28 8411c665 [app] [I]   Rendered hosts/_progress.html.erb (0.7ms)


Expected results:
Couple of things:

a) Not sure if UI should show all options similar to Network Install ?
b) Bootdisk provisioning should work

Additional info:

Comment 2 Sachin Ghai 2017-11-15 08:27:03 UTC
Created attachment 1352438 [details]
Note the setttings before submitting create host form

Comment 3 Sachin Ghai 2017-11-15 08:30:27 UTC
Created attachment 1352441 [details]
After submitting create host form, media selection changed

Comment 4 Sachin Ghai 2017-11-15 08:36:54 UTC
Installed bootdisk plugin:

 ~]# rpm -qa | grep bootdisk
tfm-rubygem-hammer_cli_foreman_bootdisk-0.1.3.3-2.el7sat.noarch
tfm-rubygem-foreman_bootdisk-9.0.0-2.fm1_15.el7sat.noarch

rpm -qa | grep vsphere
tfm-rubygem-fog-vsphere-1.7.0-1.el7sat.noarch

Comment 5 Lukas Zapletal 2017-11-15 10:53:54 UTC
We are tracking this upstream under http://projects.theforeman.org/issues/14797 but due to Rails 5 changes (http://projects.theforeman.org/issues/21243) we are unable to fix this upstream now and we need to branch and backport this patch:

app/models/concerns/foreman_bootdisk/host_ext.rb:

  included do
-   alias_method_chain :validate_media?, :bootdisk
    alias_method_chain :can_be_built?, :bootdisk
  end

Eric, not sure about the process here, can you guys branch foreman_discovery off, I don't see SATELLITE-6.3 branch.

Comment 7 Lukas Zapletal 2017-11-16 13:51:34 UTC
I have report from Sachin that after applying this patch he see a different issue, but I think it is a different bug, I need to confirm:

2017-11-15 05:43:27 67918d40 [app] [I] Processing by HostsController#create as */*
2017-11-15 05:43:27 67918d40 [app] [I]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"zDIKtd4f4jAtrNE1g0CF2bNeKaEsKTHJJkX1oHP39Xol6OLKnx5FDmGYxCa1SXURZenpZOAfhz90ip7gf1SfZQ==", "host"=>{"name"=>"sghaivmwarehost", "organization_id"=>"1", "location_id"=>"2", "hostgroup_id"=>"", "compute_profile_id"=>"", "content_facet_attributes"=>{"lifecycle_environment_id"=>"2", "content_view_id"=>"2", "content_source_id"=>"1", "kickstart_repository_id"=>"16"}, "environment_id"=>"1", "puppet_proxy_id"=>"1", "puppet_ca_proxy_id"=>"1", "openscap_proxy_id"=>"", "puppetclass_ids"=>[""], "managed"=>"true", "uuid"=>"501e7139-63ae-06d9-6a30-973ddbb2a5a3", "compute_resource_id"=>"4", "progress_report_id"=>"[FILTERED]", "type"=>"Host::Managed", "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "type"=>"Nic::Managed", "mac"=>"00:50:56:9e:ef:ac", "identifier"=>"", "name"=>"sghaivmwarehost", "domain_id"=>"1", "subnet_id"=>"2", "ip"=>"10.8.113.56", "ip6"=>"", "managed"=>"1", "primary"=>"1", "provision"=>"1", "execution"=>"1", "virtual"=>"0", "tag"=>"", "attached_to"=>"", "compute_attributes"=>{"type"=>"VirtualVmxnet3", "network"=>"network-154"}}}, "architecture_id"=>"1", "operatingsystem_id"=>"1", "provision_method"=>"bootdisk", "build"=>"1", "ptable_id"=>"90", "pxe_loader"=>"PXELinux BIOS", "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"3-Users", "enabled"=>"1", "comment"=>"", "overwrite"=>"false"}, "capabilities"=>"build image bootdisk", "provider"=>"Vmware", "media_selector"=>"synced_content", "bare_metal_capabilities"=>"build"}
2017-11-15 05:43:27 67918d40 [app] [I] Current user: admin (administrator)
2017-11-15 05:43:27 67918d40 [app] [W] Failed to create a compute vmware (VMware) instance sghaivmwarehost.satqe.lab.eng.rdu2.redhat.com: undefined method `merge' for nil:NilClass
 |  
 | NoMethodError: undefined method `merge' for nil:NilClass
 | /usr/share/foreman/app/models/concerns/orchestration/compute.rb:76:in `setCompute'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:216:in `execute'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:144:in `block in process'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:136:in `each'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:136:in `process'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:44:in `around_save_orchestration'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:432:in `block in make_lambda'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:312:in `block in halting'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:497:in `block in around'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:505:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in `_run_save_callbacks'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/callbacks.rb:302:in `create_or_update'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/persistence.rb:120:in `save'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/validations.rb:37:in `save'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/attribute_methods/dirty.rb:21:in `save'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/transactions.rb:286:in `block (2 levels) in save'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'

Comment 8 Sachin Ghai 2017-11-16 15:10:09 UTC
Lzap, the applied patch on my setup is working and the reported issue is fixed. now I'm getting different issue where create host failed w/ error: Failed to upload ISO image. I'm not sure if its due to some config issue.

In any case, this issue is fixed w/ applied patch. thank you.

Comment 10 Sachin Ghai 2017-12-12 08:41:45 UTC
Tested with sat6.3 GA snap28

I don't see the changes in app/models/concerns/foreman_bootdisk/host_ext.rb. As per comment 5 following should be removed from  "app/models/concerns/foreman_bootdisk/host_ext.rb" file though I can still see that line.

alias_method_chain :validate_media?, :bootdisk

Comment 13 Sachin Ghai 2017-12-21 11:32:33 UTC
Verified with sat6.3 snap29.

updated rpms:

 ~]# rpm -qa | grep bootdisk
tfm-rubygem-foreman_bootdisk-10.0.1-1.fm1_15.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_bootdisk-0.1.3.3-2.el7sat.noarch


I can still see same issue and don't see the changes in app/models/concerns/foreman_bootdisk/host_ext.rb. As per comment 5 following should be removed from  "app/models/concerns/foreman_bootdisk/host_ext.rb" file though I can still see that line.

alias_method_chain :validate_media?, :bootdisk

Comment 17 Sachin Ghai 2018-01-31 16:51:14 UTC
Verified with sat6.3 snap33.

The reported issue is no longer reproducible and I can create host using "bootdisk" provisioning method on vmware without any issue.


-----
2018-01-31 11:34:39 50ef9afb [app] [I] Started POST "/hosts" for 10.67.xx.xx at 2018-01-31 11:34:39 -0500
2018-01-31 11:34:39 50ef9afb [app] [I] Processing by HostsController#create as */*
2018-01-31 11:34:39 50ef9afb [app] [I]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"bMW01w2grQ0FUfBwAnFaDPwS9aXiNKaXMQQTPUt9hK+Mt8WXXpeLbsmFiTLIBuNeOqpWD3r7QsqSaWgw1gIv7g==", "host"=>{"name"=>"sghaivmwarehosttty4", "organization_id"=>"1", "location_id"=>"2", "hostgroup_id"=>"1", "compute_resource_id"=>"2", "content_facet_attributes"=>{"lifecycle_environment_id"=>"2", "content_view_id"=>"2", "content_source_id"=>"1", "kickstart_repository_id"=>"7"}, "puppetclass_ids"=>[""], "managed"=>"true", "progress_report_id"=>"[FILTERED]", "type"=>"Host::Managed", "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "type"=>"Nic::Managed", "mac"=>"", "identifier"=>"", "name"=>"sghaivmwarehosttty4", "domain_id"=>"1", "subnet_id"=>"1", "ip"=>"10.8.113.20", "ip6"=>"", "managed"=>"1", "primary"=>"1", "provision"=>"1", "execution"=>"1", "virtual"=>"0", "tag"=>"", "attached_to"=>"", "compute_attributes"=>{"type"=>"VirtualVmxnet3", "network"=>"network-154"}}}, "compute_attributes"=>{"cpus"=>"1", "corespersocket"=>"1", "memory_mb"=>"2048", "firmware"=>"automatic", "cluster"=>"Satellite_Engineering", "resource_pool"=>"Resources", "path"=>"/Datacenters/RH_Engineering/vm", "guest_id"=>"otherGuest", "scsi_controller_type"=>"VirtualLsiLogicController", "hardware_version"=>"Default", "memoryHotAddEnabled"=>"0", "cpuHotAddEnabled"=>"0", "add_cdrom"=>"1", "start"=>"1", "annotation"=>"", "volumes_attributes"=>{"0"=>{"_delete"=>"", "storage_pod"=>"RDU2-NFS-Cluster", "name"=>"Hard disk", "size_gb"=>"10", "thin"=>"true", "eager_zero"=>"false", "mode"=>"persistent"}}}, "architecture_id"=>"1", "operatingsystem_id"=>"1", "provision_method"=>"bootdisk", "build"=>"1", "ptable_id"=>"90", "pxe_loader"=>"PXELinux BIOS", "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"3-Users", "enabled"=>"1", "model_id"=>"", "comment"=>"", "overwrite"=>"false"}, "capabilities"=>"build image new_volume bootdisk", "provider"=>"Vmware", "media_selector"=>"synced_content", "bare_metal_capabilities"=>"build"}
2018-01-31 11:34:39 50ef9afb [app] [I] Current user: admin (administrator)

Comment 18 Satellite Program 2018-02-21 16:54:17 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:0336

Comment 22 Lukas Zapletal 2019-04-17 12:36:54 UTC
This is a Technlogy Preview feature and this particular issue (or similar symptoms) persisted in Satellite 6.3 to 6.5. It will be fixed in Satellite 6.6. Workaround is possible:

From f4a051a53d76d635b85a202f8d17da57bd7c4b7a Mon Sep 17 00:00:00 2001
From: Lukas Zapletal <lzap+git>
Date: Thu, 11 Jan 2018 12:47:46 +0100
Subject: [PATCH] BZ #1513327 - media is not validated

---
 app/models/concerns/foreman_bootdisk/host_ext.rb | 5 -----
 1 files changed, 0 insertion(+), 1 deletions(-)

diff --git a/app/models/concerns/foreman_bootdisk/host_ext.rb b/app/models/concerns/foreman_bootdisk/host_ext.rb
index 94ac3bd..e1f9bac 100644
--- a/app/models/concerns/foreman_bootdisk/host_ext.rb
+++ b/app/models/concerns/foreman_bootdisk/host_ext.rb
@@ -4,7 +4,6 @@ module ForemanBootdisk::HostExt
   extend ActiveSupport::Concern
 
   included do
-    alias_method_chain :validate_media?, :bootdisk
     alias_method_chain :can_be_built?, :bootdisk
   end
 
@@ -37,10 +36,6 @@ module ForemanBootdisk::HostExt
     /i.86|x86[_-]64/ =~ architecture.name
   end
-- 
2.18.1