Support non-raw images

Use qemu-nbd to export a QEMU image as raw where needed
Use qcow2 to snapshot image files

Only use the device mapper when snapshotting block devices. If the
input media is a regular file, then create a qcow2 image and define
the original media as backing_file.