Mercurial > hg > Members > shoshi > webvirt
diff app/controllers/create_controller.php @ 1:eb4fee3d9bb8
added StoragePools management functions (storage_controller)
author | Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 27 Jul 2011 00:00:25 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/controllers/create_controller.php Wed Jul 27 00:00:25 2011 +0900 @@ -0,0 +1,38 @@ +<?php + +class CreateController extends AppController +{ + public $uses = null; + public $name = "create"; + + public function exec() + { + if(!isset($this->params["url"]["uuid"])){ + $this->set("content","Error : domain uuid is required."); + return; + } + + $uuid = $this->params["url"]["uuid"]; + $con = WebVirtUtil::GetConnection(); + if($con === FALSE){ + $this->set("content","Error : ".libvirt_get_last_error($con)); + return; + } + + $dom = libvirt_domain_lookup_by_uuid_string($con,$uuid); + $name = libvirt_domain_get_name($dom); + if($con === FALSE){ + $this->set("content","Error : ".libvirt_get_last_error($con)); + return; + } + + $result = @libvirt_domain_create($dom); + if($result === FALSE){ + $this->set("content","Error : ".libvirt_get_last_error($con)); + }else{ + $this->set("content","Launching a ".$name); + } + } +} + +?>