Added Node Summary
This commit is contained in:
@@ -116,24 +116,30 @@ class Model_NODE extends ORMTSM {
|
||||
}
|
||||
|
||||
// Work out all the storage pools used by a node.
|
||||
// $dtype is BACKUP or ARCHIVE
|
||||
// $dtype is BACKUP (Bkup) or ARCHIVE (Arch)
|
||||
public function getStoragePools($dtype) {
|
||||
return isset($this->pools[$dtype]) ? $this->pools[$dtype] : $this->_getpools($dtype);
|
||||
}
|
||||
|
||||
// $dtype is BACKUP (Bkup) or ARCHIVE (Arch)
|
||||
private function _getpools($dtype) {
|
||||
$this->pools[$dtype] = array();
|
||||
|
||||
foreach ($this->FILESPACE->find_all() as $fso)
|
||||
foreach ($fso->storagepools($dtype) as $po)
|
||||
if (! isset($this->pools[$dtype][$po->POOLTYPE]) OR ! in_array($po->STGPOOL_NAME,$this->pools[$dtype][$po->POOLTYPE]))
|
||||
$this->pools[$dtype][$po->POOLTYPE][] = $po;
|
||||
if (! isset($this->pools[$dtype][$po->POOLTYPE][$po->STGPOOL_NAME]))
|
||||
$this->pools[$dtype][$po->POOLTYPE][$po->STGPOOL_NAME] = $po;
|
||||
|
||||
return $this->pools[$dtype];
|
||||
}
|
||||
|
||||
public function getAllStoragePoolsType($ptype) {
|
||||
return array_merge($this->getStoragePoolsType('Bkup',$ptype),$this->getStoragePoolsType('Arch',$ptype));
|
||||
$result = array();
|
||||
|
||||
foreach (Kohana::config('config.tsmdatatypes') as $btype => $ctype)
|
||||
$result = array_merge($result,$this->getStoragePoolsType($btype,$ptype));
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Return the storage pools used for a backup type
|
||||
@@ -146,42 +152,73 @@ class Model_NODE extends ORMTSM {
|
||||
return isset($this->pools[$dtype][$ptype]) ? $this->pools[$dtype][$ptype] : array();
|
||||
}
|
||||
|
||||
// @todo This routine should be cached.
|
||||
public function getStorageTypeVols($type,$spo='') {
|
||||
$count = array();
|
||||
// $dtype is BACKUP or ARCHIVE
|
||||
// $ptype is pool type (PRIMARY,ACTIVE,COPY)
|
||||
public function getStorageModeVols($dtype,$ptype,$spo='') {
|
||||
$result = 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);
|
||||
foreach ($this->VOLUMEUSAGE->where('COPY_TYPE','=',$dtype)->find_all() as $vo)
|
||||
if ((! $spo OR $vo->STGPOOL_NAME == $spo) AND $vo->STGPOOL->POOLTYPE == $ptype)
|
||||
if (! isset($result[$vo->VOLUME_NAME]))
|
||||
$result[$vo->VOLUME_NAME] = $vo;
|
||||
|
||||
return count($count);
|
||||
return $result;
|
||||
}
|
||||
|
||||
// @todo This routine should be cached.
|
||||
public function getStorageTypeFiles($type,$spo='') {
|
||||
// $ptype is pool type (PRIMARY,ACTIVE,COPY)
|
||||
public function getStorageTypeVols($ptype,$spo='') {
|
||||
$result = array();
|
||||
|
||||
foreach (Kohana::config('config.tsmdatatypes') as $btype => $ctype)
|
||||
$result = array_merge($result,$this->getStorageModeVols($ctype,$ptype,$spo));
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
// $dtype is BACKUP (Bkup) or ARCHIVE (Arch)
|
||||
// $ptype is pool type (PRIMARY,ACTIVE,COPY)
|
||||
public function getStorageModeFiles($dtype,$ptype,$spo='') {
|
||||
$count = 0;
|
||||
|
||||
foreach ($this->FILESPACE->find_all() as $fo)
|
||||
foreach ($fo->OCCUPANCY->find_all() as $oa)
|
||||
if ((! $spo OR $oa->STGPOOL_NAME == $spo) AND $oa->STGPOOL->POOLTYPE == $type)
|
||||
foreach ($fo->OCCUPANCY->where('TYPE','=',$dtype)->find_all() as $oa)
|
||||
if ((! $spo OR $oa->STGPOOL_NAME == $spo) AND $oa->STGPOOL->POOLTYPE == $ptype)
|
||||
$count += $oa->NUM_FILES;
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
// @todo This routine should be cached.
|
||||
public function getStorageTypeData($type,$spo='') {
|
||||
public function getStorageTypeFiles($ptype,$spo='') {
|
||||
$count = 0;
|
||||
|
||||
foreach (Kohana::config('config.tsmdatatypes') as $btype => $ctype)
|
||||
$count += $this->getStorageModeFiles($btype,$ptype,$spo);
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
// $dtype is BACKUP (Bkup) or ARCHIVE (Arch)
|
||||
// $ptype is pool type (PRIMARY,ACTIVE,COPY)
|
||||
public function getStorageModeData($dtype,$ptype,$spo='') {
|
||||
$count = 0;
|
||||
|
||||
foreach ($this->FILESPACE->find_all() as $fo)
|
||||
foreach ($fo->OCCUPANCY->find_all() as $oa)
|
||||
if ((! $spo OR $oa->STGPOOL_NAME == $spo) AND $oa->STGPOOL->POOLTYPE == $type)
|
||||
foreach ($fo->OCCUPANCY->where('TYPE','=',$dtype)->find_all() as $oa)
|
||||
if ((! $spo OR $oa->STGPOOL_NAME == $spo) AND $oa->STGPOOL->POOLTYPE == $ptype)
|
||||
$count += $oa->LOGICAL_MB;
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
public function getStorageTypeData($ptype,$spo='') {
|
||||
$count = 0;
|
||||
|
||||
foreach (Kohana::config('config.tsmdatatypes') as $btype => $ctype)
|
||||
$count += $this->getStorageModeData($btype,$ptype,$spo);
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
// Return the volumes that this node uses
|
||||
// $dtype is BACKUP or ARCHIVE
|
||||
public function volumes($dtype) {
|
||||
|
Reference in New Issue
Block a user