This adds a new method called obj_make_compatible_from_manifest() to
the base object. This is to be used by the newer backport method (which
receives a version manifest from the client) in order to perform a more
prescriptive run of obj_make_compatible(). Since the latter is part of our
public library API, this does a slightly hacky think of stashing the
manifest so that it is visible to lower layers. We cache other such data
on the object like this in other places, so there is precedent for this.
However, it would be good to see if we can clean this up via refactoring
the internals in a way that won't break people (and/or just make a change
in a major version bump later). For now, I think this is the least likely-
to-break-people change we can make.
Change-Id: I0c33a34a3cb454d6d35e2092d72ebd41d4c12729
This adds a new backport method to the VersionedObjectSerializer
interface. The new method calculates a manifest of all the local-side
object versions expected to be needed during the backport request and
sends that to the server. Ideally this will replace the current
backport method that depends on the version relationship maps that
we maintain, and will limit the complexity involved with relationship
maps differing on older code.
Change-Id: I071c20b65d12df893c367d417ab6be09626a9955
In order to coerce correctly some fields that are primarly dictionaries having
either strings or list of strings as values, we need to provide a new field type
which would accept only list of strings as values for dicts so anyone who would
want to use that type would just have to make sure to hydrate all the items by
putting them into a single list.
Change-Id: I708860357e17bcc70733187c3289dd859b09c60b
Providing a version string for a field means sometimes that we want to verify
that the string is correct for a versionpredicate.
By adding a new type of field coercing using VersionPredicate, we can make sure
that the field is correct.
Change-Id: I53213e8bfa1928936c0f6904e23dfa886233528b
This adds a utility method that takes a top-level object and determines
all of the dependent object names and versions that could be nested
within. This can be later used to ask the indirection_api to backport
an object with this information instead of depending on its own mapping,
which may differ.
Change-Id: I04574ccd01e582b3eef8f98cac41f429c70debd8
The serializer needs to report the version of the toplevel object
that we were trying to deserialize when we encountered the incompatible
version. We depend on the implementor of the indirection_api to use
the object relationship mappings to return to us a fully-supported
object tree based on the version at the top.
This patch fixes the serializer to report the toplevel version instead of
the one that caused the fault.
Change-Id: I7ac03717e17cd7229abfeef6d9c7d9d8ec9be27a
Closes-Bug: #1475356
The remotable decorator still has code that assumes we can use dict-like
accesses on our objects. This converts it to a setattr.
Change-Id: I45c6e3e9e7bde343a67aa3dfdbb3787b21641cd5
Closes-Bug: #1474952
A hypervisor version is a nova concept and likely
doesn't belong in this library so tweak the wording
used.
Change-Id: Ia03d94334201e0229a339984ca0838911d4ee20d
Added a special datastructures (CoercedList, CoercedDict and CoercedSet)
which are able to coerce their values to appropriate element type.
The instances of these structures are returned when the values of
appropriate compound fields initially coerced. As a result, all
subsequent calls which are going to add new elements to the fields'
collections will be processed by the overridden methods of new
datastructures, thus the new elements will be coerced and the exceptions
risen if the coercing is not possible.
This also fixes a bug in TestObjMakeList which was specifying incorrect
obj_name for the elements in 'objects' collection of MyList test class.
It was not leading to failures as the items of this collection were not
being coerced prior to this patch.
This patch restores the functionality of patch
2da963c3b313e14c4e60301e87f9c9260d7166cb which was reverted due
to found bug. This one fixes this bug by removing custom initializers for
coerced collections.
Change-Id: I9dc8fc408cefea921e4e27c0e75f98291674f867
Partial-Bug: #1469865
Rather than always installing dependencies for the test tools included
in the library, define an extras called "test" and include the
dependencies there.
Add API documentation for the fixture module, and include notes about
installing the extra dependencies in the module documentation and
installation instructions.
Closes-Bug: #1440350
Depends-On: I78838dcd4da43b3c1d2610ac87a3ec55b9535646
Depends-On: Ibd2410e0153053b5121155474e99752256c7e4b8
Change-Id: I4e45c1bb4f08c9da510939514c5358e1575d3e0a
We need to sort the version dictionary to ensure py27
and py34 generate the same fingerprint.
Depends-On: I0f07858e96ea3baf46f8a453e253b9ed29c7f7e2
Depends-On: I33bd2d9dff9cb7dc1a50177db7286b7317966784
Change-Id: I0adc3d696c90dfe20d35bdf06f033eb3a2491fd0
According to the disscussion[1] we have to remove the requirements-PYN.txt
Took the opportunity to remove py33 and py26 from the tox targets as we
don't need them
[1] http://lists.openstack.org/pipermail/openstack-dev/2015-July/068469.html
Depends-On: I0f07858e96ea3baf46f8a453e253b9ed29c7f7e2
Depends-On: I33bd2d9dff9cb7dc1a50177db7286b7317966784
Change-Id: I9cebc3d4e3a8eb73acb30c397e3ee20b5e91b1ac
Python 2.6 support is being dropped and python 3.3
is not being CI/gate tested so neither seems like it
should be stated as being supported.
Depends-On: I54f6b1c174569a841d7322ab38b5922f13e23864
Change-Id: I55484fb8004367c165c3ebe8006e5557550df61d
Running "pip-missing-reqs" tox target showed these references
in our code. Since we refer to them directly, we should add
them to our requirements.
Change-Id: I5c46bbc1ea06fa7bea8a4afe78d35834e554b406
The Object class currently does a direct comparison of the
'obj_name()' value of the thing being coerced, against the
internal _obj_name field it was initialized with.
This does not allow for creation of object fields which
allow arbitrary subclasses - only the base class passes
the check.
Introduce a new 'subclasses' parameter, defaulting to
False, which traverses the python class hierarchy,
checking the obj_name() value on all parent classes
of the value being coerced.
Change-Id: Ie56b94e57a6e18292c10c926836592938540e515