Refresh instance metadata in-place

For some reason that isn't entirely clear to me, the attempt to update
instance metadata in _instance_update() results in a stale sqlalchemy
object state. This is a similar issue to the one fixed in commit:

  9fdf7552779d518af9cda4e366bf81fddb0cb6f2

For some reason, session.refresh() doesn't work for instance['metadata']
in the same way, which also raises suspicion that perhaps it's not the
right fix for system_metadata either.

This patch adds an _instance_update_metadata_in_place() method that
updates the actual instance['metadata'] list _and_ the database,
mirroring the high-level behavior of instance_metadata_update(), but
without requiring us to refresh or re-fetch the metadata or the
whole instance (as a workaround).

Fixes bug 1096653

Change-Id: Ic5a205631b1b7dce3744960ed4201dcc7b4b2ae6
Merge "Refresh instance metadata in-place"