[Libguestfs] [PATCH 1/2] Allow reading more data than the reported size of a volume

Richard W.M. Jones rjones at redhat.com
Tue Mar 15 11:29:32 UTC 2011


On Fri, Mar 11, 2011 at 01:34:47PM +0000, Matthew Booth wrote:
> If a volume is not an exact multiple of 512 bytes, qemu-img will report its size
> rounded down to a 512 byte boundary. However, when copying, the file is still
> read until EOF, which will return more data than was expected. This change
> prevents that causing a failure in itself.
> 
> The situation is still not resolved, however, as there are still situations
> where this will cause a failure. For example, copying will fail writing to a
> block device if an attempt is made to write too much data.
> ---
>  lib/Sys/VirtV2V/Connection/Source.pm |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/lib/Sys/VirtV2V/Connection/Source.pm b/lib/Sys/VirtV2V/Connection/Source.pm
> index 960aff3..8cbfe25 100644
> --- a/lib/Sys/VirtV2V/Connection/Source.pm
> +++ b/lib/Sys/VirtV2V/Connection/Source.pm
> @@ -167,7 +167,7 @@ sub _volume_copy
>      v2vdie __x('Didn\'t receive full volume. Received {received} '.
>                 'of {total} bytes.',
>                 received => $total, total => $src->get_size())
> -        if  $src->get_format() eq "raw" && $total != $src->get_size();
> +        if  $src->get_format() eq "raw" && $total < $src->get_size();
>  
>      return $dst;
>  }
> -- 
> 1.7.4

As discussed on list, ACK.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw




More information about the Libguestfs mailing list