resize: Fix handling of GPT and qcow2 (RHBZ#633766, RHBZ#633096).
Previously we copied the bootloader data directly from the
source disk image to the target disk image using host file
operations (before launching libguestfs). This has two problems:
firstly it has no chance of working with qcow2, and secondly
it didn't behave properly with GPT.
This changes the code so that everything is done through
libguestfs. Block device sizes are now calculated properly
for qcow2 (RHBZ#633096) because this is done using the libguestfs
blockdev_getsize64 call. The partition table is still created
by parted, but to workaround a bug in parted this is done before
copying the bootloader. Finally the bootloader copy is done
using the new APIs pread-device and pwrite-device.
Shrinking now works, at least for simple cases (RHBZ#633766).