Hi Balachandar,

You can also look at vboxshell.py, which contains rich set of examples on usage of VirtualBox API (and works via both SOAP and COM).
To power off VM code similar to following is used:

from vboxapi import VirtualBoxManager

style = "WEBSERVICE" # or None for local COM/XPCOM
g_virtualBoxManager = VirtualBoxManager(style, None)
mgr=g_virtualBoxManager.mgr
vb=g_virtualBoxManager.vbox
session = mgr.getSessionObject(vb)
uuid = mach.id
try:
progress = vb.openExistingSession(session, uuid)
except Exception,e:
print "Session to '%s' not open: %s" %(mach.name,e)
if g_verbose:
traceback.print_exc()
return
console=session.console
console.powerDown()
session.close()

VirtualBox needs separate session open phase to obtain exclusive control over VM execution, that's why sample is a bit more complex that one would wish.

Thanks,
Nikolay


Achim Hasenmueller пишет:
You can check this example in Python (not using SOAP but the semantics are 
identical): http://code.google.com/p/vboxweb/source/browse/trunk/VBoxWebSrv.py

Basically you have to open a session on the VM (OpenExistingSession for a 
running VM) and then get the Console object of the Session and perform the 
poweroff operation on the console object.

I recommend reading the SDK manual (download the SDK from virtualbox.org) and 
having a look at the source code of VBoxManage: 
http://www.virtualbox.org/browser/trunk/src/VBox/Frontends/VBoxManage

Achim.

On Jan 15, 2010, at 6:03 , AMARNATH, Balachandar wrote:

Hi all,

I am a new comer to this mailing list as well as Virtual Box. I was writing 
simple programs using Virtual Box Web Service API to poweron a particular VM, 
get the state. But i am not able to find suitable API to poweroff the same. 
Please help me out of this issue, i am looking after this for more than a day. 
:(


thanks in advance

Bala

The information in this e-mail is confidential. The contents may not be 
disclosed or used by anyone other than the addressee. Access to this e-mail by 
anyone else is unauthorised.
If you are not the intended recipient, please notify Airbus immediately and 
delete this e-mail.
Airbus cannot accept any responsibility for the accuracy or completeness of 
this e-mail as it has been sent over public networks. If you have any concerns 
over the content of this message or its Accuracy or Integrity, please contact 
Airbus immediately.
All outgoing e-mails from Airbus are checked using regularly updated virus 
scanning software but you should take whatever measures you deem to be 
appropriate to ensure that this message and any attachments are virus free.


_______________________________________________
vbox-dev mailing list
[email protected]
http://vbox.innotek.de/mailman/listinfo/vbox-dev


_______________________________________________
vbox-dev mailing list
[email protected]
http://vbox.innotek.de/mailman/listinfo/vbox-dev


_______________________________________________
vbox-dev mailing list
[email protected]
http://vbox.innotek.de/mailman/listinfo/vbox-dev

Reply via email to