Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1368026

Summary: Delete hosts through bulk actions takes several hours
Product: Red Hat Satellite Reporter: Michal Dekan <mdekan>
Component: HostsAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: low Docs Contact:
Priority: high    
Version: 6.1.9CC: bbuckingham, jcallaha, mmccune, oshtaier, rgolan
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
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: 2016-09-20 18:25:39 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
patch created based on upstream bug http://projects.theforeman.org/issues/8316 none

Description Michal Dekan 2016-08-18 07:18:21 UTC
Created attachment 1191808 [details]
patch created based on upstream bug http://projects.theforeman.org/issues/8316

Description of problem:


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

$ cat foreman_packages
COMMAND> rpm -qa '*foreman*' || dpkg -l *foreman* | sort

lv0000014.ms.bgnet.de-foreman-proxy-client-1.0-1.noarch
foreman-vmware-1.7.2.56-1.el7sat.noarch
foreman-postgresql-1.7.2.56-1.el7sat.noarch
ruby193-rubygem-foreman-redhat_access-0.2.5-1.el7sat.noarch
rubygem-hammer_cli_foreman-0.1.4.15-1.el7sat.noarch
rubygem-hammer_cli_foreman_tasks-0.0.3.5-1.el7sat.noarch
foreman-ovirt-1.7.2.56-1.el7sat.noarch
rubygem-hammer_cli_foreman_discovery-0.0.1.10-1.el7sat.noarch
rubygem-hammer_cli_foreman_bootdisk-0.1.2.7-1.el7sat.noarch
foreman-debug-1.7.2.56-1.el7sat.noarch
ruby193-rubygem-foreman_discovery-2.0.0.23-1.el7sat.noarch
ruby193-rubygem-foreman_hooks-0.3.7-2.el7sat.noarch
lv0000014.ms.bgnet.de-foreman-client-1.0-1.noarch
rubygem-hammer_cli_foreman_docker-0.0.3.10-1.el7sat.noarch
foreman-1.7.2.56-1.el7sat.noarch
ruby193-rubygem-foreman-tasks-0.6.15.7-1.el7sat.noarch
foreman-proxy-1.7.2.8-1.el7sat.noarch
ruby193-rubygem-foreman_bootdisk-4.0.2.14-1.el7sat.noarch
foreman-discovery-image-3.0.5-3.el7sat.noarch
ruby193-rubygem-foreman_gutterball-0.0.1.9-1.el7sat.noarch
foreman-libvirt-1.7.2.56-1.el7sat.noarch
ruby193-rubygem-foreman_docker-1.2.0.24-1.el7sat.noarch
foreman-gce-1.7.2.56-1.el7sat.noarch
foreman-selinux-1.7.2.16-1.el7sat.noarch
foreman-compute-1.7.2.56-1.el7sat.noarch
xxxx-foreman-proxy-1.0-1.noarch


How reproducible:


Steps to Reproduce:
1. Install or update to Satellite 6.1.9
2. Go to Hosts -> all Hosts, select 7 - 20 hosts you want to delete
3. Select Action -> Delete Host

Actual results:

PGError: ERROR:  update or delete on table "hosts" violates foreign key constraint "reports_host_id_fk" on table "reports"
DETAIL:  Key (id)=(1244) is still referenced from table "reports".
: DELETE FROM "hosts" WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."id" = $1

And Actions::BulkAction task takes several hours to finish or its stuck.

Expected results:

Delete Hosts trough bulk action should finished successfully.

Additional info:

This is clone of upstream bug http://projects.theforeman.org/issues/8316
Customer confirmed that once the patch was applied its working.

# cd /usr/share/foreman/app/models/
# patch -p0 < managed.rb.patch

Comment 3 Brad Buckingham 2016-09-20 18:25:39 UTC
The upstream issue referenced in the bugzilla description is included in Satellite 6.2.