Some more performance improvements and caching

This commit is contained in:
Deon George 2012-12-07 14:33:16 +11:00
parent df498a76a7
commit 7a3539cb95
13 changed files with 475 additions and 203 deletions

View File

@ -36,19 +36,84 @@ class Model_DOMAIN extends ORM_TSM {
* Get all the NODES in this DOMAIN
*/
private function _nodes() {
$result = array();
$k = sprintf('%s-%s',__METHOD__,$this->DOMAIN_NAME);
$c = Kohana::$config->load('config')->cache;
// In the interest of performance, we load all the records and get PHP to process it.
// Our ORM caching we reduce the hit on TSM.
foreach (ORM::factory('NODE')->find_all() as $o)
if ($o->DOMAIN_NAME == $this->DOMAIN_NAME)
array_push($result,$o);
if (is_null($result = Cache::instance($c)->get($k))) {
$result = array();
// In the interest of performance, we load all the records and get PHP to process it.
// Our ORM caching we reduce the hit on TSM.
foreach (ORM::factory('NODE')->find_all() as $o)
if ($o->DOMAIN_NAME == $this->DOMAIN_NAME)
array_push($result,$o);
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
return $result;
}
public function nodes() {
return $this->_nodes();
private function _node_int($method,$data) {
$k = sprintf('%s-%s-%s-%s',__METHOD__,$this->DOMAIN_NAME,$method,$data);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = 0;
foreach ($this->_nodes() as $no)
$result += $no->{$method}($data);
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
return $result;
}
private function _node_bypoolbybtype($pool,$method,$type) {
$k = sprintf('%s-%s-%s-%s-%s',__METHOD__,$this->DOMAIN_NAME,$pool,$method,$type);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = 0;
foreach ($this->_nodes() as $no)
$result += $no->{$method}($pool,$type);
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
return $result;
}
/**
* Return the BACKUP TYPES used by NODES in this DOMAIN
* ie: Bkup/Arch/SpMg
*/
public function btypes() {
$k = sprintf('%s-%s',__METHOD__,$this->DOMAIN_NAME);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = array();
foreach ($this->_nodes() as $no)
$result = array_merge($result,$no->btypes());
$result = array_unique($result);
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
return $result;
}
public function file_bybtype($type) {
return $this->_node_int('file_bybtype',$type);
}
/**
@ -56,20 +121,19 @@ class Model_DOMAIN extends ORM_TSM {
* @param $pool is STORAGE POOL NAME
*/
public function file_bypool($pool) {
$k = sprintf('%s-%s-%s',__METHOD__,$this->DOMAIN_NAME,$pool);
$c = Kohana::$config->load('config')->cache;
return $this->_node_int('file_bypool',$pool);
}
if (is_null($result = Cache::instance($c)->get($k))) {
$result = 0;
public function file_bypoolbybtype($pool,$type) {
return $this->_node_bypoolbybtype($pool,'file_bypoolbybtype',$type);
}
foreach ($this->_nodes() as $no)
$result += $no->file_bypool($pool);
public function file_byptype($type) {
return $this->_node_int('file_byptype',$type);
}
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
return $result;
public function logmb_bybtype($type) {
return $this->_node_int('logmb_bybtype',$type);
}
/**
@ -77,19 +141,27 @@ class Model_DOMAIN extends ORM_TSM {
* @param $pool is STORAGE POOL NAME
*/
public function logmb_bypool($pool) {
$k = sprintf('%s-%s-%s',__METHOD__,$this->DOMAIN_NAME,$pool);
$c = Kohana::$config->load('config')->cache;
return $this->_node_int('logmb_bypool',$pool);
}
if (is_null($result = Cache::instance($c)->get($k))) {
$result = 0;
public function logmb_bypoolbybtype($pool,$type) {
return $this->_node_bypoolbybtype($pool,'logmb_bypoolbybtype',$type);
}
foreach ($this->_nodes() as $no)
$result += $no->logmb_bypool($pool);
public function logmb_byptype($type) {
return $this->_node_int('logmb_byptype',$type);
}
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
public function nodes() {
return $this->_nodes();
}
public function nodes_bybtype($type) {
$result = array();
foreach ($this->_nodes() as $no)
if ($no->file_bybtype($type))
array_push($result,$no);
return $result;
}
@ -107,6 +179,26 @@ class Model_DOMAIN extends ORM_TSM {
return $result;
}
public function nodes_bypoolbybtype($pool,$type) {
$result = array();
foreach ($this->_nodes() as $no)
if ($no->file_bypoolbybtype($pool,$type))
array_push($result,$no);
return $result;
}
public function nodes_byptype($type) {
$result = array();
foreach ($this->_nodes() as $no)
if ($no->file_byptype($type) AND ! in_array($no,$result))
array_push($result,$no);
return $result;
}
/**
* Return the STORAGE POOLS used by NODES in this DOMAIN
*/
@ -117,7 +209,7 @@ class Model_DOMAIN extends ORM_TSM {
if (is_null($result = Cache::instance($c)->get($k))) {
$result = array();
foreach ($this->nodes() as $no)
foreach ($this->_nodes() as $no)
foreach ($no->stgpools() as $spo)
if (! in_array($spo,$result))
array_push($result,$spo);
@ -129,29 +221,6 @@ class Model_DOMAIN extends ORM_TSM {
return $result;
}
/**
* Return the STORAGE POOL TYPES used by NODES in this DOMAIN
* ie: ACTIVE/PRIMARY/COPY
* @todo This should be sorted by PRIMARY/ACTIVE/COPY
*/
public function stgpooltypes() {
$k = sprintf('%s-%s',__METHOD__,$this->DOMAIN_NAME);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = array();
foreach ($this->stgpools() as $spo)
if (! in_array($spo->POOLTYPE,$result))
array_push($result,$spo->POOLTYPE);
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
return $result;
}
/**
* Return the STORAGE POOLS that NODES in this DOMAIN uses by BACKUP TYPE
* @param $type is Bkup/Arch/SpMg
@ -200,22 +269,21 @@ class Model_DOMAIN extends ORM_TSM {
}
/**
* Return the VOLUMES that NODES in this DOMAIN use
* @param $pool is STORAGE POOL NAME
* Return the STORAGE POOL TYPES used by NODES in this DOMAIN
* ie: ACTIVE/PRIMARY/COPY
* @todo This should be sorted by PRIMARY/ACTIVE/COPY
*/
public function vols_bypool($pool) {
$k = sprintf('%s-%s-%s',__METHOD__,$this->DOMAIN_NAME,$pool);
public function stgpooltypes() {
$k = sprintf('%s-%s',__METHOD__,$this->DOMAIN_NAME);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$x = $result = array();
$result = array();
foreach ($this->_nodes() as $no)
foreach ($no->vols_bypool($pool) as $vuo)
if (! in_array($vuo->VOLUME_NAME,$x)) {
array_push($result,$vuo);
array_push($x,$vuo->VOLUME_NAME);
}
$result = array_merge($result,$no->stgpooltypes());
$result = array_unique($result);
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
@ -224,6 +292,10 @@ class Model_DOMAIN extends ORM_TSM {
return $result;
}
public function vols_bybtype($type) {
return $this->vols_byctype($this->datatypemap($type));
}
/**
* Return the VOLUMES that NODES in this DOMAIN uses by BACKUP TYPE
* @param $type is BACKUP/ARCHIVE/SPACE MANAGED
@ -232,15 +304,13 @@ class Model_DOMAIN extends ORM_TSM {
$k = sprintf('%s-%s-%s',__METHOD__,$this->DOMAIN_NAME,$type);
$c = Kohana::$config->load('config')->cache;
if (TRUE OR is_null($result = Cache::instance($c)->get($k))) {
$x = $result = array();
if (is_null($result = Cache::instance($c)->get($k))) {
$result = array();
foreach ($this->_nodes() as $no)
foreach ($no->vols_byctype($type) as $vuo)
if (! in_array($vuo->VOLUME_NAME,$x)) {
array_push($result,$vuo);
array_push($x,$vuo->VOLUME_NAME);
}
foreach ($no->vols_byctype($type) as $vo)
if (! in_array($vo->VOLUME_NAME,$result))
array_push($result,$vo);
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
@ -249,6 +319,33 @@ class Model_DOMAIN extends ORM_TSM {
return $result;
}
/**
* Return the VOLUMES that NODES in this DOMAIN use
* @param $pool is STORAGE POOL NAME
*/
public function vols_bypool($pool) {
$k = sprintf('%s-%s-%s',__METHOD__,$this->DOMAIN_NAME,$pool);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = array();
foreach ($this->_nodes() as $no)
foreach ($no->vols_bypool($pool) as $vo)
if (! in_array($vo->VOLUME_NAME,$result))
array_push($result,$vo);
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
return $result;
}
public function vols_bypoolbybtype($pool,$type) {
return $this->vols_bypoolbyctype($pool,$this->datatypemap($type));
}
/**
* Return the VOLUMES that this NODE uses by pool and BACKUP TYPE
* @param $pool is STORAGE POOL NAME
@ -257,11 +354,23 @@ class Model_DOMAIN extends ORM_TSM {
public function vols_bypoolbyctype($pool,$type) {
$x = $result = array();
foreach ($this->vols_bypool($pool) as $vuo)
if ($vuo->COPY_TYPE == $type AND ! in_array($vuo->VOLUME_NAME,$x)) {
array_push($result,$vuo);
array_push($x,$vuo->VOLUME_NAME);
}
foreach ($this->_nodes() as $no)
foreach ($no->vols_bypoolbyctype($pool,$type) as $vo)
if (! in_array($vo->VOLUME_NAME,$result))
array_push($result,$vo);
return $result;
}
public function vols_byptype($type) {
$x = $result = array();
foreach ($this->_nodes() as $no)
foreach ($no->vols_byptype($type) as $vuo)
if (! in_array($vuo->VOLUME_NAME,$x)) {
array_push($result,$vuo);
array_push($x,$vuo->VOLUME_NAME);
}
return $result;
}

View File

@ -133,14 +133,25 @@ class Model_NODE extends ORM_TSM {
* Get all the OCCUPANCY for this NODE
*/
private function _occupancy() {
$result = array();
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
// In the interest of performance, we load all the records and get PHP to process it.
// Our ORM caching we reduce the hit on TSM.
foreach (ORM::factory('OCC')->find_all() as $o)
if ($o->NODE_NAME == $this->NODE_NAME)
array_push($result,$o);
$k = sprintf('%s-%s',__METHOD__,$this->NODE_NAME);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = array();
// In the interest of performance, we load all the records and get PHP to process it.
// Our ORM caching we reduce the hit on TSM.
foreach (ORM::factory('OCC')->find_all() as $o)
if ($o->NODE_NAME == $this->NODE_NAME)
array_push($result,$o);
// @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;
}
@ -148,21 +159,28 @@ class Model_NODE extends ORM_TSM {
* Get all the VOLUMES for this NODE
*/
private function _volumeusage() {
$result = array();
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
// In the interest of performance, we load all the records and get PHP to process it.
// Our ORM caching we reduce the hit on TSM.
foreach (ORM::factory('VOLUMEUSAGE')->find_all() as $o)
if ($o->NODE_NAME == $this->NODE_NAME)
array_push($result,$o);
$k = sprintf('%s-%s',__METHOD__,$this->NODE_NAME);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = array();
// In the interest of performance, we load all the records and get PHP to process it.
// Our ORM caching we reduce the hit on TSM.
foreach (ORM::factory('VOLUMEUSAGE')->find_all() as $o)
if ($o->NODE_NAME == $this->NODE_NAME)
array_push($result,$o);
// @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;
}
public function fs() {
return $this->_filespaces();
}
/**
* Return the version of the TSM client
*/
@ -249,47 +267,48 @@ class Model_NODE extends ORM_TSM {
return $this->vols_byctype($type) ? TRUE : FALSE;
}
// $dtype is BACKUP or ARCHIVE
// $ptype is pool type (PRIMARY,ACTIVE,COPY)
#zz
public function getStorageModeVols($dtype,$ptype,$spo='') {
$result = array();
/**
* Return the BACKUP TYPES used by this NODE
* ie: Bkup/Arch/SpMg
*/
public function btypes() {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
foreach ($this->_volumeusage() as $vo)
if ($vo->COPY_TYPE == $dtype AND (! $spo OR $vo->STGPOOL_NAME == $spo) AND $vo->STGPOOL->POOLTYPE == $ptype)
if (! isset($result[$vo->VOLUME_NAME]))
$result[$vo->VOLUME_NAME] = $vo;
$k = sprintf('%s-%s',__METHOD__,$this->NODE_NAME);
$c = Kohana::$config->load('config')->cache;
return $result;
}
if (is_null($result = Cache::instance($c)->get($k))) {
$x = $result = array();
// $ptype is pool type (PRIMARY,ACTIVE,COPY)
#zz
public function getStorageTypeVols($ptype,$spo='') {
$result = array();
foreach ($this->_occupancy() as $oo)
if (! in_array($oo->TYPE,$result))
array_push($result,$oo->TYPE);
foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype)
$result = array_merge($result,$this->getStorageModeVols($ctype,$ptype,$spo));
// @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 the data that this NODE has in a STORAGE POOL
* @param $pool is STORAGE POOL NAME
* Return the total of a field for this NODE has by backup TYPE
* @param $field the field to check
* @param $data the value of that field to match
* @param $metric is metric of the storpage pool, eg: NUM_FILES
*/
private function data_bypool($pool,$metric) {
private function _data_int($field,$data,$metric) {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
$k = sprintf('%s-%s-%s-%s',__METHOD__,$this->NODE_NAME,$pool,$metric);
$k = sprintf('%s-%s-%s-%s-%s',__METHOD__,$this->NODE_NAME,$field,$data,$metric);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = 0;
foreach ($this->_occupancy() as $oo)
if ($oo->STGPOOL_NAME == $pool)
if ($oo->{$field} == $data)
$result += $oo->{$metric};
// @todo Cache time should be configurble
@ -300,13 +319,54 @@ class Model_NODE extends ORM_TSM {
return $result;
}
/**
* Return the data that this NODE has in a STORAGE POOL by backup TYPE
* @param $pool is STORAGE POOL NAME
* @param $metric is metric of the storpage pool, eg: NUM_FILES
* @param $type is Bkup/Arch/SpMg
*/
private function _data_bypoolbybtype($pool,$metric,$type) {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
$k = sprintf('%s-%s-%s-%s-%s',__METHOD__,$this->NODE_NAME,$pool,$metric,$type);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = 0;
foreach ($this->_occupancy() as $oo)
if ($oo->STGPOOL_NAME == $pool AND $oo->TYPE == $type)
$result += $oo->{$metric};
// @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 the FILES that this NODE has by backup TYPE
* @param $type is Bkup/Arch/SpMg
*/
public function file_bybtype($type) {
Log::instance()->add(LOG::DEBUG,'FLYBY :method',array(':method'=>__METHOD__));
return $this->_data_int('TYPE',$type,'NUM_FILES');
}
/**
* Return the FILES that this NODE has in a STORAGE POOL
* @param $pool is STORAGE POOL NAME
*/
public function file_bypool($pool) {
Log::instance()->add(LOG::DEBUG,'FLYBY :method',array(':method'=>__METHOD__));
return $this->data_bypool($pool,'NUM_FILES');
return $this->_data_int('STGPOOL_NAME',$pool,'NUM_FILES');
}
public function file_bypoolbybtype($pool,$type) {
Log::instance()->add(LOG::DEBUG,'FLYBY :method',array(':method'=>__METHOD__));
return $this->_data_bypoolbybtype($pool,'NUM_FILES',$type);
}
/**
@ -325,13 +385,31 @@ class Model_NODE extends ORM_TSM {
return $result;
}
public function fs() {
return $this->_filespaces();
}
/**
* Return the LOGICAL_MB that this NODE has by backup TYPE
* @param $type is Bkup/Arch/SpMg
*/
public function logmb_bybtype($type) {
Log::instance()->add(LOG::DEBUG,'FLYBY :method',array(':method'=>__METHOD__));
return $this->_data_int('TYPE',$type,'LOGICAL_MB');
}
/**
* Return the LOGICAL_MB that this NODE has in a STORAGE POOL
* @param $pool is STORAGE POOL NAME
*/
public function logmb_bypool($pool) {
Log::instance()->add(LOG::DEBUG,'FLYBY :method',array(':method'=>__METHOD__));
return $this->data_bypool($pool,'LOGICAL_MB');
return $this->_data_int('STGPOOL_NAME',$pool,'LOGICAL_MB');
}
public function logmb_bypoolbybtype($pool,$type) {
Log::instance()->add(LOG::DEBUG,'FLYBY :method',array(':method'=>__METHOD__));
return $this->_data_bypoolbybtype($pool,'LOGICAL_MB',$type);
}
/**
@ -419,10 +497,10 @@ class Model_NODE extends ORM_TSM {
if (is_null($result = Cache::instance($c)->get($k))) {
$x = $result = array();
foreach ($this->_occupancy() as $vuo)
if ($vuo->TYPE == $type AND ! in_array($vuo->STGPOOL_NAME,$x)) {
array_push($result,$vuo->STGPOOL);
array_push($x,$vuo->STGPOOL_NAME);
foreach ($this->_occupancy() as $oo)
if ($oo->TYPE == $type AND ! in_array($oo->STGPOOL_NAME,$x)) {
array_push($result,$oo->STGPOOL);
array_push($x,$oo->STGPOOL_NAME);
}
// @todo Cache time should be configurble
@ -458,21 +536,21 @@ class Model_NODE extends ORM_TSM {
return $result;
}
/**
* Return the VOLUMES that this NODE uses by BACKUP TYPE
* @param $type is BACKUP/ARCHIVE/SPACE MANAGED
*/
public function vols_byctype($type) {
public function vols_bybtype($type) {
return $this->vols_byctype($this->datatypemap($type));
}
private function _vols_metric($metric,$data) {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
$k = sprintf('%s-%s-%s',__METHOD__,$this->NODE_NAME,$type);
$k = sprintf('%s-%s-%s-%s',__METHOD__,$this->NODE_NAME,$metric,$data);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$x = $result = array();
foreach ($this->_volumeusage() as $vuo)
if ($vuo->COPY_TYPE == $type AND ! in_array($vuo->VOLUME_NAME,$x)) {
if ($vuo->{$metric} == $data AND ! in_array($vuo->VOLUME_NAME,$x)) {
array_push($result,$vuo->VOLUME);
array_push($x,$vuo->VOLUME_NAME);
}
@ -486,32 +564,20 @@ class Model_NODE extends ORM_TSM {
return $result;
}
/**
* Return the VOLUMES that this NODE uses by BACKUP TYPE
* @param $type is BACKUP/ARCHIVE/SPACE MANAGED
*/
public function vols_byctype($type) {
return $this->_vols_metric('COPY_TYPE',$type);
}
/**
* Return the VOLUMES that this NODE uses
* @param $pool is STORAGE POOL NAME
*/
public function vols_bypool($pool) {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
$k = sprintf('%s-%s-%s',__METHOD__,$this->NODE_NAME,$pool);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$x = $result = array();
foreach ($this->_volumeusage() as $vuo)
if ($vuo->STGPOOL_NAME == $pool AND ! in_array($vuo->VOLUME_NAME,$x)) {
array_push($result,$vuo);
array_push($x,$vuo->VOLUME_NAME);
}
Sort::MASort($result,'VOLUME_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 $this->_vols_metric('STGPOOL_NAME',$pool);
}
/**
@ -530,6 +596,15 @@ class Model_NODE extends ORM_TSM {
return $result;
}
/**
* Return the VOLUMES that this NODE uses by POOL and BACKUP TYPE
* @param $pool is STORAGE POOL NAME
* @param $type is Bkup/Arch/SpMg
*/
public function vols_bypoolbybtype($pool,$type) {
return $this->vols_bypoolbyctype($pool,$this->datatypemap($type));
}
/**
* Return the VOLUMES that this NODE uses by POOL and BACKUP TYPE
* @param $pool is STORAGE POOL NAME
@ -538,13 +613,20 @@ class Model_NODE extends ORM_TSM {
public function vols_bypoolbyctype($pool,$type) {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
$x = $result = array();
$k = sprintf('%s-%s-%s-%s',__METHOD__,$this->NODE_NAME,$pool,$type);
$c = Kohana::$config->load('config')->cache;
foreach ($this->vols_bypool($pool) as $vuo)
if ($vuo->COPY_TYPE == $type AND ! in_array($vuo->VOLUME_NAME,$x)) {
array_push($result,$vuo);
array_push($x,$vuo->VOLUME_NAME);
}
if (is_null($result = Cache::instance($c)->get($k))) {
$result = array();
foreach ($this->_volumeusage() as $vuo)
if ($vuo->STGPOOL_NAME == $pool AND $vuo->COPY_TYPE == $type AND ! in_array($vuo->VOLUME_NAME,$result))
array_push($result,$vuo->VOLUME);
Sort::MASort($result,'VOLUME_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;

View File

@ -163,5 +163,11 @@ abstract class ORM_TSM extends ORM {
public static function date($date,$format) {
return $date ? date($format,strtotime($date)) : '';
}
protected function datatypemap($type) {
$x = Kohana::$config->load('config')->tsmdatatypes;
return array_key_exists($type,$x) ? $x[$type] : $x;
}
}
?>

View File

@ -6,8 +6,8 @@
<td class="spacer" colspan="2">&nbsp;</td>
</tr>
<tr>
<td style="width: 50%; vertical-align: top;"><?php echo View::factory('domain/stgpool_summary')->set('o',$o); ?></td>
<td>&nbsp;</td>
<td style="width: 50%; vertical-align: top;"><?php echo View::factory('domain/stgpool_pool')->set('o',$o); ?></td>
<td style="width: 50%; vertical-align: top;"><?php echo View::factory('domain/stgpool_type')->set('o',$o); ?></td>
</tr>
<tr>
<td class="spacer" colspan="2">&nbsp;</td>

View File

@ -16,7 +16,7 @@
<?php foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype) { ?>
<td><?php echo substr($ctype,0,1); ?></td>
<?php } ?>
<?php foreach (Kohana::$config->load('config')->tsmpooltypes as $type) { ?>
<?php foreach ($o->stgpooltypes() as $type) { ?>
<td colspan="3" class="right"><?php echo $type; ?>(Vol/Fil/Dat)</td>
<?php } ?>
</tr>
@ -31,7 +31,7 @@
<?php foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype) { ?>
<td class="data"><?php echo $no->hasData($ctype) ? 'Y' : 'N'; ?></td>
<?php } ?>
<?php foreach (Kohana::$config->load('config')->tsmpooltypes as $type) { ?>
<?php foreach ($o->stgpooltypes() as $type) { ?>
<td class="data-right"><?php echo count($no->vols_byptype($type)); ?></td>
<td class="data-right"><?php echo number_format($no->file_byptype($type),0); ?></td>
<td class="data-right"><?php echo number_format($no->logmb_byptype($type),0); ?></td>

View File

@ -0,0 +1,39 @@
<!-- $o = ORM::factory('DOMAIN') -->
<table class="box-full">
<tr>
<td class="head" colspan="8">Storage By Pools Summary for Nodes in this Domain</td>
</tr>
<tr>
<td class="spacer">&nbsp;</td>
</tr>
<tr>
<td colspan="2">Storage Pool and Type</td>
<td class="right">Scr Use</td>
<td class="right">Scr Avl</td>
<td class="right">Nodes</td>
<td class="right">Vols</td>
<td class="right">Files</td>
<td class="right">MB</td>
</tr>
<?php $i=0; foreach ($o->stgpooltypes() as $type) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td class="data" colspan="4"><?php echo $type; ?></td>
<td class="data-right"><?php echo count($o->nodes_byptype($type)); ?></td>
<td class="data-right"><?php echo count($o->vols_byptype($type)); ?></td>
<td class="data-right"><?php echo number_format($o->file_byptype($type),0); ?></td>
<td class="data-right"><?php echo number_format($o->logmb_byptype($type),0); ?></td>
</tr>
<?php foreach ($o->stgpools_byptype($type) as $spo) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td>&nbsp;</td>
<td><?php echo HTML::anchor('stgpool/detail/'.$spo->STGPOOL_NAME,$spo->display('STGPOOL_NAME')); ?></td>
<td class="right"><?php echo $spo->display('NUMSCRATCHUSED'); ?></td>
<td class="right"><?php echo $spo->display('MAXSCRATCH'); ?></td>
<td class="right"><?php echo count($o->nodes_bypool($spo)); ?></td>
<td class="right"><?php echo count($o->vols_bypool($spo)); ?></td>
<td class="right"><?php echo number_format($o->file_bypool($spo),0); ?></td>
<td class="right"><?php echo number_format($o->logmb_bypool($spo),0); ?></td>
</tr>
<?php } ?>
<?php } ?>
</table>

View File

@ -1,36 +0,0 @@
<!-- $o = ORM::factory('DOMAIN') -->
<table class="box-full">
<tr>
<td class="head" colspan="15">Storage By Pools Summary for Nodes in this Domain</td>
</tr>
<tr>
<td class="spacer">&nbsp;</td>
</tr>
<tr>
<td colspan="2">Storage Pool and Type</td>
<td class="right">Scr Use</td>
<td class="right">Scr Avl</td>
<td class="right">Nodes</td>
<td class="right">Vols</td>
<td class="right">Files</td>
<td class="right">MB</td>
</tr>
<?php $i=0; foreach ($o->stgpooltypes() as $type) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td colspan="8" class="data"><?php echo $type; ?></td>
</tr>
<?php foreach ($o->stgpools_byptype($type) as $spo) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td>&nbsp;</td>
<td class="data"><?php echo HTML::anchor('stgpool/detail/'.$spo->STGPOOL_NAME,$spo->display('STGPOOL_NAME')); ?></td>
<td class="data-right"><?php echo $spo->display('NUMSCRATCHUSED'); ?></td>
<td class="data-right"><?php echo $spo->display('MAXSCRATCH'); ?></td>
<td class="data-right"><?php echo count($o->nodes_bypool($spo)); ?></td>
<td class="data-right"><?php echo count($o->vols_bypool($spo)); ?></td>
<td class="data-right"><?php echo number_format($o->file_bypool($spo),0); ?></td>
<td class="data-right"><?php echo number_format($o->logmb_bypool($spo),0); ?></td>
</tr>
<?php } ?>
<?php } ?>
</table>

View File

@ -0,0 +1,39 @@
<!-- $o = ORM::factory('DOMAIN') -->
<table class="box-full">
<tr>
<td class="head" colspan="8">Storage By Type Summary for Nodes in this Domain</td>
</tr>
<tr>
<td class="spacer">&nbsp;</td>
</tr>
<tr>
<td colspan="2">Storage Pool and Type</td>
<td class="right">Scr Use</td>
<td class="right">Scr Avl</td>
<td class="right">Nodes</td>
<td class="right">Vols</td>
<td class="right">Files</td>
<td class="right">MB</td>
</tr>
<?php $i=0; foreach ($o->btypes() as $type) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td class="data" colspan="4"><?php echo $type; ?></td>
<td class="data-right"><?php echo count($o->nodes_bybtype($type)); ?></td>
<td class="data-right"><?php echo count($o->vols_bybtype($type)); ?></td>
<td class="data-right"><?php echo number_format($o->file_bybtype($type),0); ?></td>
<td class="data-right"><?php echo number_format($o->logmb_bybtype($type),0); ?></td>
</tr>
<?php foreach ($o->stgpools_bybtype($type) as $spo) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td>&nbsp;</td>
<td><?php echo HTML::anchor('stgpool/detail/'.$spo->STGPOOL_NAME,$spo->display('STGPOOL_NAME')); ?></td>
<td class="right"><?php echo $spo->display('NUMSCRATCHUSED'); ?></td>
<td class="right"><?php echo $spo->display('MAXSCRATCH'); ?></td>
<td class="right"><?php echo count($o->nodes_bypoolbybtype($spo,$type)); ?></td>
<td class="right"><?php echo count($o->vols_bypoolbybtype($spo,$type)); ?></td>
<td class="right"><?php echo number_format($o->file_bypoolbybtype($spo,$type),0); ?></td>
<td class="right"><?php echo number_format($o->logmb_bypoolbybtype($spo,$type),0); ?></td>
</tr>
<?php } ?>
<?php } ?>
</table>

View File

@ -28,14 +28,13 @@
<td colspan="10">
<?php
if ($spo->DEVCLASS == 'DISK')
printf('%s: Utilised: %s%%, Device Type: %s',$spo->STGPOOL_NAME,$spo->PCT_UTILIZED,$spo->DEVCLASS);
printf('%s: Utilised: %s%%, Device Type: %s',$spo->STGPOOL_NAME,$spo->PCT_MIGR,$spo->DEVCLASS);
else
printf('%s: Reclaim: %s%%, Scratch Usage: %s/%s, Device Type: %s',$spo->STGPOOL_NAME,$spo->RECLAIM,$spo->NUMSCRATCHUSED,$spo->MAXSCRATCH,$spo->DEVCLASSES->DEVTYPE);
?>
</td>
</tr>
<?php foreach ($o->vols_bypoolbyctype($spo->STGPOOL_NAME,$ctype) as $vuo) {
$vo = $vuo->VOLUME; ?>
<?php foreach ($o->vols_bypoolbyctype($spo->STGPOOL_NAME,$ctype) as $vo) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td class="data"><?php echo HTML::anchor('volume/detail/'.base64_encode($vo->VOLUME_NAME),$vo->display('VOLUME_NAME')); ?></td>
<td class="data"><?php echo $vo->display('LAST_READ_DATE'); ?></td>

View File

@ -1,7 +1,7 @@
<!-- $o = ORM::factory('NODE') -->
<table width="100%">
<tr>
<td style="width: 50%; vertical-align: top;">
<td style="width: 50%; vertical-align: top;" rowspan="2">
<?php foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype) { ?>
<table class="box-full">
<tr>
@ -36,6 +36,9 @@
<br/>
<?php } ?>
</td>
<td style="width: 50%; vertical-align: top;" rowspan="2"><?php echo View::factory('node/stgpool_summary')->set('o',$o); ?></td>
<td style="width: 50%; vertical-align: top;"><?php echo View::factory('node/stgpool_pool')->set('o',$o); ?></td>
</tr>
<tr>
<td style="width: 50%; vertical-align: top;"><?php echo View::factory('node/stgpool_type')->set('o',$o); ?></td>
<tr>
</table>

View File

@ -1,7 +1,7 @@
<!-- $o = ORM::factory('NODE') -->
<table class="box-full">
<tr>
<td class="head" colspan="2">Storage By Pool Summary</td>
<td class="head" colspan="5">Storage By Pool Summary</td>
</tr>
<tr>
<td class="spacer">&nbsp;</td>
@ -15,14 +15,14 @@
<?php $i=0; foreach ($o->stgpooltypes() as $type) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td class="data" colspan="2"><?php echo $type; ?></td>
<td class="data-right"><?php echo count($o->getStorageTypeVols($type)); ?></td>
<td class="data-right"><?php echo count($o->vols_byptype($type)); ?></td>
<td class="data-right"><?php echo number_format($o->file_byptype($type),0); ?></td>
<td class="data-right"><?php echo number_format($o->logmb_byptype($type),0); ?></td>
</tr>
<?php foreach ($o->stgpools_byptype($type) as $spo) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td>&nbsp;</td>
<td><?php echo $spo; ?></td>
<td><?php echo HTML::anchor('stgpool/detail/'.$spo->STGPOOL_NAME,$spo->display('STGPOOL_NAME')); ?></td>
<td class="right"><?php echo count($o->vols_bypool($spo)); ?></td>
<td class="right"><?php echo number_format($o->file_bypool($spo),0); ?></td>
<td class="right"><?php echo number_format($o->logmb_bypool($spo),0); ?></td>

View File

@ -0,0 +1,32 @@
<!-- $o = ORM::factory('NODE') -->
<table class="box-full">
<tr>
<td class="head" colspan="5">Storage By Type Summary</td>
</tr>
<tr>
<td class="spacer">&nbsp;</td>
</tr>
<tr>
<td colspan="2">Storage Pool and Type</td>
<td class="right">Vols</td>
<td class="right">Files</td>
<td class="right">MB</td>
</tr>
<?php $i=0; foreach ($o->btypes() as $type) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td class="data" colspan="2"><?php echo $type; ?></td>
<td class="data-right"><?php echo count($o->vols_bybtype($type)); ?></td>
<td class="data-right"><?php echo number_format($o->file_bybtype($type),0); ?></td>
<td class="data-right"><?php echo number_format($o->logmb_bybtype($type),0); ?></td>
</tr>
<?php foreach ($o->stgpools_bybtype($type) as $spo) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td>&nbsp;</td>
<td><?php echo HTML::anchor('stgpool/detail/'.$spo->STGPOOL_NAME,$spo->display('STGPOOL_NAME')); ?></td>
<td class="right"><?php echo count($o->vols_bypoolbybtype($spo,$type)); ?></td>
<td class="right"><?php echo number_format($o->file_bypoolbybtype($spo,$type),0); ?></td>
<td class="right"><?php echo number_format($o->logmb_bypoolbybtype($spo,$type),0); ?></td>
</tr>
<?php } ?>
<?php } ?>
</table>

View File

@ -28,14 +28,13 @@
<td colspan="10">
<?php
if ($spo->DEVCLASS == 'DISK')
printf('%s: Utilised: %s%%, Device Type: %s',$spo->STGPOOL_NAME,$spo->PCT_UTILIZED,$spo->DEVCLASS);
printf('%s: Utilised: %s%%, Device Type: %s',$spo->STGPOOL_NAME,$spo->PCT_MIGR,$spo->DEVCLASS);
else
printf('%s: Reclaim: %s%%, Scratch Usage: %s/%s, Device Type: %s',$spo->STGPOOL_NAME,$spo->RECLAIM,$spo->NUMSCRATCHUSED,$spo->MAXSCRATCH,$spo->DEVCLASSES->DEVTYPE);
?>
</td>
</tr>
<?php foreach ($o->vols_bypoolbyctype($spo->STGPOOL_NAME,$ctype) as $vuo) {
$vo = $vuo->VOLUME; ?>
<?php foreach ($o->vols_bypoolbyctype($spo->STGPOOL_NAME,$ctype) as $vo) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td class="data"><?php echo HTML::anchor('volume/detail/'.base64_encode($vo->VOLUME_NAME),$vo->display('VOLUME_NAME')); ?></td>
<td class="data"><?php echo $vo->display('LAST_READ_DATE'); ?></td>