Description of problem: I attempted to move existing RHEV-M from old machine to newly installed machine. I used file + database backup & restore procedures described in https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Virtualization/3.1/html/Administration_Guide/appe-Backups.html . Version-Release number of selected component (if applicable): rhevm-dbscripts-3.1.0-43.el6ev.noarch How reproducible: 100 % Steps to Reproduce: 0. Backup database from some existing RHEV-M 3.1.2 installation and transfer database backup to clean machine 1. Install clean RHEV-M 3.1.2 2. Run rhevm-setup and answer all questions 3. $ service ovirt-engine stop 4. Restore all configuration files as documented in https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Virtualization/3.1/html/Administration_Guide/Restoring_Red_Hat_Enterprise_Virtualization_Manager_configuration_files.html 4. Try to restore database: $ /usr/share/ovirt-engine/dbscripts/restore.sh -u engine -f /home/brq/pspacek/engine-2013-02-13T12-53-58.sql -d engine -r Actual results: See attached console output. Database was not dropped and restoration process spit huge amount of errors. Expected results: Database is restored cleanly. (Note -r option.) Additional info: I dropped DB manually and tried restore script again. After that, the restore script died with "psql: FATAL: database "engine" does not exist". Workaround: $ dropdb -U postgres engine $ psql -U postgres postgres=# CREATE DATABASE engine WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8'; postgres=# ALTER DATABASE engine OWNER TO engine; ALTER DATABASE
Created attachment 696802 [details] Console session
After manual dropping the database I noticed one other problem with restore script: The script refused to create C functions with some permission error. I'm not sure if it is result of dropping of the database or what else went wrong, but I had to create all C functions by hand. My first attempt failed: $ psql -U engine engine=> CREATE FUNCTION uuid_generate_v1() RETURNS uuid engine-> LANGUAGE c STRICT engine-> AS '$libdir/uuid-ossp', 'uuid_generate_v1'; ERROR: permission denied for language c I used procedure from: http://stackoverflow.com/questions/7014437/error-permission-denied-for-language-c Then I was able to create all functions after logging as "postgres" user. $ psql -U postgres -d engine <now copy&paste CREATE FUNCTION and ALTER FUNCTION statements from backup.sql file to postgres console> It was my first experience with Postgres, so most probably some more straight-forward way exists.
fixed in commit : befc68a
Created attachment 741118 [details] Output of restore.sh script
After reproducing steps below, bug still exist, see attachment.
Reproduced on sf13.
this commit was merged in sf13.1 , please recheck
I not sure that problem in merge, because I received dropdb error: dropdb: database removal failed: ERROR: database "engine" is being accessed by other users DETAIL: There are 1 other session(s) using the database.
After killing all postgres files with: for i in 'lsof | grep postgres | awk {'print $2'} | uniq'; do kill -9 $i And start postgres: /etc/init.d/postgresql start restore.sh script work fine Thanks to Haim
(In reply to comment #12) > I not sure that problem in merge, because I received dropdb error: > dropdb: database removal failed: ERROR: database "engine" is being accessed > by other users > DETAIL: There are 1 other session(s) using the database. IMHO the script should detect this situation and stop and do not change anything in DB. Also, some helpful error message like 'Stop ovirt-engine before you start with DB restoration.' or something similar would be really useful.
3.2 has been released