File check_net_oldname.patch of Package virt-v2v
In some network configurations (e.g. macvtap), it is possible to see the
following error during the conversion:
Use of uninitialized value $oldname in concatenation (.) or string at
/usr/lib/perl5/vendor_perl/5.18.2/Sys/VirtConvert/Config.pm line 489.
Prevent the error by ensure $oldname and $oldtype are defined before
attempting to use them.
Index: virt-v2v-0.9.1/lib/Sys/VirtConvert/Config.pm
===================================================================
--- virt-v2v-0.9.1.orig/lib/Sys/VirtConvert/Config.pm
+++ virt-v2v-0.9.1/lib/Sys/VirtConvert/Config.pm
@@ -486,10 +486,12 @@ sub map_network
my $mapping;
foreach my $root (@search) {
- ($mapping) = $root->findnodes
- ("network[\@type='$oldtype' and \@name='$oldname']/network");
+ if (defined($oldtype) && defined($oldname)) {
+ ($mapping) = $root->findnodes
+ ("network[\@type='$oldtype' and \@name='$oldname']/network");
- last if defined($mapping);
+ last if defined($mapping);
+ }
}
unless (defined($mapping)) {