Mercurial > hg > Members > shoshi > webvirt
view app/controllers/shutdown_controller.php @ 0:261e66bd5a0c
hg init
author | Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 24 Jul 2011 21:08:31 +0900 |
parents | |
children |
line wrap: on
line source
<?php class ShutdownController extends AppController { public $uses = null; public $name ="Shutdown"; public $autoRender = true; public function exec() { if(!isset($this->params["url"]["uuid"])){ $this->set("content","domain uuid is required"); return; } $uuid = $this->params["url"]["uuid"]; $con = WebVirtUtil::GetConnection(); $dom = libvirt_domain_lookup_by_uuid_string($con,$uuid); if($dom === FALSE){ $this->set("content",libvirt_get_last_error($con)); return; } $ret = libvirt_domain_shutdown($dom); if($ret){ $dom_name = libvirt_domain_get_name($dom); $content = "sending shutdown request to ".$dom_name; $this->set("content",$content); }else{ $this->set("content",libvirt_get_last_error($con)); } } } ?>