>From e8cd1f1777a3980c6d4b7c7a8de556a4bc8560d9 Mon Sep 17 00:00:00 2001
From: unknown <Amos@.(none)>
Date: Thu, 13 May 2010 23:38:16 +0300
Subject: [PATCH 2/2] use single registry change for all supported windows version.

---
 lib/Sys/VirtV2V/Converter/Windows.pm |   73 +++++++---------------------------
 v2v/virt-v2v.conf                    |   51 ++++++++++++++----------
 2 files changed, 45 insertions(+), 79 deletions(-)

diff --git a/lib/Sys/VirtV2V/Converter/Windows.pm b/lib/Sys/VirtV2V/Converter/Windows.pm
index 26df5e9..7d3e961 100644
--- a/lib/Sys/VirtV2V/Converter/Windows.pm
+++ b/lib/Sys/VirtV2V/Converter/Windows.pm
@@ -225,8 +225,8 @@ sub _add_viostor_to_registry
         or die "open system hive: $!";
 
     # Make the changes.
-    my $regedits_w2k3 = '
-; Edits to be made to a Windows 2003 guest to have
+    my $regedits = '
+; Edits to be made to a Windows guest to have
 ; it boot from viostor.
 
 [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\CriticalDeviceDatabase\pci#ven_1af4&dev_1001&subsys_00000000]
@@ -266,64 +266,16 @@ sub _add_viostor_to_registry
 "5"=dword:00000001
 
 [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\viostor\Enum]
-"0"="PCI\\\\VEN_1AF4&DEV_1001&SUBSYS_00021AF4&REV_00\\\\3&13c0b0c5&0&20"
+"0"="PCI\\VEN_1AF4&DEV_1001&SUBSYS_00021AF4&REV_00\\3&13c0b0c5&0&20"
 "Count"=dword:00000001
 "NextInstance"=dword:00000001
 ';
 
-    my $regedits_w2k8 = '
-; Edits to be made to a Windows 2008 guest to have
-; it boot from viostor.
-
-[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\CriticalDeviceDatabase\PCI#VEN_1AF4&DEV_1001&SUBSYS_00000000]
-"ClassGUID"="{4D36E97B-E325-11CE-BFC1-08002BE10318}"
-"Service"="viostor"
-
-[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\CriticalDeviceDatabase\PCI#VEN_1AF4&DEV_1001&SUBSYS_00020000]
-"ClassGUID"="{4D36E97B-E325-11CE-BFC1-08002BE10318}"
-"Service"="viostor"
-
-[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\CriticalDeviceDatabase\PCI#VEN_1AF4&DEV_1001&SUBSYS_00021AF4]
-"ClassGUID"="{4D36E97B-E325-11CE-BFC1-08002BE10318}"
-"Service"="viostor"
-
-[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\viostor]
-"Group"="SCSI miniport"
-"ImagePath"=hex(2):73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,64,00,\
-  72,00,69,00,76,00,65,00,72,00,73,00,5c,00,76,00,69,00,6f,00,73,00,74,00,6f,\
-  00,72,00,2e,00,73,00,79,00,73,00,00,00
-"ErrorControl"=dword:00000001
-"Start"=dword:00000000
-"Type"=dword:00000001
-"Tag"=dword:00000040
-
-[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\viostor\Parameters]
-"BusType"=dword:00000001
-
-[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\viostor\Parameters\MaxTransferSize]
-"ParamDesc"="Maximum Transfer Size"
-"type"="enum"
-"default"="0"
-
-[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\viostor\Parameters\MaxTransferSize\enum]
-"0"="64  KB"
-"1"="128 KB"
-"2"="256 KB"
-
-[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\viostor\Parameters\PnpInterface]
-"5"=dword:00000001
-
-[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\viostor\Enum]
-"0"="PCI\\\\VEN_1AF4&DEV_1001&SUBSYS_00021AF4&REV_00\\\\3&13c0b0c5&2&20"
-"Count"=dword:00000001
-"NextInstance"=dword:00000001
-';
+    
 
     my $io;
-    if ($desc->{major_version} == 5 && $desc->{minor_version} == 2) {
-        $io = IO::String->new ($regedits_w2k3);
-    } elsif ($desc->{major_version} == 6) {
-        $io = IO::String->new ($regedits_w2k8);
+    if ($desc->{major_version} == 5 || $desc->{major_version} == 6) {
+        $io = IO::String->new ($regedits);
     } else {
         die (user_message (__x"Guest is not a supported version of Windows ({major}.{minor})",
                            major => $desc->{major_version},
@@ -375,7 +327,7 @@ sub _add_service_to_registry
 
     # Make the changes.
     my $regedits = '
-[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\RHSrvAny]
+[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\rhev-apt]
 "Type"=dword:00000010
 "Start"=dword:00000002
 "ErrorControl"=dword:00000001
@@ -383,7 +335,7 @@ sub _add_service_to_registry
 "DisplayName"="RHSrvAny"
 "ObjectName"="LocalSystem"
 
-[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\RHSrvAny\Parameters]
+[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\rhev-apt\Parameters]
 "CommandLine"="cmd /c \"c:\\\\Temp\\\\V2V\\\\firstboot.bat\""
 "PWD"="c:\\\\Temp\\\\V2V"
 ';
@@ -441,7 +393,12 @@ sub _upload_service
     $g->cp ($app, $path);
 
     ($app, $depnames) =
-        $config->match_app ($desc, "firstbootzip", $desc->{arch});
+        $config->match_app ($desc, "firstbootapp", $desc->{arch});
+    $app = _transfer_path ($transfer_mount, $app);
+    $g->cp ($app, $path);
+    
+    ($app, $depnames) =
+        $config->match_app ($desc, "rhsrvany", $desc->{arch});
     $app = _transfer_path ($transfer_mount, $app);
     $g->cp ($app, $path);
 }
@@ -474,4 +431,4 @@ L<http://libguestfs.org/>.
 
 =cut
 
-1;
+1;
\ No newline at end of file
diff --git a/v2v/virt-v2v.conf b/v2v/virt-v2v.conf
index 885bdc7..9329ed5 100644
--- a/v2v/virt-v2v.conf
+++ b/v2v/virt-v2v.conf
@@ -5,79 +5,82 @@
   <!-- RHEL 5
        All of these RPMS are from RHEL 5.3, which was the first version of RHEL
        5 to support VirtIO -->
-  <app os='linux' distro='rhel' major='5' arch='i686' name='kernel'>
+  <app distro='rhel' major='5' arch='i686' name='kernel'>
     <path>rhel/5/kernel-2.6.18-128.el5.i686.rpm</path>
     <dep>ecryptfs-utils</dep>
     <dep>lvm2</dep>
   </app>
-  <app os='linux' distro='rhel' major='5' arch='i686' name='kernel-PAE'>
+  <app distro='rhel' major='5' arch='i686' name='kernel-PAE'>
     <path>rhel/5/kernel-PAE-2.6.18-128.el5.i686.rpm</path>
     <dep>ecryptfs-utils</dep>
     <dep>lvm2</dep>
   </app>
-  <app os='linux' distro='rhel' major='5' arch='x86_64' name='kernel'>
+  <app distro='rhel' major='5' arch='x86_64' name='kernel'>
     <path>rhel/5/kernel-2.6.18-128.el5.x86_64.rpm</path>
     <dep>ecryptfs-utils</dep>
     <dep>lvm2</dep>
   </app>
 
   <!-- RHEL 5 Kernel dependencies -->
-  <app os='linux' distro='rhel' major='5' arch='x86_64' name='ecryptfs-utils'>
+  <app distro='rhel' major='5' arch='x86_64' name='ecryptfs-utils'>
     <path>rhel/5/ecryptfs-utils-56-8.el5.x86_64.rpm</path>
   </app>
-  <app os='linux' distro='rhel' major='5' arch='i386' name='ecryptfs-utils'>
+  <app distro='rhel' major='5' arch='i386' name='ecryptfs-utils'>
     <path>rhel/5/ecryptfs-utils-56-8.el5.i386.rpm</path>
   </app>
-  <app os='linux' distro='rhel' major='5' arch='x86_64' name='lvm2'>
+  <app distro='rhel' major='5' arch='x86_64' name='lvm2'>
     <path>rhel/5/lvm2-2.02.40-6.el5.x86_64.rpm</path>
     <dep>device-mapper</dep>
     <dep>device-mapper-event</dep>
   </app>
-  <app os='linux' distro='rhel' major='5' arch='i386' name='lvm2'>
+  <app distro='rhel' major='5' arch='i386' name='lvm2'>
     <path>rhel/5/lvm2-2.02.40-6.el5.i386.rpm</path>
     <dep>device-mapper</dep>
     <dep>device-mapper-event</dep>
   </app>
-  <app os='linux' distro='rhel' major='5' arch='x86_64' name='device-mapper'>
+  <app distro='rhel' major='5' arch='x86_64' name='device-mapper'>
     <path>rhel/5/device-mapper-1.02.28-2.el5.x86_64.rpm</path>
   </app>
-  <app os='linux' distro='rhel' major='5' arch='i386' name='device-mapper'>
+  <app distro='rhel' major='5' arch='i386' name='device-mapper'>
     <path>rhel/5/device-mapper-1.02.28-2.el5.i386.rpm</path>
   </app>
-  <app os='linux' distro='rhel' major='5' arch='x86_64' name='device-mapper-event'>
+  <app distro='rhel' major='5' arch='x86_64' name='device-mapper-event'>
     <path>rhel/5/device-mapper-event-1.02.28-2.el5.x86_64.rpm</path>
   </app>
-  <app os='linux' distro='rhel' major='5' arch='i386' name='device-mapper-event'>
+  <app distro='rhel' major='5' arch='i386' name='device-mapper-event'>
     <path>rhel/5/device-mapper-event-1.02.28-2.el5.i386.rpm</path>
   </app>
 
   <!-- RHEL 4
        All of these RPMs are from RHEL 4.8, which was the first version of RHEL
        4 to support VirtIO -->
-  <app os='linux' distro='rhel' major='4' arch='i686' name='kernel'>
+  <app distro='rhel' major='4' arch='i686' name='kernel'>
     <path>rhel/4/kernel-2.6.9-89.EL.i686.rpm</path>
   </app>
-  <app os='linux' distro='rhel' major='4' arch='i686' name='kernel-smp'>
+  <app distro='rhel' major='4' arch='i686' name='kernel-smp'>
     <path>rhel/4/kernel-smp-2.6.9-89.EL.i686.rpm</path>
   </app>
-  <app os='linux' distro='rhel' major='4' arch='i686' name='kernel-hugemem'>
+  <app distro='rhel' major='4' arch='i686' name='kernel-hugemem'>
     <path>rhel/4/kernel-hugemem-2.6.9-89.EL.i686.rpm</path>
   </app>
-  <app os='linux' distro='rhel' major='4' arch='x86_64' name='kernel'>
+  <app distro='rhel' major='4' arch='x86_64' name='kernel'>
     <path>rhel/4/kernel-2.6.9-89.EL.x86_64.rpm</path>
   </app>
-  <app os='linux' distro='rhel' major='4' arch='x86_64' name='kernel-smp'>
+  <app distro='rhel' major='4' arch='x86_64' name='kernel-smp'>
     <path>rhel/4/kernel-smp-2.6.9-89.EL.x86_64.rpm</path>
   </app>
-  <app os='linux' distro='rhel' major='4' arch='x86_64' name='kernel-largesmp'>
+  <app distro='rhel' major='4' arch='x86_64' name='kernel-largesmp'>
     <path>rhel/4/kernel-largesmp-2.6.9-89.EL.x86_64.rpm</path>
   </app>
 
   <!-- Windows -->
-  <app os='windows' major='5' arch='i386' name='viostor'>
+  <app os='windows' major='5' minor='1' arch='i386' name='viostor'>
+    <path>windows/xp/i386/viostor.sys</path>
+  </app>
+  <app os='windows' major='5' minor='2' arch='i386' name='viostor'>
     <path>windows/2003/i386/viostor.sys</path>
   </app>
-  <app os='windows' major='5' arch='x86_64' name='viostor'>
+  <app os='windows' major='5' minor='2' arch='x86_64' name='viostor'>
     <path>windows/2003/x86_64/viostor.sys</path>
   </app>
   <app os='windows' major='6' arch='i386' name='viostor'>
@@ -86,6 +89,12 @@
   <app os='windows' major='6' arch='x86_64' name='viostor'>
     <path>windows/2008/x86_64/viostor.sys</path>
   </app>
+  <app os='windows' major='6' minor='1' arch='i386' name='viostor'>
+    <path>windows/7/i386/viostor.sys</path>
+  </app>
+  <app os='windows' major='6' minor='1' arch='x86_64' name='viostor'>
+    <path>windows/7/x86_64/viostor.sys</path>
+  </app>
   <!-- RHSrvAny is compiled as a 32 bit app even on 64 bit Windows -->
   <app os='windows' name='rhsrvany'>
     <path>windows/rhsrvany.exe</path>
@@ -94,8 +103,8 @@
   <app os='windows' name='firstboot'>
     <path>windows/firstboot.bat</path>
   </app>
-  <app os='windows' name='firstbootzip'>
-    <path>windows/firstboot.zip</path>
+  <app os='windows' name='firstbootapp'>
+    <path>windows/rhev-apt.exe</path>
   </app>
 
   <!-- Networks -->
-- 
1.6.1.9.g97c34

