Additional info for node display

This commit is contained in:
Deon George
2011-05-29 11:41:36 +10:00
parent 21b013e3ba
commit fe549c1c05
3 changed files with 35 additions and 7 deletions

View File

@@ -132,8 +132,12 @@ class Model_NODE extends ORMTSM {
return $this->pools[$dtype];
}
public function getAllStoragePoolsType($ptype) {
return array_merge($this->getStoragePoolsType('Bkup',$ptype),$this->getStoragePoolsType('Arch',$ptype));
}
// Return the storage pools used for a backup type
// $dtype is BACKUP or ARCHIVE
// $dtype is BACKUP (Bkup) or ARCHIVE (Arch)
// $ptype is pool type (PRIMARY,ACTIVE,COPY)
public function getStoragePoolsType($dtype,$ptype) {
if (! isset($this->pools[$dtype]))
@@ -143,24 +147,36 @@ class Model_NODE extends ORMTSM {
}
// @todo This routine should be cached.
public function getStorageTypeFiles($type) {
public function getStorageTypeVols($type,$spo='') {
$count = array();
foreach ($this->VOLUMEUSAGE->find_all() as $vo)
if ((! $spo OR $vo->STGPOOL_NAME == $spo) AND $vo->STGPOOL->POOLTYPE == $type)
if (! in_array($vo->VOLUME_NAME,$count))
array_push($count,$vo->VOLUME_NAME);
return count($count);
}
// @todo This routine should be cached.
public function getStorageTypeFiles($type,$spo='') {
$count = 0;
foreach ($this->FILESPACE->find_all() as $fo)
foreach ($fo->OCCUPANCY->find_all() as $oa)
if ($oa->STGPOOL->POOLTYPE == $type)
if ((! $spo OR $oa->STGPOOL_NAME == $spo) AND $oa->STGPOOL->POOLTYPE == $type)
$count += $oa->NUM_FILES;
return $count;
}
// @todo This routine should be cached.
public function getStorageTypeData($type) {
public function getStorageTypeData($type,$spo='') {
$count = 0;
foreach ($this->FILESPACE->find_all() as $fo)
foreach ($fo->OCCUPANCY->find_all() as $oa)
if ($oa->STGPOOL->POOLTYPE == $type)
if ((! $spo OR $oa->STGPOOL_NAME == $spo) AND $oa->STGPOOL->POOLTYPE == $type)
$count += $oa->LOGICAL_MB;
return $count;