Page 1 of 1
API to delete VM
Posted: 15. Oct 2008, 07:22
by new_vbuser
Hi,
Can someone please tell me what is the API to delete the virtual machine ? I am using
Axis WS.
Thanks,
new_vbuser
Posted: 15. Oct 2008, 13:20
by TerryE
Welcome to our forum. You might want to take this opportunity to browse the
Forum Posting Guide. This contains some useful tips on how to search for VBox knowledge and how to frame Qs. And with your username, I assume that you won't be posting here long otherwise you would become an old new user
I find that the easiest way to work out what API calls to use is to look at the VBox code since this uses the API itself. You can download the OSE source from the download page, and the best routine to look at is
src/VBox/Frontends/VBoxManage/VBoxManage.cpp. Alternatively you can also use the source browser. The routine that you want is
handleUnregisterVM which is
here in the online browser. This gives the following pseudo code for this delete (you would need to add error handling etc:
Code: Select all
IVirtualBox virtualBox
ISession session
IMachine machine
virtualBox.createLocalObject (CLSID_VirtualBox)
session.createInprocObject (CLSID_Session)
if exists guid
virtualBox.GetMachine(guid, machine)
else
virtualBox.FindMachine(strName, machine)
guid=machine.uuid
virtualBox.UnregisterMachine(guid, machine)
machine.DeleteSettings()
Given the lack of examples, this is really the best way to work out the API sequences. Hope this helps.