annotate app/controllers/create_controller.php @ 4:c3adb28473d6 default tip

modified icon feature
author Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
date Tue, 16 Aug 2011 18:31:36 +0900
parents eb4fee3d9bb8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 <?php
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 class CreateController extends AppController
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 {
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 public $uses = null;
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 public $name = "create";
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 public function exec()
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 {
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 if(!isset($this->params["url"]["uuid"])){
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 $this->set("content","Error : domain uuid is required.");
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 return;
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 }
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 $uuid = $this->params["url"]["uuid"];
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 $con = WebVirtUtil::GetConnection();
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 if($con === FALSE){
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 $this->set("content","Error : ".libvirt_get_last_error($con));
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 return;
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 }
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 $dom = libvirt_domain_lookup_by_uuid_string($con,$uuid);
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 $name = libvirt_domain_get_name($dom);
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 if($con === FALSE){
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 $this->set("content","Error : ".libvirt_get_last_error($con));
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 return;
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 }
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 $result = @libvirt_domain_create($dom);
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 if($result === FALSE){
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 $this->set("content","Error : ".libvirt_get_last_error($con));
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 }else{
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 $this->set("content","Launching a ".$name);
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 }
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 }
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 }
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37
eb4fee3d9bb8 added StoragePools management functions (storage_controller)
Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 ?>