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 1492047 - Old interfaces are never removed from Foreman DB
Summary: Old interfaces are never removed from Foreman DB
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Fact
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.4.0
Assignee: Shimon Shtein
QA Contact: Lai
URL:
Whiteboard:
: 1455891 1473644 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-09-15 10:44 UTC by Ivan Necas
Modified: 2021-09-09 12:36 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-16 19:18:33 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
One interface removed (39.71 KB, image/png)
2018-09-21 20:01 UTC, Lai
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 19244 0 High Closed Old interfaces are never removed from Foreman DB 2020-07-04 11:35:51 UTC
Red Hat Knowledge Base (Solution) 3143031 0 None None None 2018-02-27 12:28:20 UTC

Description Ivan Necas 2017-09-15 10:44:56 UTC
Hosts like hypervisors or docker hosts may often change interfaces (e.g. network bridges) which confuses Foreman and during fact import it creates more and more interfaces, old are never deleted. After some time when a host passes thousands of interfaces, due to O(n^2) one fact upload can take several minutes of processing.

We need to delete old interfaces from Foreman database, either during fact upload directly or on schedule (those that hasn't been updated for a while).

The behvior is really bad, Foreman eats up all memory until passenger process is restarted, which can take a while (non-Enterprise version do not have maximum memory setting).

Comment 1 Ivan Necas 2017-09-15 10:45:03 UTC
Created from redmine issue http://projects.theforeman.org/issues/19244

Comment 2 Ivan Necas 2017-09-15 10:45:08 UTC
Upstream bug assigned to None

Comment 4 Ivan Necas 2017-09-15 10:48:06 UTC
*** Bug 1473644 has been marked as a duplicate of this bug. ***

Comment 7 Francisco Garcia 2018-01-05 09:25:10 UTC
*** Bug 1455891 has been marked as a duplicate of this bug. ***

Comment 8 Satellite Program 2018-01-24 19:14:33 UTC
Upstream bug assigned to sshtein

Comment 9 Satellite Program 2018-01-24 19:14:37 UTC
Upstream bug assigned to sshtein

Comment 10 Satellite Program 2018-02-14 11:15:57 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/19244 has been resolved.

Comment 12 Ivan Necas 2018-09-21 15:00:59 UTC
Verification steps:

1. register a host with multiple network interfaces
2. ensure the interfaces are loaded when going to the host details, and that the interfaces are not marked as managed
3. Go to Administer -> Settings -> Provisioning, add a pattern that would match one of the interfaces "Ignore interfaces with matching identifier"
4. foreman-rake interfaces:clean
5. the interfaces that match the pattern should be removed from the host

Comment 13 Lai 2018-09-21 20:01:30 UTC
Created attachment 1485789 [details]
One interface removed

Followed inecas' instruction.

1. Registered a host with multiple network interfaces
2. Saw that interfaces are not marked as managed. (eth1)
3. Added eth1 to the "Ignore interfaces with matching identifier" list
4. Ran foreman-rake interface:clean
5. Checked that the eth1 interface was removed.

-bash-4.2# foreman-rake interfaces::clean
/usr/share/foreman/lib/foreman.rb:8: warning: already initialized constant Foreman::UUID_REGEXP
/usr/share/foreman/lib/foreman.rb:8: warning: previous definition of UUID_REGEXP was here
/usr/share/foreman/lib/core_extensions.rb:182: warning: already initialized constant ActiveSupport::MessageEncryptor::DEFAULT_CIPHER
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/message_encryptor.rb:22: warning: previous definition of DEFAULT_CIPHER was here
rake aborted!
Don't know how to build task 'interfaces::clean' (see --tasks)
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)
-bash-4.2# foreman-rake interfaces:clean
/usr/share/foreman/lib/foreman.rb:8: warning: already initialized constant Foreman::UUID_REGEXP
/usr/share/foreman/lib/foreman.rb:8: warning: previous definition of UUID_REGEXP was here
/usr/share/foreman/lib/core_extensions.rb:182: warning: already initialized constant ActiveSupport::MessageEncryptor::DEFAULT_CIPHER
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/message_encryptor.rb:22: warning: previous definition of DEFAULT_CIPHER was here
Starting ingnored interfaces clean up...
Finished, cleaned 1 interfaces

Check attachment for eth1 not showing up.

Comment 15 Bryan Kearney 2018-10-16 19:18:33 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:2927


Note You need to log in before you can comment on or make changes to this bug.