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

Matthew Booth mbooth at redhat.com
Fri Mar 11 13:34:47 UTC 2011


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




More information about the Libguestfs mailing list