Make Instance object properly update *metadata

Currently, the Instance object won't notice when metadata or
system_metadata has changed and thus won't include it in updates it
makes to the database.

We could make these two dicts full-fledged objects, but that's a bit
overkill for this purpose. Stash a copy of them every time we reset
our changes so that we can detect changes in save().

Note that this includes tests to some shelve tests which are now
wrong because they modify the instance's sys_meta prematurely.
Turns out, these are the tests that pointed out the need for
this tracking :)

Related to blueprint unified-object-model
Fixes bug 1201776

Change-Id: I3df462645979742379a41060cda5bb5084fddb20
Fix Instance object handling of implied fields

The situation around info_cache and security_groups is a bit
confusing and inconsistent at the moment. Since some of the
"all" queries don't join info_cache and security_groups,
avoid assuming that they are there, either triggering an
unintentional lazy load, or a KeyError in a few cases where the
DB API returns a dict.

Also, don't ever allow us to recurse into another instance object
looking for a loaded attribute in case it fails to load from the
get query.

Related to blueprint unified-object-model

Change-Id: I40b72274cd24034b03c8e07af56e7c8d49b6b898
Fix shelve's use of system_metadata

The shelve patches needed to include a hack to make the changes
to system_metadata get saved properly. Now that it's fixed,
clean that up.

Related to blueprint unified-object-model

Change-Id: I79a2db66544e0662e48445505a818ff62f765569
Merge "Make Instance object properly update *metadata"
Merge "Fix Instance object handling of implied fields"
Merge "Fix shelve's use of system_metadata"
Merge remote-tracking branch 'm_src_repo/citrix-fixes' into build-temp