Bug 947344 - rhevm-upgrade creates log/helping files in /usr/share/ovirt-engine/dbscripts
Summary: rhevm-upgrade creates log/helping files in /usr/share/ovirt-engine/dbscripts
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 3.2.0
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ---
: 3.2.0
Assignee: Eli Mesika
QA Contact: Ilanit Stein
URL:
Whiteboard: infra
Depends On:
Blocks: 954138
TreeView+ depends on / blocked
 
Reported: 2013-04-02 07:54 UTC by Jiri Belka
Modified: 2016-02-10 19:38 UTC (History)
15 users (show)

Fixed In Version: sf15
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 954138 (view as bug list)
Environment:
Last Closed:
oVirt Team: Infra
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 14298 0 None None None Never

Description Jiri Belka 2013-04-02 07:54:47 UTC
Description of problem:

I find it very strange that log is saved in /usr/share/ovirt-engine/dbscripts as well as some other help files. /usr on UNIX systems holds static files. The log should be saved to some other location, helping files too.

# find /usr/share/ovirt-engine/dbscripts -mtime 0 -exec sh -c '[ -d {} ] && ls -ld {} || ls -l {}' {} {} \;
drwxr-xr-x. 4 root root 4096 Apr  2 09:22 /usr/share/ovirt-engine/dbscripts
drwxr-xr-x. 4 root root 20480 Apr  2 09:22 /usr/share/ovirt-engine/dbscripts/upgrade
drwxr-xr-x. 2 root root 4096 Apr  2 09:22 /usr/share/ovirt-engine/dbscripts/upgrade/post_upgrade
drwxr-xr-x. 2 root root 4096 Apr  2 09:22 /usr/share/ovirt-engine/dbscripts/upgrade/pre_upgrade
-rw-r--r--. 1 root root 681862 Apr  2 09:23 /usr/share/ovirt-engine/dbscripts/.schema
-rw-r--r--. 1 root root 19370 Apr  2 09:22 /usr/share/ovirt-engine/dbscripts/.engine_2013_04_02_09_21_42.scripts.md5
drwxr-xr-x. 2 root root 4096 Apr  2 09:22 /usr/share/ovirt-engine/dbscripts/db_schema_version_check
-rw-r--r--. 1 root root 7503150 Apr  2 09:23 /usr/share/ovirt-engine/dbscripts/upgrade.sh.log

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

How reproducible:
100%

Steps to Reproduce:
1. rhevm-upgrade
2. check for new files (see find command above)
3.
  
Actual results:
breaks usual unix filesystem habits

Expected results:
do it unix way

Additional info:

Comment 2 Ofer Schreiber 2013-04-14 08:21:53 UTC
Eli, 
Looking at dbfunctions.sh (and some other scripts), it looks like the scripts create the log/md5/.schema/etc file in the current running dir, without any option to set the log dir to a saner place (like /var or).

Any chance I'm missing something? otherwise, it looks like a db/infra issue.

Comment 3 Eli Mesika 2013-04-14 10:11:11 UTC
(In reply to comment #2)
> Eli, 
> Looking at dbfunctions.sh (and some other scripts), it looks like the
> scripts create the log/md5/.schema/etc file in the current running dir,
> without any option to set the log dir to a saner place (like /var or).
> 
> Any chance I'm missing something? otherwise, it looks like a db/infra issue.

*.md5 , .schema are created at dbscripts and should remain as such

The logfile location & name is controlled by the logfile can be set by using the -l LOGFILE  parameter.

The default value of the LOGFILE is set in dbscustomfunctions.sh

Comment 4 Ofer Schreiber 2013-04-14 11:46:53 UTC
> *.md5 , .schema are created at dbscripts and should remain as such

This is wrong, you can't create *ANY* new file in /usr/share, it violates the linux FHS.

(A patch for the setup suppliny "-l" parameter to the upgrade script was pushed into http://gerrit.ovirt.org/13893, I'm moving this bug to infra team, as no files should be created in /usr/share)

Comment 5 Barak 2013-04-14 14:56:13 UTC
Eli,

The patch mentioned in comment #4 handles the log file location.

How complicated is it to move the *.md5 , .schema files to a configurable (by commandline) location ?

I understand other other scripts are using these files.

Comment 6 Eli Mesika 2013-04-15 06:42:00 UTC
(In reply to comment #5)
> Eli,
> 
> The patch mentioned in comment #4 handles the log file location.
> 
> How complicated is it to move the *.md5 , .schema files to a configurable
> (by commandline) location ?


It is not a question of how complicated, the md5 are used internally by the scripts and should not be exposed to the user and therefore should remain in dbscripts directory.

The .schema is a auto-generated file that shows how the updated schema looks like , so , if you want to do a change, you can look in this file and see how your change affects the up-to-date database and therefore this file should remain in dbscripts as well.

> 
> I understand other other scripts are using these files.

Comment 12 Eli Mesika 2013-04-28 14:43:58 UTC
New patch :

1) Adding -g parameter to create_db.sh create_schema.sh and upgrade.sh
to disable MD5 files generation (default NOMD5=false)
2) Adding -m MD5DIR parameter to create_db.sh create_schema.sh and
upgrade.sh to set the MD% directory (default =MD5DIR=$(pwd))
3) Removing auto-generation of .schema files and creating a
exportDbSchema.sh that generates this file since it is used only for
development

Comment 13 Eli Mesika 2013-04-29 23:40:13 UTC
fixed in commit: 44ae2c8

Comment 14 Alon Bar-Lev 2013-04-30 00:08:25 UTC
Not exactly post, as packaging is not done yet.

Alex, you should use these new parameters.

Comment 15 Ilanit Stein 2013-05-22 07:21:00 UTC
Verified on sf12 -> sf17:

On sf12, clean install, the files, mentioned in the description, exist, and after upgrade to sf17, new ones were not generated: 

On sf-12 clean install:
----------------------
[root@istein-32 yum.repos.d]# find /usr/share/ovirt-engine/dbscripts -mtime 0 -exec sh -c '[ -d {} ] && ls -ld {} || ls -l {}' {} {} \;
drwxr-xr-x 4 root root 4096 May 21 21:34 /usr/share/ovirt-engine/dbscripts
drwxr-xr-x 2 root root 4096 May 21 21:29 /usr/share/ovirt-engine/dbscripts/db_schema_version_check
-rw-r--r-- 1 root root 681591 May 21 21:34 /usr/share/ovirt-engine/dbscripts/.schema
drwxr-xr-x 4 root root 20480 May 21 21:29 /usr/share/ovirt-engine/dbscripts/upgrade
drwxr-xr-x 2 root root 4096 May 21 21:29 /usr/share/ovirt-engine/dbscripts/upgrade/post_upgrade
drwxr-xr-x 2 root root 4096 May 21 21:29 /usr/share/ovirt-engine/dbscripts/upgrade/pre_upgrade
-rw-r--r-- 1 root root 19370 May 21 21:34 /usr/share/ovirt-engine/dbscripts/.engine.scripts.md5
-rw-r--r-- 1 root root 970783 May 21 21:34 /usr/share/ovirt-engine/dbscripts/create_db.sh.log
[root@istein-32 yum.repos.d]# date
Tue May 21 21:37:11 IDT 2013

After upgrade to sf17:
---------------------
[root@istein-32 yum.repos.d]# find /usr/share/ovirt-engine/dbscripts -mtime 0 -exec sh -c '[ -d {} ] && ls -ld {} || ls -l {}' {} {} \;
drwxr-xr-x 4 root root 4096 May 21 21:48 /usr/share/ovirt-engine/dbscripts
drwxr-xr-x 2 root root 4096 May 21 21:48 /usr/share/ovirt-engine/dbscripts/db_schema_version_check
-rw-r--r-- 1 root root 681591 May 21 21:34 /usr/share/ovirt-engine/dbscripts/.schema
drwxr-xr-x 4 root root 20480 May 21 21:48 /usr/share/ovirt-engine/dbscripts/upgrade
drwxr-xr-x 2 root root 4096 May 21 21:48 /usr/share/ovirt-engine/dbscripts/upgrade/post_upgrade
drwxr-xr-x 2 root root 4096 May 21 21:48 /usr/share/ovirt-engine/dbscripts/upgrade/pre_upgrade
-rw-r--r-- 1 root root 19544 May 21 21:48 /usr/share/ovirt-engine/dbscripts/.engine_2013_05_21_21_47_36.scripts.md5
-rw-r--r-- 1 root root 19370 May 21 21:34 /usr/share/ovirt-engine/dbscripts/.engine.scripts.md5
-rw-r--r-- 1 root root 970783 May 21 21:34 /usr/share/ovirt-engine/dbscripts/create_db.sh.log
[root@istein-32 yum.repos.d]# find / -name .schema
/usr/share/ovirt-engine/dbscripts/.schema

Comment 16 Itamar Heim 2013-06-11 09:25:05 UTC
3.2 has been released

Comment 17 Itamar Heim 2013-06-11 09:30:06 UTC
3.2 has been released

Comment 18 Itamar Heim 2013-06-11 09:45:28 UTC
3.2 has been released


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