Pass and use the environment in validate_template

Use the environment passed in validate_template to be able to validate
template using custom resources.

Change-Id: I464d837c74d8be16e125d7701830d0bcbced75ab
Closes-Bug: #1298450
Ensure outputs are resolved for adopted stacks

The resolution of outputs is only performed for stacks in certain
states, so we need to add ADOPT to the valid list of actions,
as after a stack is ADOPT COMPLETE, it should be possible to resolve
the outputs in the same way as after create.

Change-Id: I52d710e5fb23b21848133b9845b2eba3ce76c4cb
Closes-Bug: #1299173
Add handle_update to VolumeAttachment

Updates for volume attachments were handled in UpdateReplace manner,
which fails when in need to attach new volume to the same mount
(or attach the same volume to different mount on the same server,
or attaching the same volume to different server).

This patch makes all properties of VolumeAttachment
to be update_allowed, adds necessary handle_update logic
and fixes VolumeDetachTask to reliably detach old volume
so that new one can be immediately attached.

Change-Id: Id81a53a34b5bb2dfbc9425b91be0d02539fe2456
Closes-Bug: #1269686
Closes-Bug: #1251439
Cherry pick oslo-incubator db fixes

The patch cherrypicks 2 fixes related to utf8 migration:

 * Ib5c0f93c788afda92aad862e50dc086dc39605f1: Ignore migrate versioning tables in utf8 sanity check

 * I7f271d846141ac72dde3fb0d12159b125018eb2c: Make table utf-8 charset checking be optional for DB migration

Change-Id: I5edf17c7491434ae4e1f9bb2819b3a415d245525
Closes-Bug: #1301036