Mercurial > hg > Members > shoshi > webvirt
comparison app/controllers/pages_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 | eb4fee3d9bb8 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:261e66bd5a0c |
---|---|
1 <?php | |
2 | |
3 class PagesController extends AppController | |
4 { | |
5 public $name = "Pages"; | |
6 public $uses = null; | |
7 public $autoRender = true; | |
8 | |
9 public function display() | |
10 { | |
11 $con = WebVirtUtil::GetConnection(); | |
12 if($con == false){ | |
13 trigger_error(libvirt_get_last_error($con)); | |
14 die(); | |
15 } | |
16 | |
17 $this->set("title_for_laytout",WebVirtUtil::$wvirt_config["APP_NAME"]." - ".WebVirtUtil::$wvirt_config["APP_VERSION"]); | |
18 | |
19 $hostname = libvirt_get_hostname($con); | |
20 $this->set("hostname",$hostname); | |
21 $nodeinfo = libvirt_node_get_info($con); | |
22 $this->set("nodeinfo",$nodeinfo); | |
23 $this->set("actions",WebVirtUtil::$node_actions); | |
24 | |
25 $domains = libvirt_list_domains($con); | |
26 | |
27 $vmlist = array(); | |
28 foreach($domains as $dom){ | |
29 $name = libvirt_domain_get_name($dom); | |
30 $info = libvirt_domain_get_info($dom); | |
31 $actions = array(); | |
32 array_push($vmlist,array("name" => $name, | |
33 "memory" => $info["memory"], | |
34 "nrVirtCpu" => $info["nrVirtCpu"], | |
35 "actions" => WebVirtUtil::$domain_actions, | |
36 "uuid" => libvirt_domain_get_uuid_string($dom), | |
37 )); | |
38 } | |
39 | |
40 $this->set("domains",$vmlist); | |
41 } | |
42 } | |
43 | |
44 ?> |