create aggregate

Bug #1219693 reported by Xurong Yang
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
wingwj

Bug Description

Create aggregate fails when input metadata "availability_zone" length >255(models.py value = Column(String(255), nullable=False)),Exception is raised but record in DB is not rolled back.

Tags: db
Jake Liu (jake-liu)
Changed in nova:
assignee: nobody → Jake Liu (jake-liu)
Revision history for this message
Jake Liu (jake-liu) wrote :
Download full text (4.0 KiB)

Hi Frank, just did some test according to your test steps but did not reproduce this.

From my test you can see that once the length of metadata value exceeds 255, then the value will be truncated to 255 without exception, this seems to be a design behavior for database behavior.

Please show your comments if any. Thanks!

-- Jake

jake@jake1:~$ nova aggregate-set-metadata 2 availability_zone=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
/usr/lib/python2.7/dist-packages/gobject/constants.py:24: Warning: g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed
  import gobject._gobject
Aggregate 2 has been successfully updated.
+----+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Id | Name | Availability Zone | Hosts | Metadata |
+----+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 2 | agg1 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc...

Read more...

tags: added: db
Revision history for this message
David Ripton (dripton) wrote :

It depends on the DB and how it's configured. PostgreSQL gives an error if you try to shove 256+ characters into a 255-character field. MySQL truncates by default, but can be configured to give an error.

We should do the truncation in our code so the behavior is consistent across DBs.

Changed in nova:
importance: Undecided → Medium
status: New → Triaged
Xurong Yang (idopra)
Changed in nova:
assignee: Jake Liu (jake-liu) → XuRong Yang (idopra)
Xurong Yang (idopra)
Changed in nova:
status: Triaged → In Progress
wanghong (w-wanghong)
Changed in nova:
assignee: XuRong Yang (idopra) → wanghong (w-wanghong)
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/53789

wanghong (w-wanghong)
Changed in nova:
assignee: wanghong (w-wanghong) → nobody
wingwj (wingwj)
Changed in nova:
assignee: nobody → wingwj (wingwj)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

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

Reviewed: https://review.openstack.org/79529
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=11b9305e3f0dcff7f5f92863cfd3679fd7b6a6a3
Submitter: Jenkins
Branch: master

commit 11b9305e3f0dcff7f5f92863cfd3679fd7b6a6a3
Author: wingwj <email address hidden>
Date: Tue Mar 11 11:38:14 2014 +0800

    Check the length of aggregate metadata

    PostgreSQL gives an error if you try to shove 256+ characters
    into a 255-character field. So we need raise a HTTPBadRequest
    explanation if the length of aggregate_metadata.keys or
    aggregate_metadata.values is above 255.

    Change-Id: I2c778f2237ba5bd2aa8335a0eae80f3aad3e9157
    Closes-Bug: #1219693

Changed in nova:
status: In Progress → Fix Committed
Changed in nova:
milestone: none → juno-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: juno-2 → 2014.2
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.