Thanks to help from Matthew Booth allowing me to blatantly rip off his
work - we now have a tool to help with P2V migrations when the source
Windows machine has no compatible boot disk driver to run in the target
virtual machine.  The idea is to put the viostor virtio disk driver and
supporting registry keys in the source physical machine first, before
migrating it.  Use this hack when booting from the virt-p2v CD doesn't
work.

I just did this successfully with a Windows 2003 server. I haven't tried
it yet with anything else.  The physical server is an aging HP Proliant
with an HP RAID controller that doesn't get along well with virt-p2v.
The target VM uses a virtio disk for its boot drive.  It also has a
couple of other virtio disks to match the source physical machine, but
these aren't important. 

Borrowing heavily from the Microsoft procedure to restore a Windows
Server from bare metal and Matthew Booth's libguestfs work, here are the
steps to follow for Windows Server 2003:

First, provision a Windows Server 2003 VM in your RHEV or RHEL
environment.  Be sure to use virtio disks, **not** IDE disks.  Also use
a virtio NIC.  Install a fresh copy of Windows Server in the VM.  Do the
simplest, vanilla install possible.  Don't activate with Microsoft yet.
You'll have 30 days.

Get a copy of the latest Windows virtio driver, named viostor.sys.  Save
this file somewhere convenient.  Install the virtio disk and NIC drivers
in your newly provisioned VM.  

Here is the hack.  Save and run a variant of the script below, named
SetupViostor.bat.  Also save a copy of viostor.reg below.  You will want
to change paths to suit your local conditions.  

****Copy and paste SetupViostor.bat below.

@echo on

copy
D:\Installs\virtio-win\virtio-win-prewhql-0.1\extracted\WXp\x86\viostor.
sys c:\windows\system32\drivers\viostor.sys

d:\installs\GregRHEVHack\viostor.reg

****End copy and paste.

Here is a copy of viostor.reg:

************* copy and paste viostor.reg below.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatab
ase\pci#ven_1af4&dev_1001&subsys_00000000]
"Service"="viostor"
"ClassGUID"="{4D36E97B-E325-11CE-BFC1-08002BE10318}"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatab
ase\pci#ven_1af4&dev_1001&subsys_00020000]
"Service"="viostor"
"ClassGUID"="{4D36E97B-E325-11CE-BFC1-08002BE10318}"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatab
ase\pci#ven_1af4&dev_1001&subsys_00021af4]
"Service"="viostor"
"ClassGUID"="{4D36E97B-E325-11CE-BFC1-08002BE10318}"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\viostor]
"Type"=dword:00000001
"Start"=dword:00000000
"Group"="SCSI miniport"
"ErrorControl"=dword:00000001
"ImagePath"="system32\drivers\viostor.sys"
"Tag"=dword:00000021

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\viostor\Parameters
]
"BusType"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\viostor\Parameters
\MaxTransferSize]
"ParamDesc"="Maximum Transfer Size"
"type"="enum"
"default"="0"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\viostor\Parameters
\MaxTransferSize\enum]
"0"="64  KB"
"1"="128 KB"
"2"="256 KB"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\viostor\Parameters
\PnpInterface]
"5"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\viostor\Enum]
"0"="PCI\\VEN_1AF4&DEV_1001&SUBSYS_00021AF4&REV_00\\3&13c0b0c5&0&20"
"Count"=dword:00000001
"NextInstance"=dword:00000001
REGEDITS

*************End copy and paste.

Run SetupViostor.bat on the source physical Windows 2003 Server system.
This sets up the viostor disk driver, so the subsequent VM will
recognize the virtio disk driver and boot from it.  

Now the process follows Microsoft's bare metal restore.  

On the source physical Windows Server 2003 system, use ntbackup to make
a backup of your C drive and all other drives on your source physical
server.  Also back up your system state.  Put the savesets someplace
accessible by the target VM you just built.  

From the target VM, use ntbackup to restore the savesets you just
created earlier.  Restore all data disks first, then the system disk,
then system state, in that order.  

After restoring the system state, disconnect the source physical machine
from the network and reboot the target VM.  It should come up looking
nearly identical to the source physical machine.  It will need a bunch
of drivers for its virtual hardware, but these are easy to add with a
running machine.  

Final step - never connect the old source physical machine to the
network again.

_______________________________________________
virt mailing list
[email protected]
https://admin.fedoraproject.org/mailman/listinfo/virt

Reply via email to