Bug 1288215

Summary: Built call can fail due to orchestration conflict checking
Product: Red Hat Satellite Reporter: Stephen Benjamin <stbenjam>
Component: OrchestrationAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED WONTFIX QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.1.3CC: adprice, bbuckingham, bkearney, rheron
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/12696
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-01-11 21:40:33 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 Stephen Benjamin 2015-12-03 21:21:52 UTC
Description of problem:
The built url calls `save!` which triggers checking orchestration conflicts.  This seems unnecessary, and can even prevent the host from being built, putting it in a reboot loop.  To give you an example, a host with DNS has its record checked for conflicts when built is called. On very slow DNS servers this could time out and cause the call to fail.

Upstream Foreman makes the timeout at least configurable (http://projects.theforeman.org/issues/11709), but I wonder why it should check  conflicts at all when we're marking the host built?

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

How reproducible:
Sometimes, if your DNS is very, very slow


Additional info:

Traceback from the failed built call:


/usr/share/foreman/lib/net/dns.rb:37:in `rescue in lookup'
/usr/share/foreman/lib/net/dns.rb:15:in `lookup'
/usr/share/foreman/lib/net/dns.rb:63:in `dns_lookup'
/usr/share/foreman/lib/net/dns/a_record.rb:28:in `conflicts'
/usr/share/foreman/lib/net.rb:24:in `conflicting?'
/usr/share/foreman/app/models/concerns/orchestration/dns.rb:121:in `dns_conflict_detected?'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:512:in `_run__3613348864840830943__validation__1758447277780704494__callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_validation_callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations/callbacks.rb:53:in `run_validations!'
/opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations.rb:194:in `valid?'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:69:in `valid?'
/usr/share/foreman/app/models/concerns/orchestration.rb:47:in `valid?'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:77:in `perform_validations'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:56:in `save!'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/attribute_methods/dirty.rb:33:in `save!'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:246:in `block in save!'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:295:in `block in with_transaction_returning_status'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:208:in `transaction'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:293:in `with_transaction_returning_status'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:246:in `save!'
/usr/share/foreman/app/models/host/managed.rb:251:in `built'
/usr/share/foreman/app/controllers/unattended_controller.rb:40:in `built'

Comment 1 Stephen Benjamin 2015-12-03 21:22:31 UTC
Created redmine issue http://projects.theforeman.org/issues/12696 from this bug

Comment 2 Bryan Kearney 2015-12-03 23:03:39 UTC
Upstream bug component is Orchestration

Comment 4 Rodrique Heron 2016-02-08 21:47:08 UTC
Seems like i'm hitting this bug with 6.1.6, single host install with the capsule functioning as a DNS server.

This happens when I edit a host, then try to submit changes.

Snippet from production.log

2016-02-08 16:30:27 [W] Unable to find IP address for 'sat6.rhlab.com': execution expired
2016-02-08 16:30:27 [W] failed to detect boot server: ERF50-9294 [Foreman::WrappedException]: Unable to find IP address for 'sat6.rhlab.com' ([Net::Error]: execution expired)

Full Trace:

Net::Error
execution expired
lib/net/dns.rb:36:in `rescue in lookup'
lib/net/dns.rb:15:in `lookup'
lib/net/dns.rb:62:in `dns_lookup'
lib/net/dns/a_record.rb:28:in `conflicts'
lib/net.rb:24:in `conflicting?'
app/models/concerns/orchestration/dns.rb:121:in `dns_conflict_detected?'
app/models/concerns/orchestration.rb:47:in `valid?'
app/models/concerns/foreman/sti.rb:29:in `save_with_type'
app/controllers/hosts_controller.rb:110:in `block in update'
app/models/taxonomy.rb:58:in `block in no_taxonomy_scope'
app/models/taxonomy.rb:65:in `block (2 levels) in as_taxonomy'
app/models/concerns/foreman/thread_session.rb:148:in `as_location'
app/models/taxonomy.rb:64:in `block in as_taxonomy'
app/models/concerns/foreman/thread_session.rb:113:in `as_org'
app/models/taxonomy.rb:63:in `as_taxonomy'
app/models/taxonomy.rb:57:in `no_taxonomy_scope'
app/controllers/hosts_controller.rb:102:in `update'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'
lib/net/dns.rb:21:in `block in lookup'

Comment 5 Bryan Kearney 2016-07-08 20:39:47 UTC
Per 6.3 planning, moving out non acked bugs to the backlog

Comment 7 Bryan Kearney 2017-01-11 21:40:33 UTC
This is an older bug which has been reported upstream. We are not going to track this bug downstream. When the upstream issue is resolved, the next build will contain the fix. Thank you.