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

@@ -17,7 +17,9 @@ class Model_DOMAIN extends ORMTSM {
);
protected $_has_many = array(
'MGMTCLASS'=>array('foreign_key'=>'DOMAIN_NAME','far_key'=>'DOMAIN_NAME'),
'NODE'=>array('foreign_key'=>'DOMAIN_NAME','far_key'=>'DOMAIN_NAME'),
'SCHEDULE_CLIENT'=>array('foreign_key'=>'DOMAIN_NAME','far_key'=>'DOMAIN_NAME')
);
// Pools used by a domain.
@@ -83,5 +85,17 @@ class Model_DOMAIN extends ORMTSM {
return $count;
}
// $dtype is BACKUP or ARCHIVE
// $ptype is pool type (PRIMARY,ACTIVE,COPY)
public function getStorageModeNodes($dtype,$ptype,$spo='') {
$result = array();
foreach ($this->NODE->find_all() as $no)
if ($no->getStorageModeData($dtype,$ptype,$spo))
array_push($result,$no);
return $result;
}
}
?>

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;

View File

@@ -16,10 +16,18 @@ class Model_SCHEDULE_CLIENT extends ORMTSM {
'SCHEDULE_NAME'=>'ASC',
);
protected $_has_many = array(
'ASSOCIATION'=>array('foreign_key'=>'SCHEDULE_NAME','far_key'=>'SCHEDULE_NAME'),
);
protected $_display_filters = array(
'STARTTIME'=>array(
array('ORMTSM::date',array(':value','h:m')),
),
);
public function getNodes() {
return $this->ASSOCIATION->find_all();
}
}
?>

View File

@@ -41,5 +41,13 @@ class Model_VOLUME extends ORMTSM {
public function getNodesOnVol($dtype) {
return $this->VOLUMEUSAGE->select('NODE_NAME')->distinct(TRUE)->where('COPY_TYPE','=',$dtype)->find_all()->count();
}
public function isScratch() {
return $this->SCRATCH === 'YES' ? TRUE : FALSE;
}
public function location() {
return $this->display('LOCATION');
}
}
?>