Fixed FS count on VOL

This commit is contained in:
Deon George 2013-01-18 11:12:45 +11:00
parent c4409598be
commit 05eda26bc1
3 changed files with 24 additions and 1 deletions

View File

@ -550,6 +550,28 @@ class Model_NODE extends ORM_TSM {
return round($this->fs_data()/$this->fs_capacity()*100,2); 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 * Return a Graph of the BA Client Sessions
* @param $type is Bkup/Arch/SpMg * @param $type is Bkup/Arch/SpMg

View File

@ -17,6 +17,7 @@ class Model_VOLUMEUSAGE extends ORM_TSM {
); );
protected $_has_one = array( protected $_has_one = array(
'FILESPACE'=>array('foreign_key'=>'FILESPACE_NAME','far_key'=>'FILESPACE_NAME'),
'STGPOOL'=>array('foreign_key'=>'STGPOOL_NAME','far_key'=>'STGPOOL_NAME'), 'STGPOOL'=>array('foreign_key'=>'STGPOOL_NAME','far_key'=>'STGPOOL_NAME'),
'VOLUME'=>array('foreign_key'=>'VOLUME_NAME','far_key'=>'VOLUME_NAME'), 'VOLUME'=>array('foreign_key'=>'VOLUME_NAME','far_key'=>'VOLUME_NAME'),
); );

View File

@ -44,7 +44,7 @@
<td class="data-right"><?php printf('%s/%s',$vo->READ_ERRORS,$vo->WRITE_ERRORS); ?></td> <td class="data-right"><?php printf('%s/%s',$vo->READ_ERRORS,$vo->WRITE_ERRORS); ?></td>
<td class="data-right"><?php echo $vo->display('PCT_UTILIZED'); ?></td> <td class="data-right"><?php echo $vo->display('PCT_UTILIZED'); ?></td>
<td class="data-right"><?php echo $vo->display('PCT_RECLAIM'); ?></td> <td class="data-right"><?php echo $vo->display('PCT_RECLAIM'); ?></td>
<td class="data-right"><?php echo count($vo->fs_byctype($ctype))-1; ?></td> <td class="data-right"><?php echo count($vo->fs_byctype($ctype))-count($o->fs_vol($vo->VOLUME_NAME)); ?></td>
<td class="data-right"><?php echo count($vo->nodes_byctype($ctype))-1; ?></td> <td class="data-right"><?php echo count($vo->nodes_byctype($ctype))-1; ?></td>
</tr> </tr>
<?php } ?> <?php } ?>