Mercurial > hg > Members > shoshi > webvirt
comparison 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 |
comparison
equal
deleted
inserted
replaced
0:261e66bd5a0c | 1:eb4fee3d9bb8 |
---|---|
1 <?php | |
2 | |
3 class CreateController extends AppController | |
4 { | |
5 public $uses = null; | |
6 public $name = "create"; | |
7 | |
8 public function exec() | |
9 { | |
10 if(!isset($this->params["url"]["uuid"])){ | |
11 $this->set("content","Error : domain uuid is required."); | |
12 return; | |
13 } | |
14 | |
15 $uuid = $this->params["url"]["uuid"]; | |
16 $con = WebVirtUtil::GetConnection(); | |
17 if($con === FALSE){ | |
18 $this->set("content","Error : ".libvirt_get_last_error($con)); | |
19 return; | |
20 } | |
21 | |
22 $dom = libvirt_domain_lookup_by_uuid_string($con,$uuid); | |
23 $name = libvirt_domain_get_name($dom); | |
24 if($con === FALSE){ | |
25 $this->set("content","Error : ".libvirt_get_last_error($con)); | |
26 return; | |
27 } | |
28 | |
29 $result = @libvirt_domain_create($dom); | |
30 if($result === FALSE){ | |
31 $this->set("content","Error : ".libvirt_get_last_error($con)); | |
32 }else{ | |
33 $this->set("content","Launching a ".$name); | |
34 } | |
35 } | |
36 } | |
37 | |
38 ?> |