get_snapshot should populate the snapshot metadata

Update the query in db api snapshot_get() to join with the table
snapshot_metadata, so that snapshot metadata is returned. This makes the
api snapshot_get() function in the same way as volume_get().

Fixes: bug #1204446

Change-Id: I37004140f6a11b96aaeb3af6c631028a44541d3a
use encode('utf8') instead of str()

It is not clear for converting a unicode to string by using str().
Instead we should use var.encode('utf8') to do this.

Change-Id: I8ce4c98f819c98e835a6d8298fe22f2fd0ca18b6
Merge "get_snapshot should populate the snapshot metadata"
Merge "use encode('utf8') instead of str()"