Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1540814 - upgrade dbscript fails if multiplication overflows
upgrade dbscript fails if multiplication overflows
Status: CLOSED ERRATA
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine (Show other bugs)
4.1.10
Unspecified Unspecified
unspecified Severity medium
: ovirt-4.2.2
: ---
Assigned To: Shmuel Melamud
Jiri Belka
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2018-02-01 00:16 EST by Doran Moppert
Modified: 2018-05-15 13:49 EDT (History)
12 users (show)

See Also:
Fixed In Version: ovirt-engine-4.2.2
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2018-05-15 13:48:28 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Virt
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
oVirt gerrit 87131 master MERGED core: Fix integer overflow in max_memory_size_mb calculation 2018-02-06 15:51 EST
oVirt gerrit 87258 ovirt-engine-4.2 MERGED core: Fix integer overflow in max_memory_size_mb calculation 2018-02-07 08:06 EST
Red Hat Product Errata RHEA-2018:1488 None None None 2018-05-15 13:49 EDT

  None (edit)
Description Doran Moppert 2018-02-01 00:16:45 EST
Attempting to upgrade when vm_static.mem_size_db contains a value exceeding (2**29-1) fails with the error "integer out of range", leaving the engine down until manual intervention is performed.  This was originally reported as a side effect of the testing taken in bug 1496602.

The offending query is:

/usr/share/ovirt-engine/dbscripts/upgrade/04_01_0640_add_max_memory_size_column.sql
> UPDATE vm_static
>    SET max_memory_size_mb = LEAST(4 * mem_size_mb, 1048576);


A simple fix might be:

> UPDATE vm_static
>    SET max_memory_size_mb = LEAST(4 * LEAST(536870911, mem_size_mb), 1048576);
Comment 2 Yaniv Kaul 2018-02-01 02:53:36 EST
I thought this was fixed some time ago.
Which version was used?
Comment 3 Doran Moppert 2018-02-01 19:19:29 EST
(In reply to Yaniv Kaul from comment #2)
> I thought this was fixed some time ago.
> Which version was used?

I don't think this precise issue was fixed.  Original report was using 4.1.5, and I see the script unmodified in 4.1.9 and upstream master.  I have not tried the full upgrade process to verify the problem, but running this script alone still triggers the error under the conditions described.

I do see a related issue fixed upstream in 2016, using a cleaner method than I suggested:

https://gerrit.ovirt.org/#/c/51420/

which suggests the following change in 04_01_0640_add_max_memory_size_column.sql, which works in my tests:

> UPDATE vm_static
>    SET max_memory_size_mb = LEAST(4 * mem_size_mb::bigint, 1048576);
Comment 4 Michal Skrivanek 2018-02-02 01:18:05 EST
(In reply to Yaniv Kaul from comment #2)
> I thought this was fixed some time ago.

bug 1519811? That's the opposite case. The fix should be trivial
Comment 5 RHV Bugzilla Automation and Verification Bot 2018-02-16 11:24:47 EST
WARN: Bug status (ON_QA) wasn't changed but the folowing should be fixed:

[Found non-acked flags: '{'rhevm-4.2-ga': '?'}', ]

For more info please contact: rhv-devops@redhat.comINFO: Bug status (ON_QA) wasn't changed but the folowing should be fixed:

[Found non-acked flags: '{'rhevm-4.2-ga': '?'}', ]

For more info please contact: rhv-devops@redhat.com
Comment 6 Jiri Belka 2018-02-23 11:56:26 EST
ok,

update from ovirt-engine-4.2.1-0.2.el7.noarch to ovirt-engine-4.2.2.1-0.1.el7.noarch
Comment 7 RHV Bugzilla Automation and Verification Bot 2018-03-16 11:02:35 EDT
INFO: Bug status (VERIFIED) wasn't changed but the folowing should be fixed:

[Tag 'ovirt-engine-4.2.2.4' doesn't contain patch 'https://gerrit.ovirt.org/87258']
gitweb: https://gerrit.ovirt.org/gitweb?p=ovirt-engine.git;a=shortlog;h=refs/tags/ovirt-engine-4.2.2.4

For more info please contact: rhv-devops@redhat.com
Comment 11 errata-xmlrpc 2018-05-15 13:48:28 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2018:1488

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