Page 1 of 1

Updating media registry for new VDI

PostPosted: 17. May 2013, 18:59
by rousseauhk
I have a VDI which sits in the same place (c:/programdata/myapp/base.vdi) and which I use as the master VDI for cloning.

When I overwrite the base.vdi with a new version, and then try to Clone from it, I get a UUID mismatch error, since the new version of base.vdi was created from a different source to the previous version.

(UUID {96e75df9-ab4a-428d-a5e4-bd0e38362c9e} of the medium 'C:\ProgramData\myapp\base.vdi' does not match the value {acc967ad-a183-4882-9f34-7e7ce035617a} stored in the media registry ('C:\Windows\system32\config\systemprofile/.VirtualBox\VirtualBox.xml'))

How can I use the API to update the media registry with the new UUID/new VDI?

thanks
Steve

Re: Updating media registry for new VDI

PostPosted: 17. May 2013, 23:54
by noteirak
Pseudo code for this, before doing anything to the VDI
Code: Select all   Expand viewCollapse view
IMedium = IVirtualbox::openMedium(path,type,accessMode);
IMedium::close();
// copy the file to the location
IVirtualbox::openMedium(path,type,accessMode);


That should update the media registry. But your way is definitly not the good way.I would rewrite the UUID to the expected value instead, then replace the file.

Re: Updating media registry for new VDI

PostPosted: 18. May 2013, 04:22
by rousseauhk
I tried setting the UUID with IMedium.SetIds(), but got a different error about the "Accessibility check was not yet performed". Closing & reopening the medium seems to help - I'll do more testing to verify.

thx
Steve

Re: Updating media registry for new VDI

PostPosted: 19. May 2013, 10:53
by noteirak
Yes you need to perform the Accessibility check, as described by the SDK for IMedium using
Code: Select all   Expand viewCollapse view
IMedium::refreshState();