Bug 1030834 - [restore.sh] restore.sh is doing restore.sh.log in /usr directory
Summary: [restore.sh] restore.sh is doing restore.sh.log in /usr directory
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 3.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: 3.4.0
Assignee: Eli Mesika
QA Contact: Jiri Belka
URL:
Whiteboard: infra
Depends On:
Blocks: 1069714 rhev3.4beta 1142926
TreeView+ depends on / blocked
 
Reported: 2013-11-15 09:28 UTC by Jiri Belka
Modified: 2016-02-10 19:40 UTC (History)
8 users (show)

Fixed In Version: ovirt-3.4.0-alpha1
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1069714 (view as bug list)
Environment:
Last Closed:
oVirt Team: Infra
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
oVirt gerrit 22425 None None None Never

Description Jiri Belka 2013-11-15 09:28:42 UTC
Description of problem:

restore.sh is doing restore.sh.log in /usr directory

-%-
/tmp/restore.8170:execve("/usr/bin/psql", ["psql", "-w", "--pset=tuples_only=on", "--set", "ON_ERROR_STOP=1", "--file=/tmp/tmp.5nmzHRe65M", "--dbname=engine", "--username=engine", "--host=localhost", "--port=5432", "--log-file=restore.sh.log"], [/* 22 vars */]) = 0
-%-

...which is /usr/share/ovirt-engine/dbscripts, this is not acceptable.

Example run:

-%-
# strace -f -ff -o /tmp/restore ./restore.sh -u engine -d engine -f /root/backup.sql
...skip...
# egrep "restore\.sh\.log|/tmp" /tmp/restore.82*
/tmp/restore.8217:read(3, "/tmp/tmp.tkDJGIUM7T\n", 128) = 20
/tmp/restore.8217:open("/tmp/tmp.tkDJGIUM7T", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
/tmp/restore.8219:open("/tmp/tmp.tkDJGIUM7T", O_RDWR|O_CREAT|O_EXCL, 0600) = 3
/tmp/restore.8219:write(1, "/tmp/tmp.tkDJGIUM7T\n", 20)   = 20
/tmp/restore.8220:execve("/usr/bin/psql", ["psql", "-w", "--pset=tuples_only=on", "--set", "ON_ERROR_STOP=1", "--file=/tmp/tmp.tkDJGIUM7T", "--dbname=template1", "--username=engine", "--host=localhost", "--port=5432", "--log-file=restore.sh.log"], [/* 29 vars */]) = 0
/tmp/restore.8220:open("restore.sh.log", O_WRONLY|O_CREAT|O_APPEND, 0666) = 4
/tmp/restore.8220:open("/tmp/tmp.tkDJGIUM7T", O_RDONLY)   = 5
/tmp/restore.8222:execve("/bin/rm", ["rm", "/tmp/tmp.tkDJGIUM7T"], [/* 29 vars */]) = 0
/tmp/restore.8222:newfstatat(AT_FDCWD, "/tmp/tmp.tkDJGIUM7T", {st_mode=S_IFREG|0600, st_size=62, ...}, AT_SYMLINK_NOFOLLOW) = 0
/tmp/restore.8222:unlinkat(AT_FDCWD, "/tmp/tmp.tkDJGIUM7T", 0) = 0
/tmp/restore.8226:read(3, "/tmp/tmp.NzrEN0ZeJR\n", 128) = 20
/tmp/restore.8226:open("/tmp/tmp.NzrEN0ZeJR", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
/tmp/restore.8228:open("/tmp/tmp.NzrEN0ZeJR", O_RDWR|O_CREAT|O_EXCL, 0600) = 3
/tmp/restore.8228:write(1, "/tmp/tmp.NzrEN0ZeJR\n", 20)   = 20
/tmp/restore.8229:execve("/usr/bin/psql", ["psql", "-w", "--pset=tuples_only=on", "--set", "ON_ERROR_STOP=1", "--file=/tmp/tmp.NzrEN0ZeJR", "--dbname=engine", "--username=engine", "--host=localhost", "--port=5432", "--log-file=restore.sh.log"], [/* 29 vars */]) = 0
/tmp/restore.8244:read(3, "/tmp/tmp.FvPeWijFOs\n", 128) = 20
/tmp/restore.8244:open("/tmp/tmp.FvPeWijFOs", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
/tmp/restore.8246:open("/tmp/tmp.FvPeWijFOs", O_RDWR|O_CREAT|O_EXCL, 0600) = 3
/tmp/restore.8246:write(1, "/tmp/tmp.FvPeWijFOs\n", 20)   = 20
/tmp/restore.8247:execve("/usr/bin/psql", ["psql", "-w", "--pset=tuples_only=on", "--set", "ON_ERROR_STOP=1", "--file=/tmp/tmp.FvPeWijFOs", "--dbname=engine", "--username=engine", "--host=localhost", "--port=5432", "--log-file=restore.sh.log"], [/* 29 vars */]) = 0

# ls -l restore.sh.log
-rw-r--r--. 1 root root 126 Nov 15 10:24 restore.sh.log
-%-

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

How reproducible:
100%

Steps to Reproduce:
1. run restore.sh
2. check if restore.sh.log exists in /usr dir and it is recent
3.

Actual results:
log in /usr dir

Expected results:
1. /usr is not place for logs, 2. will we have such logs place all around whole system?

Additional info:
/var/log/ovirt-engine ... somewhere there would be good place?

Comment 1 Jiri Belka 2013-11-15 11:03:40 UTC
Another thing... The command does not drop database:

-%-
# su - postgres -c "psql -d template1 -c \"drop database engine;\""
# su - postgres
$ psql 
psql (8.4.18)
Type "help" for help.

postgres=# \l
                                  List of databases
   Name    |  Owner   | Encoding |  Collation  |    Ctype    |   Access privileges   
-----------+----------+----------+-------------+-------------+-----------------------
 engine    | engine   | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
                                                             : postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
                                                             : postgres=CTc/postgres
(4 rows)

Comment 2 Jiri Belka 2013-11-15 11:09:37 UTC
Ignore comment#1, this should go to different BZ.

Comment 3 Sandro Bonazzola 2014-01-14 08:44:37 UTC
ovirt 3.4.0 alpha has been released

Comment 4 Jiri Belka 2014-02-17 09:44:37 UTC
OK, beta2.

restore.sh.log was created in /var/log/ovirt-engine.

# grep restore.sh.log /tmp/restore.*
/tmp/restore.4477:open("/var/log/ovirt-engine/restore.sh.log", O_WRONLY|O_CREAT|O_APPEND, 0666) = 4
/tmp/restore.4486:open("/var/log/ovirt-engine/restore.sh.log", O_WRONLY|O_CREAT|O_APPEND, 0666) = 4
/tmp/restore.5979:open("/var/log/ovirt-engine/restore.sh.log", O_WRONLY|O_CREAT|O_APPEND, 0666) = 4

Comment 7 Itamar Heim 2014-06-12 14:07:08 UTC
Closing as part of 3.4.0


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