Bug 1030834 - [restore.sh] restore.sh is doing restore.sh.log in /usr directory
[restore.sh] restore.sh is doing restore.sh.log in /usr directory
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine (Show other bugs)
3.3.0
Unspecified Unspecified
unspecified Severity high
: ---
: 3.4.0
Assigned To: Eli Mesika
Jiri Belka
infra
: ZStream
Depends On:
Blocks: 1069714 rhev3.4beta 1142926
  Show dependency treegraph
 
Reported: 2013-11-15 04:28 EST by Jiri Belka
Modified: 2016-02-10 14:40 EST (History)
8 users (show)

See Also:
Fixed In Version: ovirt-3.4.0-alpha1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1069714 (view as bug list)
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Infra
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
oVirt gerrit 22425 None None None Never

  None (edit)
Description Jiri Belka 2013-11-15 04:28:42 EST
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 06:03:40 EST
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 06:09:37 EST
Ignore comment#1, this should go to different BZ.
Comment 3 Sandro Bonazzola 2014-01-14 03:44:37 EST
ovirt 3.4.0 alpha has been released
Comment 4 Jiri Belka 2014-02-17 04:44:37 EST
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 10:07:08 EDT
Closing as part of 3.4.0

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