VirtualBox error: rc=0x80004001 Method Machine::deleteSnapshot is not implemented

Discussion about using the VirtualBox API, Tutorials, Samples.
Post Reply
debugs-bunny
Posts: 6
Joined: 12. Jun 2017, 17:30

VirtualBox error: rc=0x80004001 Method Machine::deleteSnapshot is not implemented

Post by debugs-bunny »

Hi,

I want to delete a Snapshot via the Java API (version 5.1.26) but when I try so, it tells me this:

VirtualBox error: rc=0x80004001 Method Machine::deleteSnapshot is not implemented

my code:

Code: Select all

		ISession session = mgr.getSessionObject();

		IMachine vm = mgr.getVBox().findMachine(VM_UUID);

		IProgress progress = vm.deleteSnapshot(SNAPSHOT_UUID); // <- Error line

		progress.waitForCompletion(20000);
In the docs (SDKRef.pdf) there is a note only on IMachine::deleteSnapshotAndAllChildren and IMachine::deleteSnapshotRange that these methods are not implemented, but on the mentioned method there is no note concerning this.

So is the method not implemented yet? And if this is the case, is there no way to delete a Snapshot via the Java API?
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: VirtualBox error: rc=0x80004001 Method Machine::deleteSnapshot is not implemented

Post by noteirak »

You need a shared lock on the VM before doing snapshot operations, which you do not have in your sample code.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
debugs-bunny
Posts: 6
Joined: 12. Jun 2017, 17:30

Re: VirtualBox error: rc=0x80004001 Method Machine::deleteSnapshot is not implemented

Post by debugs-bunny »

Now it works! Thanks! :)

working code:

Code: Select all

		ISession session = mgr.getSessionObject();

		IMachine vm = mgr.getVBox().findMachine(vmUid);

		vm.lockMachine(session, LockType.Shared);

		IProgress progress = session.getMachine().deleteSnapshot(snapUid);

		progress.waitForCompletion(20000);
But the exception there was a little bit confusing. ;)
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: VirtualBox error: rc=0x80004001 Method Machine::deleteSnapshot is not implemented

Post by noteirak »

debugs-bunny wrote:the exception there was a little bit confusing. ;)
Yes, seems like someone forgot to put the right one, thanks for reporting it!
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Post Reply