[virt-tools-list] virt-p2v: uninitialized value 'src_type' in RedHat.pm line 2043

Hajime Taira htaira at redhat.com
Sun May 6 14:46:49 UTC 2012

Hi, there.

I tried RHEL6.2 physical machine to KVM environment on RHEL6.3 Beta.

Server: RHEL6.3 Beta
Client: RHEL6.3 P2V Live CD
Packages: libvirt-0.9.10-11.el6.x86_64

P2V Converting was success. But error message logged in /var/log/virt-p2v-server.1336305638.log
file: /var/log/virt-p2v-server.1336305638.log
Use of uninitialized value in string eq at /usr/share/perl5/vendor_perl/Sys/VirtConvert/Converter/RedHat.pm line 2043, <> line 7.

file: /usr/share/perl5/vendor_perl/Sys/VirtConvert/Converter/RedHat.pm in RHEL6.3 Beta(virt-v2v-0.8.7-4.el6.x86_64)
   2040         # If a Xen guest has non-PV devices, Xen also simultaneously presents
   2041         # these as xvd devices. i.e. hdX and xvdX both exist and are the same
   2042         # device.
   2043         if ($meta->{src_type} eq 'xen' && $device =~ /^(?:h|s)d([a-z]+)/) {
   2044             $map{'xvd'.$1} = $mapped;
   2045         }
   2046         $map{$device} = $mapped;
   2047         $letter++;

I checked current code in git. Certainly 'src_type' is undefined value in meta.
How about following fix on client program? (I am not tested)

$ git diff
diff --git a/p2v/client/lib/virt-p2v/converter.rb b/p2v/client/lib/virt-p2v/converter.rb
index 8b7317e..a92fb8f 100644
--- a/p2v/client/lib/virt-p2v/converter.rb
+++ b/p2v/client/lib/virt-p2v/converter.rb
@@ -183,6 +183,7 @@ class Converter
             'cpus'      => @cpus,
             'memory'    => @memory,
             'arch'      => @arch,
+            'src_type'  => 'physical', # e.g. 'physical' or 'phys'
             'features'  => @features,
             'disks'     => @disks.map { |device|


Best regards,

Hajime Taira <htaira at redhat.com>
RHEL Solution Architect
Global Services
Red Hat K.K.

Ebisu Neonato 8F, 4-1-18, Ebisu,
Shibuya-ku, Tokyo, Japan 150-0013

More information about the virt-tools-list mailing list