diff --git a/application/classes/model/node.php b/application/classes/model/node.php index a5a311b..d543222 100644 --- a/application/classes/model/node.php +++ b/application/classes/model/node.php @@ -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; diff --git a/application/classes/model/volumeusage.php b/application/classes/model/volumeusage.php index 039e80e..dd763de 100644 --- a/application/classes/model/volumeusage.php +++ b/application/classes/model/volumeusage.php @@ -19,6 +19,7 @@ class Model_VOLUMEUSAGE extends ORMTSM { ); protected $_has_one = array( + 'STGPOOL'=>array('foreign_key'=>'STGPOOL_NAME','far_key'=>'STGPOOL_NAME'), 'VOLUME'=>array('foreign_key'=>'VOLUME_NAME','far_key'=>'VOLUME_NAME'), ); } diff --git a/application/views/nodes/detail_filesystem.php b/application/views/nodes/detail_filesystem.php index 7214754..4eaba4d 100644 --- a/application/views/nodes/detail_filesystem.php +++ b/application/views/nodes/detail_filesystem.php @@ -45,16 +45,27 @@