Destroy guest OS using php

Posted by Alee on Ask Ubuntu See other posts from Ask Ubuntu or by Alee
Published on 2012-03-25T18:44:07Z Indexed on 2012/03/26 23:39 UTC
Read the original article Hit count: 314

Filed under:
|
|

I am using libvirt-php to manage my virtual machines, and I need to shutdown/destroy domU.

For this I used the following php script:

< ? php $conn=libvirt_connect("xen:///");
$name=libvirt_domain_lookup_by_id($conn,4);
$dest=libvirt_domain_destroy($name);
echo $dest; ?>

When I run this on xampp server i get the following output:

Warning: libvirt_domain_destroy() [function.libvirt-domain-destroy]: operation virDomainDestroy forbidden for read only access in /opt/lampp/htdocs/xampp/byname.php on line 5.

Here is the documentation: http://libvirt.org/php/api-reference.html#libvirt_domain_destroy

© Ask Ubuntu or respective owner

Related posts about shutdown

Related posts about php