Subversion-Projekte lars-tiefland.openvz_admin

Revision

Revision 83 | Revision 89 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 83 Revision 87
Zeile 1... Zeile 1...
1
<?php
1
<?php
2
	//$Id: vServer.class.php 83 2008-02-16 22:33:04Z lars $
2
	//$Id: vServer.class.php 87 2008-02-16 23:06:02Z lars $
3
	class vServer
3
	class vServer
4
	{
4
	{
5
	 	protected $status;
5
	 	protected $status;
6
	 	protected $name;
6
	 	protected $name;
7
	 	protected $hn_id;
7
	 	protected $hn_id;
Zeile 41... Zeile 41...
41
				$this->status["status"]="";
41
				$this->status["status"]="";
42
				$this->status["code"]="0";
42
				$this->status["code"]="0";
43
			}
43
			}
44
		}
44
		}
Zeile 45... Zeile 45...
45
		
45
		
46
		function getStatus($hn_id=1)
46
		function getStatus()
47
		{
47
		{
48
			if(!$this->status)
48
			if(!$this->status)
Zeile 49... Zeile 49...
49
			{
49
			{
50
 
50
 
51
				unset($out);
51
				unset($out);
52
				if($this->v_id!=0)
52
				if($this->v_id!=0)
53
				{
53
				{
54
					$id=$this->v_id;
54
					$id=$this->v_id;
55
					$hn=HN::getHN($hn_id);
55
					$hn=HN::getHN($this->hn_id);
56
					$cmd="ssh root@".$hn["name"]." vzctl status $id";
56
					$cmd="ssh root@".$hn["name"]." vzctl status $id";
57
					exec($cmd,$out,$ret);
57
					exec($cmd,$out,$ret);
58
					if(!$ret)
58
					if(!$ret)
Zeile 99... Zeile 99...
99
			$sql="SELECT * FROM vservers WHERE hn_id=$hn_id ORDER BY v_id";
99
			$sql="SELECT * FROM vservers WHERE hn_id=$hn_id ORDER BY v_id";
100
			$res=$db->query($sql);
100
			$res=$db->query($sql);
101
			$id=0;
101
			$id=0;
102
			while($row=$res->fetchRow())
102
			while($row=$res->fetchRow())
103
			{
103
			{
104
				$vservers[$row["id"]]=$row;
104
				$vservers[$id]=$row;
105
				$v=new vServer($row["v_id"], $row["hn_id"]);
105
				$v=new vServer($row["v_id"], $row["hn_id"]);
106
				$ret=$v->getStatus($hn_id);
106
				$ret=$v->getStatus();
107
				$dist=new Dist($row["v_dist"]);
107
				$dist=new Dist($row["v_dist"]);
108
				$dist_info=$dist->toArray();
108
				$dist_info=$dist->toArray();
109
				$vservers[$id]["v_dist_name"]=$dist_info["dist_name"];
109
				$vservers[$id]["v_dist_name"]=$dist_info["dist_name"];
110
				$vservers[$id]["v_status"]=$ret["status"];
110
				$vservers[$id]["v_status"]=$ret["status"];
111
				$vservers[$id]["code"]=$ret["code"];
111
				$vservers[$id]["code"]=$ret["code"];