Bug 1962694

Summary: Stop auto uploads if the total amount of hosts passes 150k
Product: Red Hat Satellite Reporter: Shimon Shtein <sshtein>
Component: RH Cloud - InventoryAssignee: Shimon Shtein <sshtein>
Status: CLOSED ERRATA QA Contact: Jameer Pathan <jpathan>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.9.0CC: aruzicka
Target Milestone: 6.10.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-foreman_rh_cloud-3.0.21 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-16 14:11:01 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 Shimon Shtein 2021-05-20 13:57:01 UTC
Currently rh_cloud plugin will attempt to upload automatically hosts inventory for all organizations no matter how big they are. For large organizations of ~150K hosts, it can cause an issue on the processing side. To mitigate this, the system would not attempt to upload such large organizations automatically.

Reproduce steps:
Create an organization with 150K hosts and wait until it's uploaded automatically

Current state:
The report would be uploaded.

Expected:
The system will not attempt to upload such a large report.

Comment 1 Brad Buckingham 2021-05-20 14:07:33 UTC
Can you add a description and reproducer steps for QE?

Comment 2 Jameer Pathan 2021-08-18 10:12:45 UTC
Verified:

Verified with:
- Satellite 6.10.0 snap 13
- tfm-rubygem-foreman_rh_cloud-4.0.25.1-2.el7sat.noarch

Test steps:
- Register few content hosts with satellite
- changed value of max_org_size for testing purpose
- Start report generation and upload using ForemanInventoryUpload::Async::GenerateAllReportsJob.perform_now

Observation:
- If organization had more hosts than specified by max_org_size variable
then report won't be uploaded.


[root@dhcp-3-129 ~]# foreman-rake console
'ErbParser' is ignored.
'RubyParser' is ignored.
Loading production environment (Rails 6.0.3.7)
irb(main):001:0> ForemanInventoryUpload.max_org_size
=> 150000
irb(main):002:0> ForemanInventoryUpload.instance_variable_set(:@max_org_size, 2)
=> 2
irb(main):003:0> ForemanInventoryUpload.max_org_size
=> 2
irb(main):004:0> ForemanInventoryUpload::Async::GenerateAllReportsJob.perform_now
=> [true]
irb(main):005:0> ForemanInventoryUpload.instance_variable_set(:@max_org_size, 3)
=> 3
irb(main):006:0> ForemanInventoryUpload::Async::GenerateAllReportsJob.perform_now
=> [#<ForemanInventoryUpload::Async::GenerateReportJob:0x0000000012735160 @arguments=["/var/lib/foreman/red_hat_inventory/generated_reports/", 1], @job_id="bd9f0346-346b-4968-8322-bfd76e96d07c", @queue_name="default", @priority=nil, @executions=0, @exception_executions={}, @provider_job_id="bd9f0346-346b-4968-8322-bfd76e96d07c">]

Comment 5 errata-xmlrpc 2021-11-16 14:11:01 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 (Moderate: Satellite 6.10 Release), 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-2021:4702