Bug 1590300 - Creating DB without the UUID extension messes scripts in the data director and causing an error.
Summary: Creating DB without the UUID extension messes scripts in the data director an...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: Database.Core
Version: 4.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ovirt-4.2.5
: ---
Assignee: Eli Mesika
QA Contact: Lucie Leistnerova
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-06-12 11:48 UTC by shani
Modified: 2018-07-31 15:27 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-07-31 15:27:23 UTC
oVirt Team: Infra
Embargoed:
rule-engine: ovirt-4.2+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 92217 0 master MERGED db: abort if UUID extension is not installed 2020-08-21 14:18:01 UTC
oVirt gerrit 92797 0 ovirt-engine-4.2 MERGED db: abort if UUID extension is not installed 2020-08-21 14:18:01 UTC

Description shani 2018-06-12 11:48:29 UTC
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:
---

Comment 1 Doron Fediuck 2018-06-13 06:18:56 UTC
Is there a way to prevent this at install time by making sure the UUID extension is installed?

Comment 2 Eli Mesika 2018-06-17 09:38:15 UTC
(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

Comment 3 Lucie Leistnerova 2018-07-23 09:58:28 UTC
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

Comment 4 Sandro Bonazzola 2018-07-31 15:27:23 UTC
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.


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