Description of problem: When DB is created without the UUID extension, the upgrade messes some scripts in the data directory. The DB is engine_dao_tests and it was created as described here: https://github.com/oVirt/ovirt-engine#dao-tests Version-Release number of selected component (if applicable): master - commit efea806942d How reproducible: 100% Steps to Reproduce: 1. Create DB: su - postgres -c "create database engine_dao_tests owner engine template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';" 2. run: PGPASSWORD=engine \ ./packaging/dbscripts/schema.sh \ -c apply -u engine -d engine_dao_tests Actual results: Running upgrade sql script './packaging/dbscripts/upgrade/04_00_0070_enable_ballon_for_blank_template.sql'... psql:./packaging/dbscripts/upgrade/04_00_0070_enable_ballon_for_blank_template.sql:44: ERROR: insert or update on table "vm_device" violates foreign key constraint "fk_vm_device_vm_static" DETAIL: Key (vm_id)=(00000000-0000-0000-0000-000000000000) is not present in table "vm_static". CONTEXT: SQL statement "INSERT INTO vm_device ( device_id, vm_id, type, device, address, boot_order, spec_params, is_managed, is_plugged, is_readonly, _create_date, _update_date, alias ) SELECT uuid_generate_v1(), '00000000-0000-0000-0000-000000000000', 'balloon', 'memballoon', '', 0, '{"model" : "virtio"}', true, true, true, 'now', NULL, NULL" PL/pgSQL function __temp_add_balloon_to_blank_if_not_present() line 11 at SQL statement FATAL: Cannot execute sql command: --file=./packaging/dbscripts/upgrade/04_00_0070_enable_ballon_for_blank_template.sql Expected results: no error Additional info: ---
Is there a way to prevent this at install time by making sure the UUID extension is installed?
(In reply to Doron Fediuck from comment #1) > Is there a way to prevent this at install time by making sure the UUID > extension is installed? Yes, please refer to the fixing patch
Running schema.sh on database without UUID extension fails with proper error. uuid-ossp extension is missing Please install uuid-ossp extension in the database by running: 'CREATE EXTENSION "uuid-ossp";' Otherwise it runs successfully. verified in ovirt-engine-4.2.5.1-0.1.el7ev.noarch, ovirt-engine-dbscripts-4.2.5.1-0.1.el7ev.noarch
This bugzilla is included in oVirt 4.2.5 release, published on July 30th 2018. Since the problem described in this bug report should be resolved in oVirt 4.2.5 release, it has been closed with a resolution of CURRENT RELEASE. If the solution does not work for you, please open a new bug report.