Differential vdi(Saved state) getting started with changed base vdi file

Here you can provide suggestions on how to improve the product, website, etc.
Post Reply
teenccu
Posts: 5
Joined: 22. Jun 2016, 18:14

Differential vdi(Saved state) getting started with changed base vdi file

Post by teenccu »

Hello,

I am using virtualbox v4.3.12r9373 through the virtual box API for our application.

As per our requirement, we are creating Differential vdi(Saved state) on the base vdi file(mounted in immutable mode) which is saved in the host machine. We create new machines then register the base vdi file and also the differencial vdi's through the api
IMedium OpenMedium(string aLocation, [ComAliasName("VirtualBox.DeviceType")] DeviceType aDeviceType, [ComAliasName("VirtualBox.AccessMode")] AccessMode aAccessMode, int aForceNewUuid)

and then start the virtual machines accordingly.

We also want to make sure that if the base vdi file is changed(somebody starts the base vdi in normal mode and with any changes save it), after the Differential vdi(Saved state) are created then Differential vdi(Saved state) should not be compatible with that .

The problem is we don't find this behaviour. We thought it will be automatically checked by the oracle virtualbox that the parent medium has undergone changes so the Differential vdi(Saved state)should not be compatible anymore. But we found that VM is successfully getting started with the changed base VDI with old Differential vdi(Saved state) and the interesting part is that running VM is not showing the new changes done in the base vdi. It is just like the Differential vdi(Saved state) is mounted on the unchanged base vdi. However, if you create a new machine with the changed base vdi , it shows the new changes.

Can anyone shed some light on this behavior and if it like this then is there any way to detect any change on the base vdi from the point any Differential vdi(Saved state) is created.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Differential vdi(Saved state) getting started with changed base vdi file

Post by mpack »

It sounds like you are adding a base VDI and a differential VDI to a VM; you are doing this manually, i.e. you are bypassing all of the disk management tools provided by VirtualBox, is that correct?

You are finding that, while the VM could check the modification UUID and notice that the base VDI has changed, it doesn't actually perform this check. Is this a correct summary?

If yes, then I can see both sides of the argument. I too have been surprised that a modification UUID is incorporated in the VDI header but not used. OTOH the devs are entitled to say that if you virtual drives in unintended ways then you're on your own: there is nothing in the user manual saying that you can do this, you are relying on an undocumented implementation detail which only applies to VDIs.
teenccu
Posts: 5
Joined: 22. Jun 2016, 18:14

Re: Differential vdi(Saved state) getting started with changed base vdi file

Post by teenccu »

Hello mpack,

When you say the below
You are finding that, while the VM could check the modification UUID and notice that the base VDI has changed, it doesn't actually perform this check. Is this a correct summary?

Well I am not sure if the check is absent. I normally assumed that Oracle VirtualBox will never start a differential child vdi with some base vdi which has undergone some changes. But it is not happening. Digging more I noticed that the UUID of the base vdi is actually not getting changed when u are mounting that in normal mode and making some changes inside it. This looks to be the main problem. Because if the UUID is not changed on the base vdi for any changes done on it, even if there is a check of UUID for its parent vdi for a child vdi it won't help.

Now as I mentioned earlier the weird part is when you successfully start the differential child vdi with the changed parent base vdi, the session does not show changes any more.
Like the below steps
1>Create a diffential vdi on a base vdi.
2>Open the base vdi in normal mode in a different machine and make some changes. So we call it now basevdi+delta.
3>Start again the differential vdi with the basevdi+delta.This is expected not to run now but this is successful but the delta changes cannot be seen in the session(Looks like it is running only the differential vdi and the old basevdi)
4>Start basevdi+delta in a different machine without any child differential vdi. The session shows the expected delta changes.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Differential vdi(Saved state) getting started with changed base vdi file

Post by mpack »

teenccu wrote:Digging more I noticed that the UUID of the base vdi is actually not getting changed when u are mounting that in normal mode and making some changes inside it. This looks to be the main problem.
I'm not sure if you are aware, but a VDI header actually has 4 UUIDs stored in it, and only the first one is visible to you.
  1. Creation UUID of the VDI.
  2. Modification UUID of the VDI.
  3. Creation UUID of parent VDI (0 if this VDI is base).
  4. Modification UUID of parent VDI (0 if this VDI is base).
So if you are looking at the creation UUID (1) then you will never see it change.
Martin
Volunteer
Posts: 2561
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: Differential vdi(Saved state) getting started with changed base vdi file

Post by Martin »

teenccu wrote: 1>Create a diffential vdi on a base vdi.
2>Open the base vdi in normal mode in a different machine and make some changes. So we call it now basevdi+delta.
3>Start again the differential vdi with the basevdi+delta.This is expected not to run now but this is successful but the delta changes cannot be seen in the session(Looks like it is running only the differential vdi and the old basevdi)
4>Start basevdi+delta in a different machine without any child differential vdi. The session shows the expected delta changes.
I don't see any of these steps changing the UUID of the base disk.
This is just a unique id for the disk and doesn't change when data is written to the disk.
Virtualbox has no function to verify if the base disk changes below a snapshot or linked clone.
teenccu
Posts: 5
Joined: 22. Jun 2016, 18:14

Re: Differential vdi(Saved state) getting started with changed base vdi file

Post by teenccu »

hello mpack/Martin ,

Thanks for your response.

Going further is there any API to check the modification UUID for the parent of the child media with the modification UUID of the base vdi?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Differential vdi(Saved state) getting started with changed base vdi file

Post by mpack »

CloneVDI will show all 4 UUIDs to you using its "Show Header" feature. I don't know of any tool which compares them.
teenccu
Posts: 5
Joined: 22. Jun 2016, 18:14

Re: Differential vdi(Saved state) getting started with changed base vdi file

Post by teenccu »

hello mpack/Martin,

Thanks to you for giving the information of how to read the parent modification uuid. I have used that to build a logic to compare and to get what I was looking for.
Thanks for your support.
Post Reply