Additional info for node display
This commit is contained in:
parent
21b013e3ba
commit
fe549c1c05
@ -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;
|
||||
|
@ -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'),
|
||||
);
|
||||
}
|
||||
|
@ -45,16 +45,27 @@
|
||||
<td class="spacer"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Storage Type</td>
|
||||
<td colspan="2">Storage Type</td>
|
||||
<td class="right">Vols</td>
|
||||
<td class="right">Files</td>
|
||||
<td class="right">MB</td>
|
||||
</tr>
|
||||
<?php $i=0; foreach (Kohana::config('config.tsmpooltypes') as $type) { ?>
|
||||
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
|
||||
<td class="data"><?php echo $type; ?></td>
|
||||
<td class="data" colspan="2"><?php echo $type; ?></td>
|
||||
<td class="data-right"><?php echo $node->getStorageTypeVols($type); ?></td>
|
||||
<td class="data-right"><?php echo $node->getStorageTypeFiles($type); ?></td>
|
||||
<td class="data-right"><?php echo $node->getStorageTypeData($type); ?></td>
|
||||
</tr>
|
||||
<?php foreach ($node->getAllStoragePoolsType($type) as $spo) { ?>
|
||||
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
|
||||
<td> </td>
|
||||
<td><?php echo $spo; ?></td>
|
||||
<td class="right"><?php echo $node->getStorageTypeVols($type,$spo); ?></td>
|
||||
<td class="right"><?php echo $node->getStorageTypeFiles($type,$spo); ?></td>
|
||||
<td class="right"><?php echo $node->getStorageTypeData($type,$spo); ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</table>
|
||||
</td>
|
||||
|
Reference in New Issue
Block a user