9 Commits

Author SHA1 Message Date
Dan Smith
191d51f1ac Make Object FieldType take an object name instead of a class
The object infrastructure has a concept of an object name, which
is what we use to determine if something implements a particular
thing, and it is how we look up object classes when we
deserialize them. Since many objects will eventually reference
each other, we should be using their names to determine
compatibility, not their classes.

Related to blueprint structured-object-fields

Change-Id: I2edb8b8475662ad25e9f3319ce5e44317a2d0547
2013-10-21 14:26:25 -07:00
Dan Smith
a7a896590c Add missing key attribute to AggregateList.get_by_host()
This simply adds the ability to pass the key attribute to the
by-host lookup for aggregates.

Related to blueprint compute-manager-objects

Change-Id: I7651bc1470845b1e3586aa3616809bdf2ef2b4a2
2013-10-14 16:49:37 -07:00
Dan Smith
3122ceefa4 Migrate Aggregate object to Fields
Related to blueprint structured-object-fields

Change-Id: I0d1fab1e05ee748b4c8e7ec15e91aaff5eac1fda
2013-10-09 13:45:14 -07:00
Dan Smith
b963082431 Fix non-unicode string values on objects
Originally, all of the objects used str() to specify string type
attributes. This prevents the use of unicode values. A previous
patch errantly updated the utility function without bumping all
of the affected objects' versions. This does that, and also
fixes the issue for bare str() attributes.

Change-Id: Iad83589d399309b95c32813a1a660a12e571066b
Closes-bug: 1221346
2013-09-17 14:56:34 -07:00
Dan Smith
f407b79ae2 Clean up duplicated change-building code in objects
Almost every object thus far has done this:

  changes = {}
  for key in self.obj_what_changed():
      changes[key] = self[key]

to get a dict of updates to apply to the database. This patch adds
that as part of the base object and makes every place that does
the above to just use that.

Change-Id: I847f5d35181b0305668b107f86faa164e71c3375
2013-09-09 14:45:09 -07:00
Jenkins
5335937a04 Merge "Create mixin class for common DB fields" 2013-09-05 22:57:54 +00:00
Dan Smith
55f007be2c Generalize the _make_list() function for objects
Each object with a list duplicated the _make_list() method in its
own module. This removes that duplication and adds a generalized
helper in objects/base.py. The instance object still uses its own
because it has to do a bunch of other stuff in the loop for
efficiency.

Change-Id: Ic910f39087ebc167b2b930979f7951116caf8598
2013-09-04 14:27:11 -07:00
Chris Behrens
60507b90b9 Create mixin class for common DB fields
Creates a new DBObjectMixin class for DB-backed objects to use.  This
allows us to create non-DB-backed objects without having the common DB
fields automagically added to them.

Related to blueprint unified-object-model

Change-Id: Iaf2d8500505e9acdbffffb1d4bd3db0870ae82a3
2013-09-04 17:37:48 +00:00
Dan Smith
03b6412afb Add Aggregate object model
This adds an Aggregate object model implementation.

Related to blueprint compute-api-objects

Change-Id: Ic947718766181f8262fcf171b2bc0c329e0ae8f9
2013-09-03 13:03:38 -07:00