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

Discussion about using the VirtualBox API, Tutorials, Samples.

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

Postby debugs-bunny » 30. Aug 2017, 16:51

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   Expand viewCollapse view
      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?
debugs-bunny
 
Posts: 6
Joined: 12. Jun 2017, 17:30

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

Postby noteirak » 30. Aug 2017, 18:41

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://kamax.io/hbox/
Manage your VirtualBox infrastructure the free way!
noteirak
Site Moderator
 
Posts: 5198
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7

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

Postby debugs-bunny » 31. Aug 2017, 12:53

Now it works! Thanks! :)

working code:

Code: Select all   Expand viewCollapse view
      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. ;)
debugs-bunny
 
Posts: 6
Joined: 12. Jun 2017, 17:30

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

Postby noteirak » 31. Aug 2017, 13:12

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://kamax.io/hbox/
Manage your VirtualBox infrastructure the free way!
noteirak
Site Moderator
 
Posts: 5198
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7


Return to The VirtualBox API

Who is online

Users browsing this forum: No registered users and 1 guest