Updated Domain and Node views

This commit is contained in:
Deon George
2011-06-01 00:51:15 +10:00
parent ae2c1440ed
commit d7822a03e8
12 changed files with 426 additions and 184 deletions

View File

@@ -16,6 +16,9 @@ class Model_NODE extends ORMTSM {
'NODE_NAME'=>'ASC',
);
protected $_has_one = array(
'DOMAIN'=>array('foreign_key'=>'DOMAIN_NAME','far_key'=>'DOMAIN_NAME'),
);
protected $_has_many = array(
'FILESPACE'=>array('foreign_key'=>'NODE_NAME','far_key'=>'NODE_NAME'),
'VOLUMEUSAGE'=>array('foreign_key'=>'NODE_NAME','far_key'=>'NODE_NAME'),
@@ -60,7 +63,14 @@ class Model_NODE extends ORMTSM {
private $pools = array();
public function tsmclientversion() {
return sprintf('%s.%s.%s.%s',$this->CLIENT_VERSION,$this->CLIENT_RELEASE,$this->CLIENT_LEVEL,$this->CLIENT_SUBLEVEL);
if ($this->CLIENT_VERSION)
return sprintf('%s.%s.%s.%s',$this->CLIENT_VERSION,$this->CLIENT_RELEASE,$this->CLIENT_LEVEL,$this->CLIENT_SUBLEVEL);
else
return '';
}
public function platform() {
return sprintf('%s %s',$this->PLATFORM_NAME,$this->CLIENT_OS_LEVEL ? '('.$this->CLIENT_OS_LEVEL.')' : '');
}
// @todo This needs to return the global configuration.
@@ -133,6 +143,12 @@ class Model_NODE extends ORMTSM {
return $this->pools[$dtype];
}
// Test to see if a node has any data of type
// $dtype is BACKUP (Bkup) or ARCHIVE (Arch)
public function hasData($dtype) {
return $this->getStoragePools($dtype) ? TRUE : FALSE;
}
public function getAllStoragePoolsType($ptype) {
$result = array();
@@ -188,6 +204,7 @@ class Model_NODE extends ORMTSM {
return $count;
}
// $ptype is pool type (PRIMARY,ACTIVE,COPY)
public function getStorageTypeFiles($ptype,$spo='') {
$count = 0;
@@ -210,6 +227,7 @@ class Model_NODE extends ORMTSM {
return $count;
}
// $ptype is pool type (PRIMARY,ACTIVE,COPY)
public function getStorageTypeData($ptype,$spo='') {
$count = 0;