[Libguestfs] [PATCH 1/2] ESX: Fix check that full volume was transfered

Matthew Booth mbooth at redhat.com
Wed Apr 28 16:18:58 UTC 2010


The check of transferred size against expected size was done after returning the
volume, so was never usefully happening.
---
 lib/Sys/VirtV2V/Transfer/ESX.pm |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/lib/Sys/VirtV2V/Transfer/ESX.pm b/lib/Sys/VirtV2V/Transfer/ESX.pm
index 4d65d5e..fb0c6ea 100644
--- a/lib/Sys/VirtV2V/Transfer/ESX.pm
+++ b/lib/Sys/VirtV2V/Transfer/ESX.pm
@@ -131,16 +131,18 @@ sub get_volume
         my $died = $r->header('X-Died');
         die($died) if (defined($died));
 
+        # It reports success even if we didn't receive the whole file
+        die(user_message(__x("Didn't receive full volume. Received {received} ".
+                             "of {total} bytes.",
+                             received => $self->{_v2v_received},
+                             total => $self->{_v2v_volsize})))
+            unless ($self->{_v2v_received} == $self->{_v2v_volsize});
+
         my $vol = $self->{_v2v_vol};
         $vol->close();
         return $vol;
     }
 
-    die(user_message(__x("Didn't receive full volume. Received {received} of ".
-                         "{total} bytes.",
-                         received => $self->{_v2v_received},
-                         total => $self->{_v2v_volsize})))
-        unless ($self->{_v2v_received} == $self->{_v2v_volsize});
 
     if ($r->code == 401) {
         die(user_message(__x("Authentication error connecting to ".
-- 
1.6.6.1




More information about the Libguestfs mailing list