xenapi: refactor - extract get_virtual_size

This change extracts a function get_virtual_size. This is needed,
because we would like to support tar.gz files, in which case the image's
virtual size will be determined by looking at the tar.gz stream. The
first tarinfo will tell us the size.

related to blueprint xenapi-supported-image-import-export

Change-Id: If34bb8849ad2dacf471f1bec5e72a37ddda79464
Merge "xenapi: refactor - extract get_virtual_size"