Bug 879918 - [rhevm-upgrade] upgrade from 3.0.7 to SI24.4 fails: ERROR: insert or update on table "vm_device" violates foreign key constraint "fk_vm_device_vm _static"
[rhevm-upgrade] upgrade from 3.0.7 to SI24.4 fails: ERROR: insert or update ...
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-setup (Show other bugs)
x86_64 Linux
urgent Severity urgent
: ---
: 3.1.0
Assigned To: Eli Mesika
Pavel Stehlik
integration infra
: TestBlocker
Depends On:
  Show dependency treegraph
Reported: 2012-11-25 07:41 EST by Haim
Modified: 2015-09-22 09 EDT (History)
10 users (show)

See Also:
Fixed In Version: si24.5
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-12-13 10:43:56 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Haim 2012-11-25 07:41:03 EST
Description of problem:

upgrade of QE production setup running 3.0.7 to latest SI24.4 (RC) is failing on the following:

2012-11-25 13:41:11::DEBUG::common_utils::341::root:: stderr = psql:upgrade/03_01_0440_vm_device_upgrade_data.sql:194: ERROR:  insert or update on table "vm_device" violates foreign key constraint "fk_vm_device_vm
DETAIL:  Key (vm_id)=(7cbdb1f6-e8dc-4c9b-9b60-60c1224428bf) 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) select id, vmt_guid, 'interface', 'bridge', '', null, '', true
, true, false from vm_interface where vmt_guid IS NOT NULL"
PL/pgSQL function "__temp_vm_device_upgrade_data" line 21 at SQL statement

2012-11-25 13:41:11::DEBUG::common_utils::342::root:: retcode = 3
2012-11-25 13:41:11::ERROR::rhevm-upgrade::1264::root:: Traceback (most recent call last):
  File "/usr/bin/rhevm-upgrade", line 1250, in main
    runFunc([db.update], MSG_INFO_DB_UPDATE)
  File "/usr/bin/rhevm-upgrade", line 663, in runFunc
  File "/usr/bin/rhevm-upgrade", line 601, in update
    output, rc = utils.execCmd(cmdList=cmd, failOnError=True, msg=MSG_ERROR_UPDATE_DB)
  File "/usr/share/ovirt-engine/scripts/common_utils.py", line 345, in execCmd
    raise Exception(msg)
Exception: Error: Database update failed

data-base is attached - just run upgrade script on it.
Comment 8 Eli Mesika 2012-11-26 04:06:26 EST
This bug is a result of missing FK between vmt_guid in vm_interface and
vm_guid in vm_static.
This cause junk interface left in vm_interface when a template that
has interfaces is removed.
Since in upgrade from 3.0 to 3.1 we added the vm_device table, there is
an attempt to insert those junk interfaces to vm_device that fails on
the FK constraint between vm_device and vm_static.
Comment 9 Eli Mesika 2012-11-26 04:08:29 EST
Comment 12 Eli Mesika 2012-11-26 04:55:39 EST
fixed in commit : cca1d99

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