Add some common code copied from Ironic

To support versioned objects, some common code from Ironic is necessary
to get to a working environment.  These are straight copies with things
renamed.

Change-Id: I14afd02f5791c74a2d5daf55681ae7047083037a