lxd/images: calculate sha256 as image is written
lxd/images: calculate sha256 as image is written

This is part 2 of a series of patches to add better progress
tracking support for export and import.

Calculate sha256 as either tarfile is written (if no compression)
or as compression is done to improve performance.

Signed-off-by: Joel Hockey <9ecfc52dc2ffef73afac73f3495f294aeddf1231@chromium.org>

stgraber/lxd,Skarlso/lxd,lxc/lxd,atxwebs/lxd,stgraber/lxd,stgraber/lxd,hallyn/lxd,hallyn/lxd,hallyn/lxd,lxc/lxd,hallyn/lxd,stgraber/lxd,hallyn/lxd,lxc/lxd,atxwebs/lxd,Skarlso/lxd,atxwebs/lxd,mjeanson/lxd,hallyn/lxd,lxc/lxd,lxc/lxd,lxc/lxd,Skarlso/lxd,Skarlso/lxd,stgraber/lxd,mjeanson/lxd,stgraber/lxd,stgraber/lxd,atxwebs/lxd,lxc/lxd,mjeanson/lxd