Bug 1277335

Summary: [RFE] Provide a functionality to reset cfme appliance.
Product: Red Hat CloudForms Management Engine Reporter: Prasad Mukhedkar <pmukhedk>
Component: ApplianceAssignee: Nick Carboni <ncarboni>
Status: CLOSED ERRATA QA Contact: Nandini Chandra <nachandr>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.4.0CC: abellott, jhardy, jprause, mfeifer, ncarboni, obarenbo, pmukhedk, ssainkar, tcarlin
Target Milestone: GAKeywords: FutureFeature
Target Release: 5.6.0   
Hardware: x86_64   
OS: Linux   
Whiteboard: usability
Fixed In Version: 5.6.0.1 Doc Type: Enhancement
Doc Text:
There was a feature request to provide a functionality to reset CFME appliance. This was because if something went wrong with the CFME appliance configuration, like choosing an incorrect database region, having a "master reset" function to reset a broken appliance to a "freshly installed" state would be beneficial rather than re-installing or creating a new appliance. With this release, a new option to reset configured database has been created in appliance_console.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-29 15:02:06 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 Prasad Mukhedkar 2015-11-03 05:38:24 UTC
Description of problem:

If something goes wrong with cfme appliance configuration, like choosing 
non intended database region etc, The only option left is reinstalling
the appliance or create new. Having a "master reset" function to reset
a broken appliance to a "freshly installed" state would very beneficial
in such situations.

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

Comment 2 Nick Carboni 2016-02-29 14:32:21 UTC
Does the "Setup Database Region" appliance_console option not do this?  It is my understanding that it will recreate the database region from scratch.

Comment 3 Prasad Mukhedkar 2016-03-08 10:33:56 UTC
Nick, I doesnt work. If you try to setup database region on a appliance 
where database is already existed. It throws following error :

Initialize postgresql starting
Initialize postgresql failed with error - service exit code: 1.
See /var/www/miq/vmdb/log/appliance_console.log for details.

[----] I, [2016-03-08T05:23:45.901128 #30792:963994]  INFO -- : MIQ(ApplianceConsole::InternalDatabaseConfiguration#initialize_postgresql) : starting
[----] E, [2016-03-08T05:23:46.091776 #30792:963994] ERROR -- : MIQ(ApplianceConsole::InternalDatabaseConfiguration#initialize_postgresql)  Command failed: service exit code: 1. Error: Hint: the preferred way to do this is now "/opt/rh/rh-postgresql94/root/usr/bin/postgresql-setup --initdb --unit rh-postgresql94-postgresql"
 * Initializing database in '/var/opt/rh/rh-postgresql94/lib/pgsql/data'
ERROR: Data directory /var/opt/rh/rh-postgresql94/lib/pgsql/data is not empty!
ERROR: Initializing database failed, possibly see /var/lib/pgsql/initdb_rh-postgresql94-postgresql.log
. Output: . At: /var/www/miq/vmdb/gems/pending/appliance_console/internal_database_configuration.rb:160:in `run_initdb'

If you first drop the database and then try "Setup Database Region", It 
works but I think we should provide a out-of-box option to reset an appliance.
My be a command or something with all the warning in-place.

Comment 4 Nick Carboni 2016-03-08 13:32:58 UTC
I was just able to do this on 5.5.2.4

Steps:
1. Create database (appliance_console option 8 "Configure Database")
2. Allow application to start
3. Stop evm server (appliance_console option 13 "Stop EVM Server Processes")
4. Reset region (appliance_console option 7 "Setup Database Region")
5. Start evm server (appliance_console option 14 "Start EVM Server Processes")

After this all of the data created between step 1 and 3 will be removed in place of a clean seeded database with the region number specified in step 4.

Note: Step 1 and 4 are different options in the console, it looks like you may have tried to use option 8 ("Configure Database") when you should have used option 7 ("Setup Database Region")

Can you please try these steps and let me know if this is what you are looking for?

Thanks

Comment 5 Nick Carboni 2016-03-18 21:37:06 UTC
https://github.com/ManageIQ/manageiq/pull/7407

This change should make the option more clear.

Comment 7 CFME Bot 2016-03-24 13:40:59 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/d8ba11c35249d90c55e60b1bf80bd2991f2be83c

commit d8ba11c35249d90c55e60b1bf80bd2991f2be83c
Author:     Nick Carboni <ncarboni>
AuthorDate: Wed Mar 16 16:57:07 2016 -0400
Commit:     Nick Carboni <ncarboni>
CommitDate: Wed Mar 23 08:57:12 2016 -0400

    Combine appliance console database options
    
    Add a new menu after database config which lists
    more descriptive options instead of traversing
    multiple question menus.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1277335

 gems/pending/appliance_console.rb                  | 95 ++++++++++------------
 .../appliance_console/database_configuration.rb    | 13 ++-
 .../external_database_configuration.rb             | 12 +--
 .../internal_database_configuration.rb             | 11 +++
 gems/pending/appliance_console/locales/en.yml      |  2 -
 .../database_configuration_spec.rb                 |  2 +
 6 files changed, 73 insertions(+), 62 deletions(-)

Comment 8 CFME Bot 2016-03-24 13:41:03 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/8e17c5168d2ace7673832302a219d409e303545f

commit 8e17c5168d2ace7673832302a219d409e303545f
Author:     Nick Carboni <ncarboni>
AuthorDate: Tue Mar 22 09:51:40 2016 -0400
Commit:     Nick Carboni <ncarboni>
CommitDate: Wed Mar 23 08:57:12 2016 -0400

    Create interactive method for configuring a database
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1277335

 gems/pending/appliance_console.rb                  | 33 +++++-----------------
 .../appliance_console/database_configuration.rb    | 16 +++++++++++
 2 files changed, 23 insertions(+), 26 deletions(-)

Comment 9 Nandini Chandra 2016-04-21 23:45:43 UTC
Verified in 5.6 Beta 2

Comment 11 errata-xmlrpc 2016-06-29 15:02:06 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/RHBA-2016:1348