Creating servers with metadata fails

Bug #724623 reported by justinsb
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
justinsb

Bug Description

Dan Prince reported this in bug 724143, but this is a separate issue. When metadata is specified, inserting into the database fails. This is because the dictionaries for InstanceMetadata aren't mapped into the database model automatically, and apparently the unit tests didn't hit this.

Dan wrote:
I also tried to create a server with metadata:

  cs.create_server(:name => "Yo", :imageId => 3, :flavorId => 1, :metadata=>{"foo" => "bar"} )

When trying with metadata I get a totally different exception:

(nova.api.openstack): TRACE: File "/usr/lib/python2.6/dist-packages/sqlalchemy/orm/collections.py", line 660, in bulk_replace
(nova.api.openstack): TRACE: constants = idset(existing_adapter or ()).intersection(values or ())
(nova.api.openstack): TRACE: File "/usr/lib/python2.6/dist-packages/sqlalchemy/util.py", line 1104, in intersection
(nova.api.openstack): TRACE: self._working_set(self._member_id_tuples()).intersection(_iter_id(iterable)))
(nova.api.openstack): TRACE: TypeError: unhashable type: 'dict'

Related branches

Changed in nova:
assignee: nobody → justinsb (justin-fathomdb)
status: New → In Progress
Revision history for this message
justinsb (justin-fathomdb) wrote :

For anyone curious as to how this snuck through, when I tested it I created the DB model objects in the API layer. I did manual functional testing at that stage. I also created unit tests. However, as part of the review process, it was pointed out that I shouldn't be touching DB objects in the API layer, and so I changed them to simple dictionaries. The tests still passed, but apparently they didn't actually write to the DB, because when this was tried 'for real' it failed, because SQLAlchemy had trouble mapping nested object types (I believe).

In this patch, I've got real testing using the OpenStack API, writing to the DB. It's got a long list of dependencies sadly...

Thierry Carrez (ttx)
Changed in nova:
importance: Undecided → Medium
Thierry Carrez (ttx)
Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → 2011.2
status: Fix Committed → Fix Released
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.