Some more performance improvements and caching
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_ACTLOG extends TSM_ORM {
|
||||
class Model_ACTLOG extends ORM_TSM {
|
||||
protected $_table_name = 'ACTLOG';
|
||||
protected $_primary_key = 'DATE_TIME'; // We need a primary key to detect that the object is loaded.
|
||||
protected $_sorting = array(
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_ASSOCIATION extends TSM_ORM {
|
||||
class Model_ASSOCIATION extends ORM_TSM {
|
||||
protected $_table_name = 'ASSOCIATIONS';
|
||||
protected $_primary_key = 'DOMAIN_NAME'; // We need a primary key to detect that the object is loaded.
|
||||
protected $_sorting = array(
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_CLIENTOPT extends TSM_ORM {
|
||||
class Model_CLIENTOPT extends ORM_TSM {
|
||||
protected $_table_name = 'CLIENTOPTS';
|
||||
protected $_primary_key = 'OPTIONSET_NAME'; // We need a primary key to detect that the object is loaded.
|
||||
protected $_sorting = array(
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_COPYGROUP_AR extends TSM_ORM {
|
||||
class Model_COPYGROUP_AR extends ORM_TSM {
|
||||
protected $_table_name = 'AR_COPYGROUPS';
|
||||
protected $_primary_key = 'DOMAIN_NAME'; // We need a primary key to detect that the object is loaded.
|
||||
protected $_sorting = array(
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_COPYGROUP_BU extends TSM_ORM {
|
||||
class Model_COPYGROUP_BU extends ORM_TSM {
|
||||
protected $_table_name = 'BU_COPYGROUPS';
|
||||
protected $_primary_key = 'DOMAIN_NAME'; // We need a primary key to detect that the object is loaded.
|
||||
protected $_sorting = array(
|
||||
@@ -17,5 +17,9 @@ class Model_COPYGROUP_BU extends TSM_ORM {
|
||||
'SET_NAME'=>'ASC',
|
||||
'CLASS_NAME'=>'ASC',
|
||||
);
|
||||
|
||||
protected $_has_one = array(
|
||||
'STGPOOL'=>array('foreign_key'=>'STGPOOL_NAME','far_key'=>'DESTINATION'),
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_DB extends TSM_ORM {
|
||||
class Model_DB extends ORM_TSM {
|
||||
protected $_table_name = 'DB';
|
||||
protected $_primary_key = 'DATABASE_NAME';
|
||||
protected $_sorting = array(
|
||||
@@ -24,10 +24,10 @@ class Model_DB extends TSM_ORM {
|
||||
array('number_format',array(':value',0)),
|
||||
),
|
||||
'LAST_REORG'=>array(
|
||||
array('TSM_ORM::date',array(':value','d-M H:i')),
|
||||
array('ORM_TSM::date',array(':value','d-M H:i')),
|
||||
),
|
||||
'LAST_BACKUP_DATE'=>array(
|
||||
array('TSM_ORM::date',array(':value','d-M H:i')),
|
||||
array('ORM_TSM::date',array(':value','d-M H:i')),
|
||||
),
|
||||
'TOTAL_BUFF_REQ'=>array(
|
||||
array('number_format',array(':value',0)),
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_DBSPACE extends TSM_ORM {
|
||||
class Model_DBSPACE extends ORM_TSM {
|
||||
protected $_table_name = 'DBSPACE';
|
||||
protected $_primary_key = 'LOCATION';
|
||||
protected $_sorting = array(
|
||||
|
@@ -10,7 +10,7 @@
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
* @note This is model is using the plural name, as storage pools have an attribute with the singular name
|
||||
*/
|
||||
class Model_DEVCLASSES extends TSM_ORM {
|
||||
class Model_DEVCLASSES extends ORM_TSM {
|
||||
protected $_table_name = 'DEVCLASSES';
|
||||
protected $_primary_key = 'DEVCLASS_NAME'; // We need a primary key to detect that the object is loaded.
|
||||
protected $_sorting = array(
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_DOMAIN extends TSM_ORM {
|
||||
class Model_DOMAIN extends ORM_TSM {
|
||||
protected $_table_name = 'DOMAINS';
|
||||
protected $_primary_key = 'DOMAIN_NAME'; // We need a primary key to detect that the object is loaded.
|
||||
protected $_sorting = array(
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_DRIVE extends TSM_ORM {
|
||||
class Model_DRIVE extends ORM_TSM {
|
||||
protected $_table_name = 'DRIVES';
|
||||
protected $_primary_key = 'DRIVE_NAME';
|
||||
protected $_sorting = array(
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_EVENT extends TSM_ORM {
|
||||
class Model_EVENT extends ORM_TSM {
|
||||
protected $_table_name = 'EVENTS';
|
||||
protected $_primary_key = 'NODE_NAME'; // We need a primary key to detect that the object is loaded.
|
||||
protected $_sorting = array(
|
||||
@@ -19,13 +19,13 @@ class Model_EVENT extends TSM_ORM {
|
||||
|
||||
protected $_display_filters = array(
|
||||
'SCHEDULED_START'=>array(
|
||||
array('TSM_ORM::date',array(':value','d-M H:i')),
|
||||
array('ORM_TSM::date',array(':value','d-M H:i')),
|
||||
),
|
||||
'ACTUAL_START'=>array(
|
||||
array('TSM_ORM::date',array(':value','d-M H:i')),
|
||||
array('ORM_TSM::date',array(':value','d-M H:i')),
|
||||
),
|
||||
'COMPLETED'=>array(
|
||||
array('TSM_ORM::date',array(':value','d-M H:i')),
|
||||
array('ORM_TSM::date',array(':value','d-M H:i')),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_FILESPACE extends TSM_ORM {
|
||||
class Model_FILESPACE extends ORM_TSM {
|
||||
protected $_table_name = 'FILESPACES';
|
||||
protected $_primary_key = 'FILESPACE_NAME'; // We need a primary key to detect that the object is loaded.
|
||||
protected $_sorting = array(
|
||||
@@ -41,45 +41,176 @@ class Model_FILESPACE extends TSM_ORM {
|
||||
|
||||
protected $_display_filters = array(
|
||||
'BACKUP_END'=>array(
|
||||
array('TSM_ORM::date',array(':value','d-M-Y')),
|
||||
array('ORM_TSM::date',array(':value','d-M-Y')),
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Get all the OCCUPANCY for this FILESYSTEM on this NODE
|
||||
*/
|
||||
private function _occupancy() {
|
||||
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
|
||||
|
||||
$k = sprintf('%s-%s-%s',__METHOD__,$this->NODE_NAME,$this->FILESPACE_NAME);
|
||||
$c = Kohana::$config->load('config')->cache;
|
||||
|
||||
if (is_null($result = Cache::instance($c)->get($k))) {
|
||||
$result = array();
|
||||
|
||||
foreach ($this->NODE->occupancy() as $oo)
|
||||
if ($oo->FILESPACE_NAME == $this->FILESPACE_NAME)
|
||||
array_push($result,$oo);
|
||||
|
||||
// @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the VOLUEMUSAGE for this FILESYSTEM on this NODE
|
||||
*/
|
||||
private function _volumeusage() {
|
||||
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
|
||||
|
||||
$k = sprintf('%s-%s-%s',__METHOD__,$this->NODE_NAME,$this->FILESPACE_NAME);
|
||||
$c = Kohana::$config->load('config')->cache;
|
||||
|
||||
if (is_null($result = Cache::instance($c)->get($k))) {
|
||||
$result = array();
|
||||
|
||||
foreach ($this->NODE->volumeusage() as $vuo)
|
||||
if ($vuo->FILESPACE_NAME == $this->FILESPACE_NAME)
|
||||
array_push($result,$vuo);
|
||||
|
||||
// @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 FILESYSTEM has in a STORAGE POOL
|
||||
* @param $pool is STORAGE POOL NAME
|
||||
* @param $metric is metric of the storpage pool, eg: NUM_FILES
|
||||
*/
|
||||
private function data_bypool($pool,$metric) {
|
||||
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
|
||||
|
||||
$k = sprintf('%s-%s-%s-%s-%s',__METHOD__,$this->NODE_NAME,$this->FILESPACE_NAME,$pool,$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)
|
||||
$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 data that this FILESYSTEM has in a STORAGE POOL
|
||||
* @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-%s',__METHOD__,$this->NODE_NAME,$this->FILESPACE_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 LOGICAL_MB that this FILESYSTEM 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 the LOGICAL_MB that this FILESYSTEM has in a STORAGE POOL
|
||||
* @param $pool is STORAGE POOL NAME
|
||||
* @param $type is Bkup/Arch/SpMg
|
||||
*/
|
||||
public function logmb_bypoolbybtype($pool,$type) {
|
||||
Log::instance()->add(LOG::DEBUG,'FLYBY :method',array(':method'=>__METHOD__));
|
||||
return $this->data_bypoolbybtype($pool,'LOGICAL_MB',$type);
|
||||
}
|
||||
|
||||
public function utilsation() {
|
||||
return $this->CAPACITY*($this->PCT_UTIL/100);
|
||||
}
|
||||
|
||||
// $dtype must be Bkup or Arch
|
||||
public function storagepools($dtype) {
|
||||
$pool = array();
|
||||
|
||||
foreach ($this->NODE->OCC
|
||||
->select('STGPOOL_NAME')
|
||||
->where('TYPE','=',$dtype)
|
||||
->and_where('FILESPACE_NAME','=',$this->FILESPACE_NAME)
|
||||
->group_by('STGPOOL_NAME')
|
||||
->order_by('STGPOOL_NAME')
|
||||
->find_all() as $oo)
|
||||
|
||||
array_push($pool,$oo->STGPOOL);
|
||||
|
||||
return $pool;
|
||||
}
|
||||
|
||||
public function pool_logical_util($pool,$btype) {
|
||||
return $this->NODE->OCC
|
||||
->where('STGPOOL_NAME','=',$pool)
|
||||
->and_where('TYPE','=',$btype)
|
||||
->and_where('FILESPACE_NAME','=',$this->FILESPACE_NAME)
|
||||
->find()->LOGICAL_MB;
|
||||
/**
|
||||
* Return the VOLUMES that this FILESYSTEM uses for this NODE
|
||||
* @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-%s',__METHOD__,$this->NODE_NAME,$this->FILESPACE_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);
|
||||
}
|
||||
|
||||
// @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 pool_numvols($pool,$ctype) {
|
||||
return $this->NODE->VOLUMEUSAGE
|
||||
->where('STGPOOL_NAME','=',$pool)
|
||||
->and_where('COPY_TYPE','=',$ctype)
|
||||
->and_where('FILESPACE_NAME','=',$this->FILESPACE_NAME)
|
||||
->find_all()->count();
|
||||
/**
|
||||
* Return the VOLUMES that this FILESYSTEM uses for this NODE by POOL and BACKUP TYPE
|
||||
* @param $pool is STORAGE POOL NAME
|
||||
* @param $type is BACKUP/ARCHIVE/SPACE MANAGED
|
||||
*/
|
||||
public function vols_bypoolbybtype($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);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_LIBRARY extends TSM_ORM {
|
||||
class Model_LIBRARY extends ORM_TSM {
|
||||
protected $_table_name = 'LIBRARIES';
|
||||
protected $_primary_key = 'LIBRARY_NAME';
|
||||
protected $_sorting = array(
|
||||
@@ -28,7 +28,7 @@ class Model_LIBRARY extends TSM_ORM {
|
||||
|
||||
#zz
|
||||
public function slots() {
|
||||
return $this->slots ? $this->slots : $this->slots = DB::query(Database::SHOW,'SHOW SLOTS '.$this)->execute(Kohana::$config->load('config')->client_type);
|
||||
return $this->slots ? $this->slots : $this->slots = DB::query(Database::SHOW,'SHOW SLOTS '.$this)->execute();
|
||||
}
|
||||
|
||||
// Return a list of scratch volumes
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_LIBVOLUME extends TSM_ORM {
|
||||
class Model_LIBVOLUME extends ORM_TSM {
|
||||
protected $_table_name = 'LIBVOLUMES';
|
||||
protected $_primary_key = 'HOME_ELEMENT';
|
||||
protected $_sorting = array(
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_MEDIA extends TSM_ORM {
|
||||
class Model_MEDIA extends ORM_TSM {
|
||||
protected $_table_name = 'MEDIA';
|
||||
protected $_primary_key = 'VOLUME_NAME';
|
||||
protected $_sorting = array(
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_MGMTCLASS extends TSM_ORM {
|
||||
class Model_MGMTCLASS extends ORM_TSM {
|
||||
protected $_table_name = 'MGMTCLASSES';
|
||||
protected $_primary_key = 'DOMAIN_NAME'; // We need a primary key to detect that the object is loaded.
|
||||
protected $_sorting = array(
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_NODE extends TSM_ORM {
|
||||
class Model_NODE extends ORM_TSM {
|
||||
protected $_table_name = 'NODES';
|
||||
protected $_primary_key = 'NODE_NAME';
|
||||
protected $_sorting = array(
|
||||
@@ -86,13 +86,13 @@ class Model_NODE extends TSM_ORM {
|
||||
|
||||
protected $_display_filters = array(
|
||||
'REG_TIME'=>array(
|
||||
array('TSM_ORM::date',array(':value','d-M-Y')),
|
||||
array('ORM_TSM::date',array(':value','d-M-Y')),
|
||||
),
|
||||
'PWSET_TIME'=>array(
|
||||
array('TSM_ORM::date',array(':value','d-M-Y')),
|
||||
array('ORM_TSM::date',array(':value','d-M-Y')),
|
||||
),
|
||||
'LASTACC_TIME'=>array(
|
||||
array('TSM_ORM::date',array(':value','d-M-Y')),
|
||||
array('ORM_TSM::date',array(':value','d-M-Y')),
|
||||
),
|
||||
'LASTSESS_SENT'=>array(
|
||||
array('number_format',array(':value',0)),
|
||||
@@ -275,11 +275,13 @@ class Model_NODE extends TSM_ORM {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the data that this NODE has in a STORAGE POOL
|
||||
* Return the data that this NODE has in a STORAGE POOL
|
||||
* @param $pool is STORAGE POOL NAME
|
||||
* @param $metric is metric of the storpage pool, eg: NUM_FILES
|
||||
*/
|
||||
private function data_bypool($pool,$metric) {
|
||||
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
|
||||
|
||||
$k = sprintf('%s-%s-%s-%s',__METHOD__,$this->NODE_NAME,$pool,$metric);
|
||||
$c = Kohana::$config->load('config')->cache;
|
||||
|
||||
@@ -294,14 +296,16 @@ class Model_NODE extends TSM_ORM {
|
||||
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 in a STORAGE POOL
|
||||
* 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');
|
||||
}
|
||||
|
||||
@@ -310,19 +314,23 @@ class Model_NODE extends TSM_ORM {
|
||||
* @param $type is ACTIVEDATA/PRIMARY/COPY
|
||||
*/
|
||||
public function file_byptype($type) {
|
||||
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
|
||||
|
||||
$result = 0;
|
||||
|
||||
foreach ($this->stgpools_byptype($type) as $spo)
|
||||
$result += $this->file_bypool($spo);
|
||||
|
||||
Log::instance()->add(LOG::DEBUG,'EXIT :method',array(':method'=>__METHOD__));
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the LOGICAL_MB that this NODE has in a STORAGE POOL
|
||||
* 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');
|
||||
}
|
||||
|
||||
@@ -331,18 +339,27 @@ class Model_NODE extends TSM_ORM {
|
||||
* @param $type is ACTIVEDATA/PRIMARY/COPY
|
||||
*/
|
||||
public function logmb_byptype($type) {
|
||||
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
|
||||
|
||||
$result = 0;
|
||||
|
||||
foreach ($this->stgpools_byptype($type) as $spo)
|
||||
$result += $this->logmb_bypool($spo);
|
||||
|
||||
Log::instance()->add(LOG::DEBUG,'EXIT :method',array(':method'=>__METHOD__));
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function occupancy() {
|
||||
return $this->_occupancy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the STORAGE POOLS this NODE has data in
|
||||
*/
|
||||
public function stgpools() {
|
||||
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
|
||||
|
||||
$k = sprintf('%s-%s',__METHOD__,$this->NODE_NAME);
|
||||
$c = Kohana::$config->load('config')->cache;
|
||||
|
||||
@@ -355,11 +372,11 @@ class Model_NODE extends TSM_ORM {
|
||||
array_push($x,$vuo->STGPOOL_NAME);
|
||||
}
|
||||
|
||||
Sort::MASort($result,'STGPOOL_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;
|
||||
}
|
||||
|
||||
@@ -369,6 +386,8 @@ class Model_NODE extends TSM_ORM {
|
||||
* @todo This should be sorted by PRIMARY/ACTIVE/COPY
|
||||
*/
|
||||
public function stgpooltypes() {
|
||||
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
|
||||
|
||||
$k = sprintf('%s-%s',__METHOD__,$this->NODE_NAME);
|
||||
$c = Kohana::$config->load('config')->cache;
|
||||
|
||||
@@ -383,6 +402,7 @@ class Model_NODE extends TSM_ORM {
|
||||
Cache::instance($c)->set($k,$result,300);
|
||||
}
|
||||
|
||||
Log::instance()->add(LOG::DEBUG,'EXIT :method',array(':method'=>__METHOD__));
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -391,6 +411,8 @@ class Model_NODE extends TSM_ORM {
|
||||
* @param $type is BACKUP/ARCHIVE/SPACE MANAGED
|
||||
*/
|
||||
public function stgpools_bybtype($type) {
|
||||
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
|
||||
|
||||
$k = sprintf('%s-%s-%s',__METHOD__,$this->NODE_NAME,$type);
|
||||
$c = Kohana::$config->load('config')->cache;
|
||||
|
||||
@@ -403,11 +425,11 @@ class Model_NODE extends TSM_ORM {
|
||||
array_push($x,$vuo->STGPOOL_NAME);
|
||||
}
|
||||
|
||||
Sort::MASort($result,'STGPOOL_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;
|
||||
}
|
||||
|
||||
@@ -416,6 +438,8 @@ class Model_NODE extends TSM_ORM {
|
||||
* @param $type is ACTIVEDATA/PRIMARY/COPY
|
||||
*/
|
||||
public function stgpools_byptype($type) {
|
||||
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
|
||||
|
||||
$k = sprintf('%s-%s-%s',__METHOD__,$this->NODE_NAME,$type);
|
||||
$c = Kohana::$config->load('config')->cache;
|
||||
|
||||
@@ -430,6 +454,7 @@ class Model_NODE extends TSM_ORM {
|
||||
Cache::instance($c)->set($k,$result,300);
|
||||
}
|
||||
|
||||
Log::instance()->add(LOG::DEBUG,'EXIT :method',array(':method'=>__METHOD__));
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -438,6 +463,8 @@ class Model_NODE extends TSM_ORM {
|
||||
* @param $type is BACKUP/ARCHIVE/SPACE MANAGED
|
||||
*/
|
||||
public function vols_bybtype($type) {
|
||||
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
|
||||
|
||||
$k = sprintf('%s-%s-%s',__METHOD__,$this->NODE_NAME,$type);
|
||||
$c = Kohana::$config->load('config')->cache;
|
||||
|
||||
@@ -455,6 +482,7 @@ class Model_NODE extends TSM_ORM {
|
||||
Cache::instance($c)->set($k,$result,300);
|
||||
}
|
||||
|
||||
Log::instance()->add(LOG::DEBUG,'EXIT :method',array(':method'=>__METHOD__));
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -463,14 +491,16 @@ class Model_NODE extends TSM_ORM {
|
||||
* @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))
|
||||
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);
|
||||
}
|
||||
@@ -480,6 +510,7 @@ class Model_NODE extends TSM_ORM {
|
||||
Cache::instance($c)->set($k,$result,300);
|
||||
}
|
||||
|
||||
Log::instance()->add(LOG::DEBUG,'EXIT :method',array(':method'=>__METHOD__));
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -488,20 +519,25 @@ class Model_NODE extends TSM_ORM {
|
||||
* @param $type is ACTIVEDATA/PRIMARY/COPY
|
||||
*/
|
||||
public function vols_byptype($type) {
|
||||
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
|
||||
|
||||
$result = array();
|
||||
|
||||
foreach ($this->stgpools_byptype($type) as $spo)
|
||||
$result = array_merge($result,$this->vols_bypool($spo));
|
||||
|
||||
Log::instance()->add(LOG::DEBUG,'EXIT :method',array(':method'=>__METHOD__));
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the VOLUMES that this NODE uses by pool and BACKUP TYPE
|
||||
* Return the VOLUMES that this NODE uses by POOL and BACKUP TYPE
|
||||
* @param $pool is STORAGE POOL NAME
|
||||
* @param $type is BACKUP/ARCHIVE/SPACE MANAGED
|
||||
*/
|
||||
public function vols_bypoolbybtype($pool,$type) {
|
||||
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
|
||||
|
||||
$x = $result = array();
|
||||
|
||||
foreach ($this->vols_bypool($pool) as $vuo)
|
||||
@@ -510,7 +546,12 @@ class Model_NODE extends TSM_ORM {
|
||||
array_push($x,$vuo->VOLUME_NAME);
|
||||
}
|
||||
|
||||
Log::instance()->add(LOG::DEBUG,'EXIT :method',array(':method'=>__METHOD__));
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function volumeusage() {
|
||||
return $this->_volumeusage();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -10,7 +10,7 @@
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
* @node This has been renamed to OCC from OCCUPANCY, as DB2/FILESPACES has an OCCUPANCY column
|
||||
*/
|
||||
class Model_OCC extends TSM_ORM {
|
||||
class Model_OCC extends ORM_TSM {
|
||||
protected $_table_name = 'OCCUPANCY';
|
||||
protected $_primary_key = 'NODE_NAME'; // We need a primary key to detect that the object is loaded.
|
||||
protected $_sorting = array(
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_PATH extends TSM_ORM {
|
||||
class Model_PATH extends ORM_TSM {
|
||||
protected $_table_name = 'PATHS';
|
||||
protected $_primary_key = 'DEVICE';
|
||||
protected $_sorting = array(
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_SCHEDULE_CLIENT extends TSM_ORM {
|
||||
class Model_SCHEDULE_CLIENT extends ORM_TSM {
|
||||
protected $_table_name = 'CLIENT_SCHEDULES';
|
||||
protected $_primary_key = 'SCHEDULE_NAME'; // We need a primary key to detect that the object is loaded.
|
||||
protected $_sorting = array(
|
||||
@@ -22,7 +22,7 @@ class Model_SCHEDULE_CLIENT extends TSM_ORM {
|
||||
|
||||
protected $_display_filters = array(
|
||||
'STARTTIME'=>array(
|
||||
array('TSM_ORM::date',array(':value','h:m')),
|
||||
array('ORM_TSM::date',array(':value','h:m')),
|
||||
),
|
||||
);
|
||||
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_STGPOOL extends TSM_ORM {
|
||||
class Model_STGPOOL extends ORM_TSM {
|
||||
protected $_table_name = 'STGPOOLS';
|
||||
protected $_primary_key = 'STGPOOL_NAME';
|
||||
protected $_sorting = array(
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_SUMMARY extends TSM_ORM {
|
||||
class Model_SUMMARY extends ORM_TSM {
|
||||
protected $_table_name = 'SUMMARY';
|
||||
protected $_primary_key = 'ACTIVITY'; // We need a primary key to detect that the object is loaded.
|
||||
protected $_sorting = array(
|
||||
@@ -20,10 +20,10 @@ class Model_SUMMARY extends TSM_ORM {
|
||||
|
||||
protected $_display_filters = array(
|
||||
'START_TIME'=>array(
|
||||
array('TSM_ORM::date',array(':value','d-M H:i')),
|
||||
array('ORM_TSM::date',array(':value','d-M H:i')),
|
||||
),
|
||||
'END_TIME'=>array(
|
||||
array('TSM_ORM::date',array(':value','d-M H:i')),
|
||||
array('ORM_TSM::date',array(':value','d-M H:i')),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_VOLHISTORY extends TSM_ORM {
|
||||
class Model_VOLHISTORY extends ORM_TSM {
|
||||
protected $_table_name = 'VOLHISTORY';
|
||||
protected $_primary_key = 'VOLUME_NAME';
|
||||
protected $_sorting = array(
|
||||
@@ -23,7 +23,7 @@ class Model_VOLHISTORY extends TSM_ORM {
|
||||
|
||||
protected $_display_filters = array(
|
||||
'DATE_TIME'=>array(
|
||||
array('TSM_ORM::date',array(':value','d-M-Y')),
|
||||
array('ORM_TSM::date',array(':value','d-M-Y')),
|
||||
),
|
||||
);
|
||||
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_VOLUME extends TSM_ORM {
|
||||
class Model_VOLUME extends ORM_TSM {
|
||||
protected $_table_name = 'VOLUMES';
|
||||
protected $_primary_key = 'VOLUME_NAME';
|
||||
protected $_sorting = array(
|
||||
@@ -27,10 +27,10 @@ class Model_VOLUME extends TSM_ORM {
|
||||
|
||||
protected $_display_filters = array(
|
||||
'LAST_READ_DATE'=>array(
|
||||
array('TSM_ORM::date',array(':value','d-M-Y')),
|
||||
array('ORM_TSM::date',array(':value','d-M-Y')),
|
||||
),
|
||||
'LAST_WRITE_DATE'=>array(
|
||||
array('TSM_ORM::date',array(':value','d-M-Y')),
|
||||
array('ORM_TSM::date',array(':value','d-M-Y')),
|
||||
),
|
||||
);
|
||||
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_VOLUMEUSAGE extends TSM_ORM {
|
||||
class Model_VOLUMEUSAGE extends ORM_TSM {
|
||||
protected $_table_name = 'VOLUMEUSAGE';
|
||||
protected $_primary_key = 'NODE_NAME'; // We need a primary key to detect that the object is loaded.
|
||||
protected $_sorting = array(
|
||||
|
Reference in New Issue
Block a user