2011-04-07 05:03:05 +00:00
|
|
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @package PTA
|
|
|
|
* @subpackage File Spaces
|
|
|
|
* @category Models
|
|
|
|
* @author Deon George
|
|
|
|
* @copyright (c) 2010 phpTSMadmin Development Team
|
|
|
|
* @license http://phptsmadmin.sf.net/license.html
|
|
|
|
*/
|
|
|
|
class Model_FILESPACE extends ORMTSM {
|
|
|
|
protected $_table_name = 'FILESPACES';
|
2011-05-23 15:04:40 +00:00
|
|
|
protected $_primary_key = 'FILESPACE_NAME'; // We need a primary key to detect that the object is loaded.
|
|
|
|
protected $_sorting = array(
|
|
|
|
'NODE_NAME'=>'ASC',
|
|
|
|
'FILESPACE_NAME'=>'ASC',
|
|
|
|
);
|
|
|
|
|
2011-08-31 21:36:33 +00:00
|
|
|
protected $_has_one = array(
|
|
|
|
'NODE'=>array('foreign_key'=>'NODE_NAME','far_key'=>'NODE_NAME'),
|
|
|
|
);
|
|
|
|
|
2011-04-07 05:03:05 +00:00
|
|
|
protected $_has_many = array(
|
2011-08-31 21:36:33 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
protected $_tsm = array(
|
|
|
|
'db2'=>array(
|
|
|
|
'_primary_key'=>'FSNAME',
|
|
|
|
'_sorting'=>array(
|
|
|
|
'NODEID'=>'ASC',
|
|
|
|
'FSNAME'=>'ASC',
|
|
|
|
),
|
|
|
|
'_has_one'=>array(
|
|
|
|
'NODE'=>array('foreign_key'=>'NODEID','far_key'=>'NODEID'),
|
|
|
|
),
|
|
|
|
'translate'=>array(
|
|
|
|
'FILESPACE_NAME'=>'FSNAME',
|
|
|
|
'BACKUP_END'=>'BACKSTART',
|
|
|
|
'PCT_UTIL'=>NULL,
|
|
|
|
),
|
|
|
|
),
|
2011-04-07 05:03:05 +00:00
|
|
|
);
|
|
|
|
|
2011-05-23 15:04:40 +00:00
|
|
|
protected $_display_filters = array(
|
|
|
|
'BACKUP_END'=>array(
|
|
|
|
array('ORMTSM::date',array(':value','d-M-Y')),
|
|
|
|
),
|
2011-04-07 05:03:05 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
public function utilsation() {
|
2011-08-31 21:36:33 +00:00
|
|
|
return $this->CAPACITY*($this->PCT_UTIL/100);
|
2011-04-07 05:03:05 +00:00
|
|
|
}
|
|
|
|
|
2011-05-30 09:27:08 +00:00
|
|
|
// $dtype must be Bkup or Arch
|
2011-04-07 05:03:05 +00:00
|
|
|
public function storagepools($dtype) {
|
|
|
|
$pool = array();
|
|
|
|
|
2011-08-31 21:36:33 +00:00
|
|
|
foreach ($this->NODE->OCC
|
2011-04-07 05:03:05 +00:00
|
|
|
->select('STGPOOL_NAME')
|
2011-04-08 05:34:04 +00:00
|
|
|
->where('TYPE','=',$dtype)
|
2011-08-31 21:36:33 +00:00
|
|
|
->and_where('FILESPACE_NAME','=',$this->FILESPACE_NAME)
|
2011-04-07 05:03:05 +00:00
|
|
|
->group_by('STGPOOL_NAME')
|
|
|
|
->order_by('STGPOOL_NAME')
|
2011-05-30 09:27:08 +00:00
|
|
|
->find_all() as $oo)
|
2011-04-07 05:03:05 +00:00
|
|
|
|
2011-05-23 15:04:40 +00:00
|
|
|
array_push($pool,$oo->STGPOOL);
|
2011-04-07 05:03:05 +00:00
|
|
|
|
|
|
|
return $pool;
|
|
|
|
}
|
|
|
|
|
2011-05-23 15:04:40 +00:00
|
|
|
public function pool_logical_util($pool,$btype) {
|
2011-08-31 21:36:33 +00:00
|
|
|
return $this->NODE->OCC
|
|
|
|
->where('STGPOOL_NAME','=',$pool)
|
|
|
|
->and_where('TYPE','=',$btype)
|
|
|
|
->and_where('FILESPACE_NAME','=',$this->FILESPACE_NAME)
|
|
|
|
->find()->LOGICAL_MB;
|
2011-04-07 05:03:05 +00:00
|
|
|
}
|
|
|
|
|
2011-05-23 15:04:40 +00:00
|
|
|
public function pool_numvols($pool,$ctype) {
|
2011-08-31 21:36:33 +00:00
|
|
|
return $this->NODE->VOLUMEUSAGE
|
|
|
|
->where('STGPOOL_NAME','=',$pool)
|
|
|
|
->and_where('COPY_TYPE','=',$ctype)
|
|
|
|
->and_where('FILESPACE_NAME','=',$this->FILESPACE_NAME)
|
|
|
|
->find_all()->count();
|
2011-04-07 05:03:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|