Quantcast
Channel: Windows Virtual PC and XP Mode forum
Viewing all articles
Browse latest Browse all 1366

setting VMHardDisk.Parent: One of the parent hard disks of ... appears to have been modified without using differencing disk

$
0
0

I can't set the parent of a differencing VHD using VirtualPC API.

VirtualPC does not support snapshots, VirtualBox does. But VirtualBox does not save correct parent path inside vhd file when merging snapshots. Here's the correct hierarchy in VBox:

ibm.vhd
    {7ac565a9-ca78-45e8-8b78-35875dfda0f5}.vhd
        {0d5111c4-c496-49ac-a7f4-ea9875fd9fda}.vhd
            {e5a1bb76-3410-4879-857b-0442bb7c4be3}.vhd


And here is what's inside the vhds:

$ strings -T binary --all --encoding=l {7ac565a9-ca78-45e8-8b78-35875dfda0f5}.vhd
c:\VM_share\ibm-vhd\wcde-latest\ibm.vhd
..\ibm.vhd

$ strings -T binary --all --encoding=l {0d5111c4-c496-49ac-a7f4-ea9875fd9fda}.vhd
C:\VM_share\ibm-vhd\wcde-latest\Snapshots\{f51beecd-dc54-4a9a-93b6-67d2d8ca9e97}.vhd
{f51beecd-dc54-4a9a-93b6-67d2d8ca9e97}.vhd

$ strings -T binary --all --encoding=l {e5a1bb76-3410-4879-857b-0442bb7c4be3}.vhd
c:\VM_share\ibm-vhd\wcde-latest\Snapshots\{0d5111c4-c496-49ac-a7f4-ea9875fd9fda}.vhd
.\{0d5111c4-c496-49ac-a7f4-ea9875fd9fda}.vhd


I'm trying to assign the right value to the property "VMHardDisk.Parent" , but it fails.

> cscript //nologo vhdparent.vbs %cd%\{0d5111c4-c496-49ac-a7f4-ea9875fd9fda}.vhd
child         : c:\VM_share\ibm-vhd\wcde-latest\Snapshots\{0d5111c4-c496-49ac-a7f4-ea9875fd9fda}.vhd
actual parent : C:\VM_share\ibm-vhd\wcde-latest\Snapshots\{7ac565a9-ca78-45e8-8b78-35875dfda0f5}.vhd
current parent: C:\VM_share\ibm-vhd\wcde-latest\Snapshots\{f51beecd-dc54-4a9a-93b6-67d2d8ca9e97}.vhd
fixing parent
c:\VM_share\ibm-vhd\wcde-latest\Snapshots\vhdparent.vbs(45, 1) (null): One of the parent hard disks of 'c:\VM_share\ibm-vhd\wcde-latest\Snapshots\{0d5111c4-c496-49ac-a7f4-ea9875fd9fda}.vhd' appears to have been modified without using differencing disk.

No it's not!

the script:

Const DeviceType_HardDisk = 3
Const AccessMode_ReadOnly = 0

Set fso = CreateObject ("Scripting.FileSystemObject")
Set stdout = fso.GetStandardStream (1)
Set stderr = fso.GetStandardStream (2)

Set arguments = WScript.Arguments

'sPathChild = "c:\VM_share\ibm-vhd\wcde-latest\Snapshots\{718e6b24-8f0e-4655-a664-2fb05dee5a0d}.vhd"
sPathChild = arguments(0)

sub fixParent(sPathChild)

stdout.WriteLine "child         : " & sPathChild

set vb = CreateObject("VirtualBox.VirtualBox")

set VHDChild = vb.openMedium(sPathChild, DeviceType_HardDisk, ccessMode_ReadOnly, false)
set VHDParent = VHDChild.parent

if IsNull(VHDParent) then
    stdout.WriteLine sPathChild & " has no parent"
    exit sub
end if

sPathActualParent = VHDParent.location
stdout.WriteLine "actual parent : " & sPathActualParent

set vpc = CreateObject("VirtualPC.Application")
set VHDChild = vpc.GetHardDisk(sPathChild)

sPathCurrentParent = VHDChild.Parent.File
stdout.WriteLine "current parent: " & sPathCurrentParent

if 0 = StrComp(sPathCurrentParent, sPathActualParent, vbTextCompare) then
    stdout.WriteLine "parent ok"
    exit sub
end if

stdout.WriteLine "fixing parent"

set VHDParent = vpc.GetHardDisk(sPathActualParent)

VHDChild.Parent = VHDParent

end sub

fixParent sPathChild

_


Viewing all articles
Browse latest Browse all 1366

Trending Articles