This is a more strategic fix for the issue of us trying to pickle
an instance with a context that has complex data structures inside
(i.e. SQLAlchemy connections) into the oslo cache. The right solution
is for us to stop storing random python objects (InstanceMetadata)
in the cache with pickle. However, that's a larger change and more
complex for deployers to roll over. This attempts to sanitize the
instance before we pickle it to get things working again.