Bug 1704806

Summary: Inconsistent naming of the --upgrade-mongo-storage-engine flag
Product: Red Hat Satellite Reporter: Evgeni Golov <egolov>
Component: InstallationAssignee: Evgeni Golov <egolov>
Status: CLOSED ERRATA QA Contact: Devendra Singh <desingh>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.4CC: desingh, zhunting
Target Milestone: 6.6.0Keywords: Triaged
Target Release: UnusedFlags: desingh: needinfo-
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: foreman-installer-1.22.0.16-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-10-22 19:52:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1731794    
Bug Blocks:    

Description Evgeni Golov 2019-04-30 14:37:13 UTC
The flag is called <code>--upgrade-mongo-storage-engine</code>, but the installer sometimes forgets the <code>-engine</code>:

<pre>
% git grep mongo-storage
katello/hooks/boot/21-mongo_storage_engine.rb:  '--upgrade-mongo-storage-engine',
katello/hooks/pre/30-upgrade.rb:      logger.info 'To upgrade to WiredTiger at a later time run foreman-installer with the --upgrade-mongo-storage flag.'
katello/hooks/pre/30-upgrade.rb:        f << "# Added by foreman-installer during upgrade, run the installer with --upgrade-mongo-storage to upgrade to WiredTiger.\n"
katello/hooks/pre/31-mongo_storage_engine.rb:  Kafo::Helpers.execute("sed -i -e 's/Added by foreman-installer during upgrade, run the installer with --upgrade-mongo-storage to upgrade to WiredTiger./Do not remove'/g #{hiera_file}")
katello/hooks/pre_validations/30-mongo_storage_engine.rb:    fail_and_exit 'Concurrent use of --upgrade and --upgrade-mongo-storage-engine is not supported. '\
katello/hooks/pre_validations/30-mongo_storage_engine.rb:                  'Please run --upgrade first, then --upgrade-mongo-storage-engine.'
</pre>

Comment 1 Evgeni Golov 2019-04-30 14:37:16 UTC
Created from redmine issue https://projects.theforeman.org/issues/26702

Comment 2 Evgeni Golov 2019-04-30 14:37:18 UTC
Upstream bug assigned to egolov

Comment 4 Bryan Kearney 2019-04-30 16:05:43 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/26702 has been resolved.

Comment 5 Devendra Singh 2019-07-18 11:36:16 UTC
Hi Evgeni,

For verification, Do I need to check into the satellite-installer log and verify the content's that you mentioned in the description or perform satellite installation with some specific parameter to check installation should work or not?

Comment 6 Evgeni Golov 2019-07-18 12:09:52 UTC
Hey Devendra,

so *technically* doing a grep in /usr/share/foreman-installer-katello (or whatever the correct path is, I never can remember that) and verify that all files refer to the same spelling of the param should be sufficient.

If you'd want to be super precise, you'd need to install a 6.3 (the last version that installed MMAPv1 by default), upgrade that all the way to 6.6, verify that the logs from the 6.6 upgrade contain the right name, execute the upgrade, then verify that custom-hiera.yaml also contains the right name.
But I see no benefit in doing that over the simple grep :)

Hope this helps
Evgeni

Comment 7 Devendra Singh 2019-07-18 12:19:05 UTC
(In reply to Evgeni Golov from comment #6)
> Hey Devendra,
> 
> so *technically* doing a grep in /usr/share/foreman-installer-katello (or
> whatever the correct path is, I never can remember that) and verify that all
> files refer to the same spelling of the param should be sufficient.
> 
> If you'd want to be super precise, you'd need to install a 6.3 (the last
> version that installed MMAPv1 by default), upgrade that all the way to 6.6,
> verify that the logs from the 6.6 upgrade contain the right name, execute
> the upgrade, then verify that custom-hiera.yaml also contains the right name.
> But I see no benefit in doing that over the simple grep :)
> 
> Hope this helps
> Evgeni

Thanks Evgeni for the update.

Comment 8 Devendra Singh 2019-08-29 10:34:07 UTC
I am still getting "--upgrade-mongo-storage" statement in /etc/foreman-installer/custom-hiera.yaml file in commented part after mongo-storage-engine upgrade.
I think we should need to update it to "--upgrade-mongo-storage-engine" right?

Comment 9 Evgeni Golov 2019-09-06 09:38:29 UTC
(In reply to Devendra Singh from comment #8)
> I am still getting "--upgrade-mongo-storage" statement in
> /etc/foreman-installer/custom-hiera.yaml file in commented part after
> mongo-storage-engine upgrade.
> I think we should need to update it to "--upgrade-mongo-storage-engine"
> right?

Yes, and my commit upstream does that. However, it does only add that once (when you update from 6.3 to 6.4), so any newer updates don't update the comment.

Comment 10 Devendra Singh 2019-09-06 09:56:21 UTC
(In reply to Evgeni Golov from comment #9)
> (In reply to Devendra Singh from comment #8)
> > I am still getting "--upgrade-mongo-storage" statement in
> > /etc/foreman-installer/custom-hiera.yaml file in commented part after
> > mongo-storage-engine upgrade.
> > I think we should need to update it to "--upgrade-mongo-storage-engine"
> > right?
> 
> Yes, and my commit upstream does that. However, it does only add that once
> (when you update from 6.3 to 6.4), so any newer updates don't update the
> comment.

So how would I fix it if my system was upgraded from 6.3 to 6.4 and the fix introduces latter?

Comment 11 Devendra Singh 2019-09-13 13:58:34 UTC
FailedQA.

During verification, I faced an inconsistent naming related issue(for mongo DB upgrade) in the custom-hiera.yml file in mongodb comment section

Expected Result: # Added by foreman-installer during upgrade, run the installer with --upgrade-mongo-storage-engine to upgrade to WiredTiger.
Actual Result: # Added by foreman-installer during upgrade, run the installer with --upgrade-mongo-storage to upgrade to WiredTiger.

Comment 12 Evgeni Golov 2019-09-17 09:01:59 UTC
Context from a mail I sent to Devendra last week:

So I wanted to write "does this need fixing", but then I looked at the code ;-)
The current workflow is:
1/ the user has a old installation with MongoDB MMAPv1 storage (so 6.3)
2/ during the upgrade to 6.4 they get a "Added by foreman-installer
during upgrade, run the installer with --upgrade-mongo-storage-engine
to upgrade to WiredTiger" comment added to custom-hiera by the
installer
3/ they upgrade to 6.5 (no changes here)
4/ they upgrade to 6.6 (again, no changes for now)
At this point they can remain on MMAPv1 storage and will still have
the "wrong" comment in the file, but that doesn't *really* harm
anybody (the Installer logs will have a warning with the right
command)
Or they will try the upgrade (and find out the right command name) and
end up with wiredTiger storage. However, as they had the "wrong"
comment in the file, it will not be replaced to "Do not remove" (see
https://github.com/theforeman/foreman-installer/pull/349/files#diff-ceb7d70cfab1a466aef1539a90401046R60)
as that replacement expects the "right" command in the comment.

I think *THAT* is something we should fix by allowing the replacement
of both wrong and correct comments. But fixing the existing comment is
IMHO too much code for a simple comment :)

Comment 13 Evgeni Golov 2019-09-18 06:19:24 UTC
manual post because failedqa previously

Comment 15 Devendra Singh 2019-09-27 10:57:20 UTC
FailedQA.

The problem still exists in the latest snap.

Expected Result: # Added by foreman-installer during upgrade, run the installer with --upgrade-mongo-storage-engine to upgrade to WiredTiger.
Actual Result: # Added by foreman-installer during upgrade, run the installer with --upgrade-mongo-storage to upgrade to WiredTiger.

Comment 18 Evgeni Golov 2019-09-27 13:20:46 UTC
This looks like it was wrongly cherry-picked.

Comment 20 Devendra Singh 2019-09-30 12:00:49 UTC
Verified successfully.
Satellite version: 6.6.0 
Foreman-installer version: foreman-installer-1.22.0.16-1.el7sat.noarch

Now the custom-hiera.yaml file updated successfully after the mongo DB engine upgrade 

Before mongo DB storage engine upgrade:

# Added by foreman-installer during upgrade, run the installer with --upgrade-mongo-storage to upgrade to WiredTiger.
mongodb::server::storage_engine: 'mmapv1'

After mongo DB storage engine upgrade:

# Do not remove
mongodb::server::storage_engine: 'wiredTiger'

Comment 21 Bryan Kearney 2019-10-22 19:52:02 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-2019:3172