diff --git a/application/classes/Model/NODE.php b/application/classes/Model/NODE.php index 1dbbe78..382da88 100644 --- a/application/classes/Model/NODE.php +++ b/application/classes/Model/NODE.php @@ -550,6 +550,28 @@ class Model_NODE extends ORM_TSM { return round($this->fs_data()/$this->fs_capacity()*100,2); } + public function fs_vol($vol) { + Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__)); + + $k = sprintf('%s-%s-%s',__METHOD__,$this->NODE_NAME,$vol); + $c = Kohana::$config->load('config')->cache; + + if (is_null($result = Cache::instance($c)->get($k))) { + $result = array(); + + foreach ($this->_volumeusage() as $vuo) + if ($vuo->VOLUME_NAME == $vol AND ! in_array($vuo->FILESPACE_NAME,$result)) + array_push($result,$vuo->FILESPACE); + + Sort::MASort($result,'FILESPACE_NAME'); + // @todo Cache time should be configurble + Cache::instance($c)->set($k,$result,300); + } + + Log::instance()->add(LOG::DEBUG,'EXIT :method',array(':method'=>__METHOD__)); + return $result; + } + /** * Return a Graph of the BA Client Sessions * @param $type is Bkup/Arch/SpMg diff --git a/application/classes/Model/VOLUMEUSAGE.php b/application/classes/Model/VOLUMEUSAGE.php index e9fe34e..9d9bac4 100644 --- a/application/classes/Model/VOLUMEUSAGE.php +++ b/application/classes/Model/VOLUMEUSAGE.php @@ -17,6 +17,7 @@ class Model_VOLUMEUSAGE extends ORM_TSM { ); protected $_has_one = array( + 'FILESPACE'=>array('foreign_key'=>'FILESPACE_NAME','far_key'=>'FILESPACE_NAME'), '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/node/volumes.php b/application/views/node/volumes.php index 370919d..c95a310 100644 --- a/application/views/node/volumes.php +++ b/application/views/node/volumes.php @@ -44,7 +44,7 @@