Bug 1217641 - database restore fails but doesn't log the error
Summary: database restore fails but doesn't log the error
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Appliance
Version: 5.3.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: GA
: 5.5.0
Assignee: Joe Rafaniello
QA Contact: Ramesh A
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-04-30 22:53 UTC by Brandon Johnson
Modified: 2023-09-14 02:58 UTC (History)
7 users (show)

Fixed In Version: 5.5.0.1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-12-08 13:06:59 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:2551 0 normal SHIPPED_LIVE Moderate: CFME 5.5.0 bug fixes and enhancement update 2015-12-08 17:58:09 UTC

Description Brandon Johnson 2015-04-30 22:53:01 UTC
Description of problem:
cifs-utils not installed by default

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


When trying to restore the database from the application_console (option 6).  It can not restore the database because it cannot mount the smb share because cifs-utils is not installed.  This should be installed by default.

Comment 2 Joe Rafaniello 2015-05-01 19:37:02 UTC
Dave, can you confirm we had cifs-utils on 5.3 and adding it to 5.4 fixes this?

Maybe this is the issue that Nandini ran into?

Comment 3 Joe Rafaniello 2015-05-01 19:40:38 UTC
Also, it's unclear why cifs-utils is not there if we previously had it.  I don't recall us explicitly dropping it.  I just checked our cfme 5.3 rpm and I don't see it listed so perhaps we dropped a different rpm that was pulling it in?

Comment 4 Joe Rafaniello 2015-05-01 21:03:30 UTC
From a 5.3.3.0.0 appliance, we don't have cifs-utils, we do have samba4-libs though:

[root@host vmdb]# rpm -qa |grep smb
[root@host vmdb]# rpm -qa |grep cifs
[root@host vmdb]# rpm -qa |grep samba
samba4-libs-4.0.0-66.el6_6.rc4.x86_64

[root@host vmdb]# rpm -q --requires sssd-ad |grep samba
libsamba-util.so.0()(64bit)
[root@host vmdb]# rpm -q --requires sssd-common-pac |grep samba
libsamba-util.so.0()(64bit)
[root@host vmdb]# rpm -q --requires sssd-ipa |grep samba
libsamba-util.so.0()(64bit)

Comment 5 Joe Rafaniello 2015-05-01 21:30:39 UTC
Brandon, I don't see cifs-utils on a 5.3 or 5.4 appliance.

See comment 4 for 5.3.3.0.0

Below is 5.4.0.0.24:

[root@54host ~]# rpm -qa |grep cifs
[root@54host ~]# rpm -qa |grep smb
[root@54host ~]# rpm -qa |grep samba
samba4-libs-4.0.0-66.el6_6.rc4.x86_64

Are you saying it's not working on 5.3.3 or 5.3 in general too?

Comment 7 Joe Rafaniello 2015-05-05 22:32:56 UTC
Upstream pull request:
https://github.com/ManageIQ/manageiq/pull/2852

This PR doesn't fix an error but should give us information if there is an error.

For example, if I point at a missing database backup location on smb, the /var/www/miq/vmdb/evm.log show this:

Before:
 INFO -- : MIQ(MiqPostgresAdmin.run_cmd) Running command... pg_restore --no-password --dbname vmdb_production --verbose --exit-on-error /mnt/miq_f9d23bb2-f36b-11e4-a8c4-fa163e238bee/jrafanie-backup
ERROR -- : AwesomeSpawn: pg_restore 2>&1 exit code: 1
ERROR -- : AwesomeSpawn:


After:
 INFO -- : MIQ(MiqPostgresAdmin.run_cmd) Running command... pg_restore --no-password --dbname vmdb_production --verbose --exit-on-error /mnt/miq_4916c9d4-f373-11e4-b965-fa163e238bee/jrafanie-backup
ERROR -- : AwesomeSpawn: pg_restore exit code: 1
ERROR -- : AwesomeSpawn: pg_restore: [archiver] could not open input file "/mnt/miq_4916c9d4-f373-11e4-b965-fa163e238bee/jrafanie-backup": No such file or directory


Note, I was able to restore on 5.4.

Brandon, can you please apply this patch to 5.4 and provide your evm.log file:
https://github.com/ManageIQ/manageiq/pull/2852.patch

Comment 8 Joe Rafaniello 2015-05-05 22:35:44 UTC
Brandon, that patch "may" apply to 5.3.

QE and I have tested smb with 5.3 and 5.4 and we were able to backup/restore and use the same for log collection.

Can you provide more insight and logs as to what is failing that led you to install cifs-utils?

Comment 9 CFME Bot 2015-05-06 02:11:01 UTC
New commit detected on manageiq/master:
https://github.com/ManageIQ/manageiq/commit/bb4061ef59409c177197e3c47f6a34e0ed390fc9

commit bb4061ef59409c177197e3c47f6a34e0ed390fc9
Author:     Joe Rafaniello <jrafanie>
AuthorDate: Tue May 5 18:14:45 2015 -0400
Commit:     Joe Rafaniello <jrafanie>
CommitDate: Tue May 5 18:27:06 2015 -0400

    By redirecting STDERR to STDOUT, we missed out on logging the error.
    
    AwesomeSpawn already logs the command, the exit code, and STDERR.
    See https://github.com/ManageIQ/awesome_spawn/blob/f7b6de278d578348551756f0f43ada49a0c1865f/lib/awesome_spawn.rb#L100-101
    
    As an example, if I try to restore a DB with a missing smb/nfs file:
    
    Before:
    ```
     INFO -- : MIQ(MiqPostgresAdmin.run_cmd) Running command... pg_restore --no-password --dbname vmdb_production --verbose --exit-on-error /mnt/miq_f9d23bb2-f36b-11e4-a8c4-fa163e238bee/jrafanie-backup
    ERROR -- : AwesomeSpawn: pg_restore 2>&1 exit code: 1
    ERROR -- : AwesomeSpawn:
    ```
    
    After:
    ```
     INFO -- : MIQ(MiqPostgresAdmin.run_cmd) Running command... pg_restore --no-password --dbname vmdb_production --verbose --exit-on-error /mnt/miq_4916c9d4-f373-11e4-b965-fa163e238bee/jrafanie-backup
    ERROR -- : AwesomeSpawn: pg_restore exit code: 1
    ERROR -- : AwesomeSpawn: pg_restore: [archiver] could not open input file "/mnt/miq_4916c9d4-f373-11e4-b965-fa163e238bee/jrafanie-backup": No such file or directory
    ```
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1217641

 vmdb/lib/db_administration/miq_postgres_admin.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comment 10 Ramesh A 2015-11-19 13:58:42 UTC
Good to go.  Verified and working fine in 5.5.0.11-rc1.20151117182049_653c0d4

1. Deployed a new appliance
2. SSH into into, create a new database using option 8 (with the same region number of the restoring database)
3. Started the evmserverd service
4. Waited for the UI to appear
5. Stopped the evmserverd service
6. Dropped the database using the command "dropdb vmdb_production"
7. Fetched the key using "appliance_console_cli --fetch-key <old_appliance_ip>"
8. Logged into appliance_console
9. Restored database using option 6
10. Started the evmserverd service

evm.log:
========
[----] I, [2015-11-19T07:26:45.749775 #26585:b7b998]  INFO -- : MIQ(Vmdb::Loggers.apply_config) Log level for vim.log has been changed to [WARN]
[----] I, [2015-11-19T07:26:45.916291 #26585:b7b998]  INFO -- : MIQ(PostgresAdmin.runcmd_with_logging) Running command... psql --no-password --dbname postgres --command DROP\ DATABASE\ IF\ EXISTS\ vmdb_production
[----] I, [2015-11-19T07:26:45.955676 #26585:b7b998]  INFO -- : MIQ(PostgresAdmin.runcmd_with_logging) Running command... psql --no-password --dbname postgres --command CREATE\ DATABASE\ vmdb_production\ WITH\ OWNER\ \=\ root\ ENCODING\ \=\ \'UTF8\'
[----] I, [2015-11-19T07:27:03.534923 #26585:b7b998]  INFO -- : MIQ(PostgresAdmin.runcmd_with_logging) Running command... pg_restore --no-password --dbname vmdb_production --verbose --exit-on-error /root/db_backup.cpgd
[----] I, [2015-11-19T07:36:25.978649 #26585:b7b998]  INFO -- : MIQ(EvmDatabaseOps.restore) [vmdb_production] database has been restored from file: [/root/db_backup.cpgd]

Valid Inputs:
=============
Provided the valid location url/path ==> Restored correctly

Invalid Inputs:
===============
Provided invalid inputs like wrong ip, wrong location.  For each wrong entries, it popped up following message "Please provide file that exists"

eg:
===
Enter the location of the local restore file: |/tmp/evm_db.backup| /root/ramesh-test.bkp
Please provide file that exists
?

Comment 12 errata-xmlrpc 2015-12-08 13:06:59 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-2015:2551

Comment 13 Red Hat Bugzilla 2023-09-14 02:58:40 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days


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