update quota fails with long type values

Bug #1433052 reported by Ankit Agrawal
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Low
Liyingjun
OpenStack Compute (nova)
Fix Released
Low
Liyingjun

Bug Description

Update quota with long type value (10000000000) fails with Internal Server Error (HTTP 500). If we update quota with multiple values in one request where one of the value is of long type, update quota fails because of DBError but few of the quota values are updated in database.

Steps to reproduce:

1. Check current quotas
$ cinder quota-show 880cd5150d8a46a09c32b51f3d0d9a7c

+-----------------------+-------+
| Property | Value |
+-----------------------+-------+
| gigabytes | 52 |
| gigabytes_lvmdriver-1 | -1 |
| snapshots | 50 |
| snapshots_lvmdriver-1 | -1 |
| volumes | 50 |
| volumes_lvmdriver-1 | -1 |
+-----------------------+-------+

2. Update quotas with multi-value where value of --volumes is of long type
$ cinder quota-update 880cd5150d8a46a09c32b51f3d0d9a7c --volumes 10000000000 --gigabytes 62 --snapshots 62

you will see following error on terminal

ERROR: Internal Server Error (HTTP 500) (Request-ID: req-e00a068a-a0d4-4665-b213-176f7ba1191e)

3. Check quotas now and you will find updated gigabytes value in quotas.
$ cinder quota-show 880cd5150d8a46a09c32b51f3d0d9a7c
+-----------------------+-------+
| Property | Value |
+-----------------------+-------+
| gigabytes | 62 |
| gigabytes_lvmdriver-1 | -1 |
| snapshots | 50 |
| snapshots_lvmdriver-1 | -1 |
| volumes | 50 |
| volumes_lvmdriver-1 | -1 |
+-----------------------+-------+

Tags: quotas
Liyingjun (liyingjun)
Changed in cinder:
status: New → Confirmed
assignee: nobody → Liyingjun (liyingjun)
Revision history for this message
Liyingjun (liyingjun) wrote :

This will cause a DBError:

2015-03-17 20:20:44.861 TRACE nova.api.openstack DBError: (DataError) (1264, "Out of range value for column 'hard_limit' at row 1") 'INSERT INTO quotas (created_at, updated_at, deleted_at, deleted, project_id, resource, hard_limit) VALUES (%s, %s, %s, %s, %s, %s, %s)' (datetime.datetime(2015, 3, 17, 12, 20, 44, 849766), None, None, 0, '97f2ce5b140346e09e68141df141a857', 'instances', 10000000000)

Changed in nova:
assignee: nobody → Liyingjun (liyingjun)
Revision history for this message
Ankit Agrawal (ankitagrawal) wrote :

Hi Liyingjun, I am working on this issue. Can I reassign it to me.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/165068

Changed in cinder:
status: Confirmed → In Progress
Changed in nova:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/165069

Revision history for this message
Liyingjun (liyingjun) wrote :

Hi Ankit, i didn't see your comment, sorry, but i have uploaded the patch here https://review.openstack.org/#/c/165068/, if you get a better idea, please feel free to reassign, and i'll abandon my patch..

Changed in nova:
importance: Undecided → Low
tags: added: quotas
Mike Perez (thingee)
Changed in cinder:
importance: Undecided → Low
Mike Perez (thingee)
Changed in cinder:
milestone: none → kilo-rc1
Mike Perez (thingee)
Changed in cinder:
milestone: kilo-rc1 → none
melanie witt (melwitt)
tags: removed: ntt
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on cinder (master)

Change abandoned by Li Yingjun (<email address hidden>) on branch: master
Review: https://review.openstack.org/196490

Changed in cinder:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/165069
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=19c01509ca261c1153fefb447305c0a31740b712
Submitter: Jenkins
Branch: master

commit 19c01509ca261c1153fefb447305c0a31740b712
Author: liyingjun <email address hidden>
Date: Tue Mar 17 21:16:35 2015 +0800

    Validate maximum limit for quota

    Currently, when updating quota using limit larger than 2**31 -1,
    there will be a DBError. The maximum limit needs to be validated.
    And the maximum value is defined by SQL integer type INT, which
    is a general value:
    http://dev.mysql.com/doc/refman/5.0/en/integer-types.html
    http://www.postgresql.org/docs/9.1/static/datatype-numeric.html

    Change-Id: Idf890c57342378d0a71f6b18eb42425d463b13ef
    Closes-bug: #1433052

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → liberty-2
status: Fix Committed → Fix Released
Changed in cinder:
milestone: none → liberty-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: liberty-2 → 12.0.0
Thierry Carrez (ttx)
Changed in cinder:
milestone: liberty-2 → 7.0.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.