Page 1 of 1

java api: mergeTo error

Posted: 27. Dec 2011, 20:51
by P.Pan
Hi (hope this is the right location for this thread :D ),

I am trying to communicate with VirtualBox using the Java API. My OS is Ubuntu and i working with VirtualBox 4.1.4.

Right now I am trying to merge differential Images. I use differential Images instead of the Snapshot functionality, because
I can set the location of an IMedium directly (snapshots do not support this (or I found nothing to do it) and I do not like to copy my snapshots to the right location...).
Moreover the machine settings are stored separately, so a differential image is enough.

Here is my problem:
I created a base hard disk with createBaseStorage. Then I opened this base hard disk and used createDiffStorage to create a differential image.
Now I want to merge my base.vdi with the diff1.vdi (backward merge). So I used openMedium to open both vdis (first base.vdi (stored in IMedium base), second dif1.vdi (stored in IMedium diff1)). This is followed by this code:

Code: Select all

		IProgress progress = diff1.mergeTo(base);
		progress.waitForCompletion(-1);
Here I get the following error:

Exception in thread "main" org.virtualbox_4_1.VBoxException: The function "mergeTo" returned an error condition: "Assertion failed: [this->lockHandle()->isWriteLockOnCurrentThread()] at '/home/vbox/vbox-4.1.4/src/VBox/Main/src-server/MediumImpl.cpp' (4285) in nsresult Medium::markForDeletion().
Please contact the product vendor!" (0x80004005)


All conditions of the method mergeTo are satisfied:
- the mediums are not attached
- they are not immutable
- the chain is linear
- medium state is not MediumState.LockedRead or MediumState.LockedWrite

Also the forward merge does not work.


I hope someone can find my error :wink:

Re: java api: mergeTo error

Posted: 6. Jan 2012, 12:18
by P.Pan
*push*

Any suggestions :oops: ?