← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1425657] [NEW] Create server with an image containing a long unicode property value fails

 

Public bug reported:

Creating a sever using a Glance image which has a long (~256 char)
unicode property value fails with database truncation.

The root cause is the same as bug:
https://bugs.launchpad.net/nova/+bug/1389102
and fix:
https://review.openstack.org/#/c/134597/

What's happening is the nova.utils.get_system_metadata_from_image method
is truncating the Glance property value to 255 characters and this is
then later used downstream in the create to be written to system
metadata.  Databases like PostgreSQL will throw an error because when
the non-English locale string is encoded to be written to the DB it is
greater than the 256 limit of the system metadata database table.

A partial stack is:
...
File "/usr/lib/python2.7/site-packages/nova/api/openstack/compute/servers.py", line 610, in create
  check_server_group_quota=check_server_group_quota)
File "/usr/lib/python2.7/site-packages/nova/hooks.py", line 149, in inner
  rv = f(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 1485, in create
  check_server_group_quota=check_server_group_quota)
File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 1127, in _create_instance
  instance_group, check_server_group_quota)
File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 965, in _provision_instances
  quotas.rollback()
File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 82, in __exit__
  six.reraise(self.type_, self.value, self.tb)
File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 928, in _provision_instances
  num_instances, i, shutdown_terminate)
File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 1385, in create_db_entry_for_new_instance
  instance.create()
File "/usr/lib/python2.7/site-packages/nova/objects/base.py", line 206, in wrapper
  return fn(self, ctxt, *args, **kwargs)
File "/usr/lib/python2.7/site-packages/nova/objects/instance.py", line 613, in create
  db_inst = db.instance_create(context, updates)
File "/usr/lib/python2.7/site-packages/nova/db/api.py", line 636, in instance_create
  return IMPL.instance_create(context, values)
File "/usr/lib/python2.7/site-packages/nova/db/sqlalchemy/api.py", line 145, in wrapper
  return f(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/nova/db/sqlalchemy/api.py", line 1595, in instance_create
....


The fix for this defect will likely be taking the fix from https://review.openstack.org/#/c/134597/ and making a utility method in nova.utils to do safe truncation.  This utility method could then be called from  nova.utils.get_system_metadata_from_image method and its existing location in nova/compute/utils.py

Found in Nova Kilo.

** Affects: nova
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1425657

Title:
  Create server with an image containing a long unicode property value
  fails

Status in OpenStack Compute (Nova):
  New

Bug description:
  Creating a sever using a Glance image which has a long (~256 char)
  unicode property value fails with database truncation.

  The root cause is the same as bug:
  https://bugs.launchpad.net/nova/+bug/1389102
  and fix:
  https://review.openstack.org/#/c/134597/

  What's happening is the nova.utils.get_system_metadata_from_image
  method is truncating the Glance property value to 255 characters and
  this is then later used downstream in the create to be written to
  system metadata.  Databases like PostgreSQL will throw an error
  because when the non-English locale string is encoded to be written to
  the DB it is greater than the 256 limit of the system metadata
  database table.

  A partial stack is:
  ...
  File "/usr/lib/python2.7/site-packages/nova/api/openstack/compute/servers.py", line 610, in create
    check_server_group_quota=check_server_group_quota)
  File "/usr/lib/python2.7/site-packages/nova/hooks.py", line 149, in inner
    rv = f(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 1485, in create
    check_server_group_quota=check_server_group_quota)
  File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 1127, in _create_instance
    instance_group, check_server_group_quota)
  File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 965, in _provision_instances
    quotas.rollback()
  File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 82, in __exit__
    six.reraise(self.type_, self.value, self.tb)
  File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 928, in _provision_instances
    num_instances, i, shutdown_terminate)
  File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 1385, in create_db_entry_for_new_instance
    instance.create()
  File "/usr/lib/python2.7/site-packages/nova/objects/base.py", line 206, in wrapper
    return fn(self, ctxt, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/nova/objects/instance.py", line 613, in create
    db_inst = db.instance_create(context, updates)
  File "/usr/lib/python2.7/site-packages/nova/db/api.py", line 636, in instance_create
    return IMPL.instance_create(context, values)
  File "/usr/lib/python2.7/site-packages/nova/db/sqlalchemy/api.py", line 145, in wrapper
    return f(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/nova/db/sqlalchemy/api.py", line 1595, in instance_create
  ....

  
  The fix for this defect will likely be taking the fix from https://review.openstack.org/#/c/134597/ and making a utility method in nova.utils to do safe truncation.  This utility method could then be called from  nova.utils.get_system_metadata_from_image method and its existing location in nova/compute/utils.py

  Found in Nova Kilo.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1425657/+subscriptions


Follow ups

References