[Libguestfs] Possible issue with virt-v2v writing to wrong Windows registry control set

Greg Scott GregScott at Infrasupport.com
Fri Nov 18 14:21:32 UTC 2011


I went back to the VMware copy of that converted VM - so this was the
copy before virt-v2v.  Opening up regedit and looking at
HKLM\SYSTEM\Select - the value for keys Current and Default is 1.
Failed is 0, LastKnownGood is 2.  

And then I was looking through
/usr/share/perl5/vendor_perl/Sys/VirtV2V/Converter/Windows.pm.

There's some code to figure out the CurrentControlSet:
.
.
.
    my $h = Win::Hivex->open ($tmpdir . "/system", write => 1)
        or die "open system hive: $!";

    # Get the 'Current' ControlSet. This is normally 001, but not
always.
    my $select = $h->node_get_child($h->root(), 'Select');
    my $current_cs = $h->node_get_value($select, 'Current');
    $current_cs = sprintf("ControlSet%03i",
$h->value_dword($current_cs));
.
.
.
But then a few screens down, there's some code with ControlSet001
hard-coded:

    # Open the registry hive.
    my $h = Win::Hivex->open ($tmpdir . "/system", write => 1)
        or die "open system hive: $!";

    # Make the changes.
    my $regedits = '
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\rhev-apt]
"Type"=dword:00000010
"Start"=dword:00000002
"ErrorControl"=dword:00000001
"ImagePath"="c:\\\\Temp\\\\V2V\\\\rhsrvany.exe"
"DisplayName"="RHSrvAny"
"ObjectName"="LocalSystem"

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\rhev-apt\Parameters]
"CommandLine"="cmd /c \"c:\\\\Temp\\\\V2V\\\\firstboot.bat\""
"PWD"="c:\\\\Temp\\\\V2V"
';

But none of this should have mattered on the VM I converted because the
source VM CurrentControlSet apparently was ControlSet001.  So hard-coded
or calculated should not have mattered.  

Now looking at the production system after virt-v2v and after importing
into RHEV - 

HKLM\SYSTEM\Select shows:  Current and Default are 2, Failed is 1,
LastKnownGood is 3.  But this was after I booted with Last Known Good
and it came up successfully.  

I still have a copy of the VM virtual disks before importing into RHEV
sitting in the RHEV Export domain.  Maybe there's a way to copy that
image and provision a VM around it and look up its registry settings.

- Greg




More information about the Libguestfs mailing list