Bug 1330549

Summary: WebUI doesn't allow to delete a host provisioned via bootdisk from satellite, when same host has already been deleted from rhev
Product: Red Hat Satellite Reporter: Sachin Ghai <sghai>
Component: Compute Resources - RHEVAssignee: Ido Kanner <ikanner>
Status: CLOSED WONTFIX QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.2.0CC: ikanner, inecas
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-09-04 18:00: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:
Attachments:
Description Flags
deleting a host from webUI when host is already removed from rhev CR none

Description Sachin Ghai 2016-04-26 12:37:09 UTC
Created attachment 1150965 [details]
deleting a host from webUI when host is already removed from rhev CR

Description of problem:
I accidentally deleted a host provisioned via boot disk from rhev CR and later when I tried to delete same host registered with satellite, satellite webUI raises error:

Failed to destroy a compute rhevm1.satellite.lab.eng.rdu2.redhat.com (RHEV) instance bootdiskgen2.katello-latest.satellite.lab.eng.rdu2.redhat.com: ActiveRecord::RecordNotFound


    2016-04-26 08:05:45 [app] [I] Started DELETE "/hosts/bootdiskgen2.katello-latest.satellite.lab.eng.rdu2.redhat.com" for 10.65.193.53 at 2016-04-26 08:05:45 -0400
    2016-04-26 08:05:45 [app] [I] Processing by HostsController#destroy as HTML
    2016-04-26 08:05:45 [app] [I]   Parameters: {"authenticity_token"=>"D+B+2DjOjAjlQYBvoNLLBaYz+oYHRDoqXmoSeAKx1xs=", "id"=>"bootdiskgen2.katello-latest.satellite.lab.eng.rdu2.redhat.com"}
    2016-04-26 08:05:46 [app] [I] Delete the DNS A record for bootdiskgen2.katello-latest.satellite.lab.eng.rdu2.redhat.com/10.8.111.51
    2016-04-26 08:05:46 [app] [I] Delete the DNS PTR record for 10.8.111.51/bootdiskgen2.katello-latest.satellite.lab.eng.rdu2.redhat.com
    2016-04-26 08:05:46 [app] [I] Delete DHCP reservation for bootdiskgen2.katello-latest.satellite.lab.eng.rdu2.redhat.com-00:1a:4a:3e:a6:1d/10.8.111.51
    2016-04-26 08:05:49 [app] [W] Failed to destroy a compute rhevm1.satellite.lab.eng.rdu2.redhat.com (RHEV) instance bootdiskgen2.katello-latest.satellite.lab.eng.rdu2.redhat.com: ActiveRecord::RecordNotFound
     | ActiveRecord::RecordNotFound: ActiveRecord::RecordNotFound
     | /usr/share/foreman/app/models/compute_resources/foreman/model/ovirt.rb:26:in `rescue in find_vm_by_uuid'
     | /usr/share/foreman/app/models/compute_resources/foreman/model/ovirt.rb:24:in `find_vm_by_uuid'
     | /usr/share/foreman/app/models/compute_resources/foreman/model/ovirt.rb:188:in `destroy_vm'
     | /usr/share/foreman/app/models/concerns/orchestration/compute.rb:161:in `delCompute'
     | /usr/share/foreman/app/models/concerns/orchestration.rb:162:in `execute'
     | /usr/share/foreman/app/models/concerns/orchestration.rb:107:in `block in process'
     | /usr/share/foreman/app/models/concerns/orchestration.rb:99:in `each'
     | /usr/share/foreman/app/models/concerns/orchestration.rb:99:in `process'
     | /usr/share/foreman/app/models/concerns/orchestration.rb:43:in `on_destroy'
     | /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:424:in `block in make_lambda'



this leaves a stale entry in satellite and there s no way to remove this host from satellite itself.

Version-Release number of selected component (if applicable):
Sat6.2 beta snap9

How reproducible:


Steps to Reproduce:
1. provision  a host via generic bootdisk on rhev
2. delete the host from rhev first
3. delete the host from satellite

Actual results:
Failed to destroy a compute rhevm1.satellite.lab.eng.rdu2.redhat.com (RHEV) instance bootdiskgen2.katello-latest.satellite.lab.eng.rdu2.redhat.com: ActiveRecord::RecordNotFound

Expected results:
host should be deleted from sat6 too

Additional info:

If I provision a host on libvirt and remove it from libvirt first,  later I can successfully remove it from satellite.

Similarly, if I remove host provisioned via discovery first from CR and then later try to remove from satellite, I don't see any issue.

Comment 2 Ivan Necas 2016-04-27 06:25:19 UTC
The workaround is to go to host details and unassign the host, that will remove the link to the CR and then it should be possible to delete the host.

Comment 3 Ivan Necas 2018-01-04 08:32:25 UTC
Created redmine issue http://projects.theforeman.org/issues/22143 from this bug

Comment 4 Ido Kanner 2018-01-23 07:39:51 UTC
I require more information regarding how to reproduce it on Satellite.

Comment 5 Ido Kanner 2018-07-09 10:02:17 UTC
Following new testing, I see that now there is a different error, but the same result. 

At the moment, the Ovirt resource returns 

| Foreman::Exception: ERF42-1251 [Foreman::Exception]: Error has occurred while communicating with rhev (oVirt): HTTP response code is 404. The response body is empty.
 | /home/vagrant/foreman/app/services/power_manager/virt.rb:15:in `rescue in initialize'
 | /home/vagrant/foreman/app/services/power_manager/virt.rb:7:in `initialize'
 | /home/vagrant/foreman/app/models/concerns/hostext/power_interface.rb:8:in `new'
 | /home/vagrant/foreman/app/models/concerns/hostext/power_interface.rb:8:in `power'
 | /home/vagrant/foreman/app/models/concerns/hostext/power_interface.rb:22:in `supports_power_and_running?'
 | /home/vagrant/foreman/app/controllers/hosts_controller.rb:864:in `block in host_power_ping'
 | /home/vagrant/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/timeout.rb:93:in `block in timeout'
 | /home/vagrant/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/timeout.rb:33:in `block in catch'
 | /home/vagrant/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/timeout.rb:33:in `catch'
 | /home/vagrant/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/timeout.rb:33:in `catch'
 | /home/vagrant/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/timeout.rb:108:in `timeout'
 | /home/vagrant/foreman/app/controllers/hosts_controller.rb:863:in `host_power_ping'
 | /home/vagrant/foreman/app/controllers/hosts_controller.rb:276:in `get_power_state'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/abstract_controller/base.rb:186:in `process_action'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/action_controller/metal/rendering.rb:30:in `process_action'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:108:in `block in run_callbacks'
 | /home/vagrant/foreman/app/controllers/concerns/application_shared.rb:15:in `set_timezone'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /home/vagrant/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /home/vagrant/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/audited-4.7.1/lib/audited/sweeper.rb:14:in `around'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/audited-4.7.1/lib/audited/sweeper.rb:14:in `around'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:135:in `run_callbacks'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/abstract_controller/callbacks.rb:19:in `process_action'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/action_controller/metal/rescue.rb:20:in `process_action'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/notifications.rb:166:in `block in instrument'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/notifications.rb:166:in `instrument'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/action_controller/metal/params_wrapper.rb:252:in `process_action'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.6/lib/active_record/railties/controller_runtime.rb:22:in `process_action'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/abstract_controller/base.rb:124:in `process'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionview-5.1.6/lib/action_view/rendering.rb:30:in `process'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/action_controller/metal.rb:189:in `dispatch'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/action_controller/metal.rb:253:in `dispatch'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/action_dispatch/routing/route_set.rb:31:in `serve'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/action_dispatch/journey/router.rb:50:in `block in serve'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/action_dispatch/journey/router.rb:33:in `each'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/action_dispatch/journey/router.rb:33:in `serve'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/action_dispatch/routing/route_set.rb:844:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/action_dispatch/middleware/static.rb:125:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/action_dispatch/middleware/static.rb:125:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/apipie-rails-0.5.8/lib/apipie/static_dispatcher.rb:65:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/bullet-5.7.5/lib/bullet/rack.rb:14:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/apipie-rails-0.5.8/lib/apipie/extractor/recorder.rb:136:in `call'
 | /home/vagrant/foreman/lib/middleware/telemetry.rb:9:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/apipie-rails-0.5.8/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
 | /home/vagrant/foreman/lib/middleware/catch_json_parse_errors.rb:8:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/rack-openid-1.4.2/lib/rack/openid.rb:98:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/rack-2.0.5/lib/rack/etag.rb:25:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/rack-2.0.5/lib/rack/conditional_get.rb:25:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/rack-2.0.5/lib/rack/head.rb:12:in `call'
 | /home/vagrant/foreman/lib/middleware/logging_context.rb:23:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/rack-2.0.5/lib/rack/session/abstract/id.rb:232:in `context'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/rack-2.0.5/lib/rack/session/abstract/id.rb:226:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/action_dispatch/middleware/cookies.rb:613:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.6/lib/active_record/migration.rb:556:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:97:in `run_callbacks'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/action_dispatch/middleware/callbacks.rb:24:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/action_dispatch/middleware/executor.rb:12:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/railties-5.1.6/lib/rails/rack/logger.rb:36:in `call_app'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/railties-5.1.6/lib/rails/rack/logger.rb:26:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/action_dispatch/middleware/request_id.rb:25:in `call'
 | /home/vagrant/katello/lib/katello/prevent_json_parsing.rb:12:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/rack-2.0.5/lib/rack/method_override.rb:22:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/rack-2.0.5/lib/rack/runtime.rb:22:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/action_dispatch/middleware/executor.rb:12:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.6/lib/action_dispatch/middleware/static.rb:125:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/rack-2.0.5/lib/rack/sendfile.rb:111:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/secure_headers-5.0.5/lib/secure_headers/middleware.rb:13:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/railties-5.1.6/lib/rails/engine.rb:522:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/railties-5.1.6/lib/rails/railtie.rb:185:in `public_send'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/railties-5.1.6/lib/rails/railtie.rb:185:in `method_missing'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/rack-2.0.5/lib/rack/urlmap.rb:68:in `block in call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/rack-2.0.5/lib/rack/urlmap.rb:53:in `each'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/rack-2.0.5/lib/rack/urlmap.rb:53:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/puma-3.11.4/lib/puma/configuration.rb:225:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/puma-3.11.4/lib/puma/server.rb:632:in `handle_request'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/puma-3.11.4/lib/puma/server.rb:446:in `process_client'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/puma-3.11.4/lib/puma/server.rb:306:in `block in run'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/puma-3.11.4/lib/puma/thread_pool.rb:120:in `block in spawn_thread'
 | /home/vagrant/.rvm/gems/ruby-2.4.1/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2018-07-09T08:40:34 [I|app|c1a69] Completed 200 OK in 3466ms (Views: 1.0ms | ActiveRecord: 1131.1ms)
 |

Comment 6 Satellite Program 2018-08-02 15:39:32 UTC
Upstream bug assigned to ikanner

Comment 7 Bryan Kearney 2018-09-04 18:00:00 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and we do not expect this to be implemented in the product in the foreseeable future. We are therefore closing this out as WONTFIX. If you have any concerns about this, please feel free to contact Rich Jerrido or Bryan Kearney. Thank you.