diff --git a/.htaccess b/.htaccess
index 62322fc..8ec502c 100644
--- a/.htaccess
+++ b/.htaccess
@@ -11,11 +11,11 @@ RewriteBase /pta/
# Protect application and system files from being viewed
-RewriteRule ^(?:application|modules|includes/kohana)\b.* kh.php/$0 [L]
+RewriteRule ^(?:application|modules|includes/kohana)\b.* index.php/$0 [L]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
-# Rewrite all other URLs to kh.php/URL
-RewriteRule .* kh.php/$0 [PT]
+# Rewrite all other URLs to index.php/URL
+RewriteRule .* index.php/$0 [PT]
diff --git a/application/classes/Controller/TemplateDefault/View.php b/application/classes/Controller/TemplateDefault/View.php
index 72e5d14..25823b4 100644
--- a/application/classes/Controller/TemplateDefault/View.php
+++ b/application/classes/Controller/TemplateDefault/View.php
@@ -50,7 +50,7 @@ abstract class Controller_TemplateDefault_View extends Controller_TemplateDefaul
SystemMessage::add(array(
'title'=>_('Missing required data'),
'type'=>'error',
- 'body'=>sprintf(_('The %s is required.'),$o->primary_key()),
+ 'body'=>sprintf(_('The %s is required.'),ORM::factory($this->orm)->primary_key()),
));
HTTP::redirect(strtolower($this->request->controller()));
diff --git a/application/classes/Model/DOMAIN.php b/application/classes/Model/DOMAIN.php
index e272fe4..0c8f7fd 100644
--- a/application/classes/Model/DOMAIN.php
+++ b/application/classes/Model/DOMAIN.php
@@ -32,80 +32,238 @@ class Model_DOMAIN extends TSM_ORM {
),
);
- // Pools used by a domain.
- private $pools = array();
-
- // Work out all the storage pools used by a domain.
- // $dtype is BACKUP (Bkup) or ARCHIVE (Arch)
- public function getStoragePools($dtype) {
- return isset($this->pools[$dtype]) ? $this->pools[$dtype] : $this->_getpools($dtype);
- }
-
- private function _getpools($dtype) {
- $this->pools[$dtype] = array();
-
- foreach ($this->NODE->find_all() as $no)
- foreach ($no->getStoragePools($dtype) as $ptype => $stgpools)
- foreach ($stgpools as $spo)
- if (! isset($this->pools[$dtype][$ptype]) OR ! in_array($spo,$this->pools[$dtype][$ptype]))
- $this->pools[$dtype][$ptype][] = $spo;
-
- return $this->pools[$dtype];
- }
-
- // Return the storage pools used for a domain by backup type
- // $dtype is BACKUP (Bkup) or ARCHIVE (Arch)
- // $ptype is pool type (PRIMARY,ACTIVE,COPY)
- public function getStoragePoolsType($dtype,$ptype) {
- if (! isset($this->pools[$dtype]))
- $this->_getpools($dtype);
-
- return isset($this->pools[$dtype][$ptype]) ? $this->pools[$dtype][$ptype] : array();
- }
-
- // $dtype is BACKUP or ARCHIVE
- // $ptype is pool type (PRIMARY,ACTIVE,COPY)
- public function getStorageModeVols($dtype,$ptype,$spo='') {
+ /**
+ * Get all the NODES in this DOMAIN
+ */
+ private function _nodes() {
$result = array();
- foreach ($this->NODE->find_all() as $no)
- $result = array_merge($result,$no->getStorageModeVols($dtype,$ptype,$spo));
+ // 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);
return $result;
}
- // $dtype is BACKUP (Bkup) or ARCHIVE (Arch)
- // $ptype is pool type (PRIMARY,ACTIVE,COPY)
- public function getStorageModeFiles($dtype,$ptype,$spo='') {
- $count = 0;
-
- foreach ($this->NODE->find_all() as $no)
- $count += $no->getStorageModeFiles($dtype,$ptype,$spo);
-
- return $count;
+ public function nodes() {
+ return $this->_nodes();
}
- // $dtype is BACKUP or ARCHIVE
- // $ptype is pool type (PRIMARY,ACTIVE,COPY)
- public function getStorageModeData($dtype,$ptype,$spo='') {
- $count = 0;
+ /**
+ * Return the FILES that NODES in this DOMAIN has in a STORAGE POOL
+ * @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;
- foreach ($this->NODE->find_all() as $no)
- $count += $no->getStorageModeData($dtype,$ptype,$spo);
+ if (is_null($result = Cache::instance($c)->get($k))) {
+ $result = 0;
- return $count;
+ foreach ($this->_nodes() as $no)
+ $result += $no->file_bypool($pool);
+
+ // @todo Cache time should be configurble
+ Cache::instance($c)->set($k,$result,300);
+ }
+
+ return $result;
}
- // $dtype is BACKUP or ARCHIVE
- // $ptype is pool type (PRIMARY,ACTIVE,COPY)
- public function getStorageModeNodes($dtype,$ptype,$spo='') {
+ /**
+ * Return the LOGICAL_MB that NODES in this DOMAIN has in a STORAGE POOL
+ * @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;
+
+ if (is_null($result = Cache::instance($c)->get($k))) {
+ $result = 0;
+
+ foreach ($this->_nodes() as $no)
+ $result += $no->logmb_bypool($pool);
+
+ // @todo Cache time should be configurble
+ Cache::instance($c)->set($k,$result,300);
+ }
+
+ return $result;
+ }
+
+ /**
+ * Return the NODES in this DOMAIN that have data in this STORAGE POOL
+ * @param $pool is STORAGE POOL NAME
+ */
+ public function nodes_bypool(ORM $spo) {
$result = array();
- foreach ($this->NODE->find_all() as $no)
- if ($no->getStorageModeData($dtype,$ptype,$spo))
+ foreach ($spo->nodes() as $no)
+ if (in_array($no,$this->_nodes()))
array_push($result,$no);
return $result;
}
+
+ /**
+ * Return the STORAGE POOLS used by NODES in this DOMAIN
+ */
+ public function stgpools() {
+ $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)
+ foreach ($no->stgpools() as $spo)
+ if (! in_array($spo,$result))
+ array_push($result,$spo);
+
+ // @todo Cache time should be configurble
+ Cache::instance($c)->set($k,$result,300);
+ }
+
+ 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 BACKUP/ARCHIVE/SPACE MANAGED
+ */
+ public function stgpools_bybtype($type) {
+ $k = sprintf('%s-%s-%s',__METHOD__,$this->DOMAIN_NAME,$type);
+ $c = Kohana::$config->load('config')->cache;
+
+ if (is_null($result = Cache::instance($c)->get($k))) {
+ $x = $result = array();
+
+ foreach ($this->_nodes() as $no)
+ foreach ($no->stgpools_bybtype($type) as $spo)
+ if (! in_array($spo->STGPOOL_NAME,$result))
+ array_push($result,$spo);
+
+ Sort::MASort($result,'STGPOOL_NAME');
+ // @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 ACTIVEDATA/PRIMARY/COPY
+ */
+ public function stgpools_byptype($type) {
+ $k = sprintf('%s-%s-%s',__METHOD__,$this->DOMAIN_NAME,$type);
+ $c = Kohana::$config->load('config')->cache;
+
+ if (is_null($result = Cache::instance($c)->get($k))) {
+ $result = array();
+
+ foreach ($this->stgpools() as $spo)
+ if ($spo->POOLTYPE == $type)
+ array_push($result,$spo);
+
+ // @todo Cache time should be configurble
+ Cache::instance($c)->set($k,$result,300);
+ }
+
+ 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))) {
+ $x = $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);
+ }
+
+ // @todo Cache time should be configurble
+ Cache::instance($c)->set($k,$result,300);
+ }
+
+ return $result;
+ }
+
+ /**
+ * Return the VOLUMES that NODES in this DOMAIN uses by BACKUP TYPE
+ * @param $type is BACKUP/ARCHIVE/SPACE MANAGED
+ */
+ public function vols_bybtype($type) {
+ $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();
+
+ foreach ($this->_nodes() as $no)
+ foreach ($no->vols_bybtype($type) as $vuo)
+ if (! 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);
+ }
+
+ return $result;
+ }
+
+ /**
+ * 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) {
+ $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;
+ }
}
?>
diff --git a/application/classes/Model/DRIVE.php b/application/classes/Model/DRIVE.php
index 5b576b4..94dc93a 100644
--- a/application/classes/Model/DRIVE.php
+++ b/application/classes/Model/DRIVE.php
@@ -16,8 +16,6 @@ class Model_DRIVE extends TSM_ORM {
'DRIVE_NAME'=>'ASC',
);
- protected $_has_one = array(
- );
protected $_has_many = array(
'PATH'=>array('foreign_key'=>array('LIBRARY_NAME'=>'LIBRARY_NAME','DRIVE_NAME'=>'DESTINATION_NAME')),
);
diff --git a/application/classes/Model/FILESPACE.php b/application/classes/Model/FILESPACE.php
index 6fe1232..2979265 100644
--- a/application/classes/Model/FILESPACE.php
+++ b/application/classes/Model/FILESPACE.php
@@ -21,9 +21,6 @@ class Model_FILESPACE extends TSM_ORM {
'NODE'=>array('foreign_key'=>'NODE_NAME','far_key'=>'NODE_NAME'),
);
- protected $_has_many = array(
- );
-
protected $_tsm = array(
'db2'=>array(
'_primary_key'=>'FSNAME',
diff --git a/application/classes/Model/LIBRARY.php b/application/classes/Model/LIBRARY.php
index d93e564..68ada0c 100644
--- a/application/classes/Model/LIBRARY.php
+++ b/application/classes/Model/LIBRARY.php
@@ -20,14 +20,13 @@ class Model_LIBRARY extends TSM_ORM {
private $slots;
private $storagepools = array();
- protected $_has_one = array(
- );
protected $_has_many = array(
'DRIVE'=>array('foreign_key'=>'LIBRARY_NAME','far_key'=>'LIBRARY_NAME'),
'PATH'=>array('foreign_key'=>'DESTINATION_NAME','far_key'=>'LIBRARY_NAME'),
'DEVCLASSES'=>array('foreign_key'=>'LIBRARY_NAME','far_key'=>'LIBRARY_NAME'),
);
+#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);
}
diff --git a/application/classes/Model/MEDIA.php b/application/classes/Model/MEDIA.php
index 9e3afb3..1c96707 100644
--- a/application/classes/Model/MEDIA.php
+++ b/application/classes/Model/MEDIA.php
@@ -16,11 +16,6 @@ class Model_MEDIA extends TSM_ORM {
'VOLUME_NAME'=>'ASC',
);
- protected $_has_one = array(
- );
- protected $_has_many = array(
- );
-
public function inlib() {
return in_array($this->STATE,array('MOUNTABLEINLIB','Mountable in library'));
}
diff --git a/application/classes/Model/NODE.php b/application/classes/Model/NODE.php
index 11f6597..58e7ad5 100644
--- a/application/classes/Model/NODE.php
+++ b/application/classes/Model/NODE.php
@@ -114,16 +114,68 @@ class Model_NODE extends TSM_ORM {
),
);
- // Pools used by a node.
- private $pools = array();
+ /**
+ * Get all the FILESPACES for this NODE
+ */
+ private function _filespaces() {
+ $result = array();
- public function tsmclientversion() {
+ // 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('FILESPACE')->find_all() as $o)
+ if ($o->NODE_NAME == $this->NODE_NAME)
+ array_push($result,$o);
+
+ return $result;
+ }
+
+ /**
+ * Get all the OCCUPANCY for this NODE
+ */
+ private function _occupancy() {
+ $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);
+
+ return $result;
+ }
+
+ /**
+ * Get all the VOLUMES for this NODE
+ */
+ private function _volumeusage() {
+ $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);
+
+ return $result;
+ }
+
+ public function fs() {
+ return $this->_filespaces();
+ }
+
+ /**
+ * Return the version of the TSM client
+ */
+ public function version() {
if ($this->CLIENT_VERSION)
return sprintf('%s.%s.%s.%s',$this->CLIENT_VERSION,$this->CLIENT_RELEASE,$this->CLIENT_LEVEL,$this->CLIENT_SUBLEVEL);
else
return '';
}
+ /**
+ * Return the OS version for the TSM client
+ */
public function platform() {
return sprintf('%s %s',$this->PLATFORM_NAME,$this->CLIENT_OS_LEVEL ? '('.$this->CLIENT_OS_LEVEL.')' : '');
}
@@ -136,10 +188,13 @@ class Model_NODE extends TSM_ORM {
return _('No Set');
}
+ // @todo This needs to be validated as a correct calculation
public function lasttransferpercent() {
- return 100-($this->LASTSESS_IDLEWAIT+$this->LASTSESS_COMMWAIT+$this->LASTSESS_MEDIAWAIT);
+ $x = 100-($this->LASTSESS_IDLEWAIT+$this->LASTSESS_COMMWAIT+$this->LASTSESS_MEDIAWAIT);
+ return $x < 0 ? 0 : $x;
}
+ // @todo This needs to be validated as a correct calculation
public function lasttransfertime() {
if ($this->LASTSESS_DURATION)
return $this->LASTSESS_DURATION*($this->lasttransferpercent()/100);
@@ -147,6 +202,7 @@ class Model_NODE extends TSM_ORM {
return 0;
}
+ // @todo This needs to be validated as a correct calculation
public function lastsendperformance() {
if ($this->lasttransfertime())
return $this->LASTSESS_SENT/$this->lasttransfertime()/1024/1024;
@@ -154,6 +210,7 @@ class Model_NODE extends TSM_ORM {
return 0;
}
+ // @todo This needs to be validated as a correct calculation
public function lastreceiveperformance() {
if ($this->lasttransfertime())
return $this->LASTSESS_RECVD/$this->lasttransfertime()/1024/1024;
@@ -161,6 +218,9 @@ class Model_NODE extends TSM_ORM {
return 0;
}
+ /**
+ * The last sent aggregate performance
+ */
public function lastsendaggperformance() {
if ((real)$this->LASTSESS_DURATION)
return $this->LASTSESS_SENT/$this->LASTSESS_DURATION/1024/1024;
@@ -168,6 +228,9 @@ class Model_NODE extends TSM_ORM {
return 0;
}
+ /**
+ * The last receive aggregate performance
+ */
public function lastreceiveaggperformance() {
if ((real)$this->LASTSESS_DURATION)
return $this->LASTSESS_RECVD/$this->LASTSESS_DURATION/1024/1024;
@@ -180,56 +243,20 @@ class Model_NODE extends TSM_ORM {
return $this->TXNGROUPMAX;
}
- // Work out all the storage pools used by a node.
- // $dtype is BACKUP (Bkup) or ARCHIVE (Arch)
- public function getStoragePools($dtype) {
- return isset($this->pools[$dtype]) ? $this->pools[$dtype] : $this->_getpools($dtype);
- }
-
- // $dtype is BACKUP (Bkup) or ARCHIVE (Arch)
- private function _getpools($dtype) {
- $this->pools[$dtype] = array();
-
- foreach ($this->FILESPACE->find_all() as $fso)
- foreach ($fso->storagepools($dtype) as $po)
- if (! isset($this->pools[$dtype][$po->POOLTYPE][$po->STGPOOL_NAME]))
- $this->pools[$dtype][$po->POOLTYPE][$po->STGPOOL_NAME] = $po;
-
- return $this->pools[$dtype];
- }
-
// Test to see if a node has any data of type
- // $dtype is BACKUP (Bkup) or ARCHIVE (Arch)
- public function hasData($dtype) {
- return $this->getStoragePools($dtype) ? TRUE : FALSE;
- }
-
- public function getAllStoragePoolsType($ptype) {
- $result = array();
-
- foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype)
- $result = array_merge($result,$this->getStoragePoolsType($btype,$ptype));
-
- return $result;
- }
-
- // Return the storage pools used for a backup type
- // $dtype is BACKUP (Bkup) or ARCHIVE (Arch)
- // $ptype is pool type (PRIMARY,ACTIVE,COPY)
- public function getStoragePoolsType($dtype,$ptype) {
- if (! isset($this->pools[$dtype]))
- $this->_getpools($dtype);
-
- return isset($this->pools[$dtype][$ptype]) ? $this->pools[$dtype][$ptype] : array();
+ // @param $type is BACKUP/ARCHIVE/SPACE MANAGED
+ public function hasData($type) {
+ return $this->vols_bybtype($type) ? TRUE : FALSE;
}
// $dtype is BACKUP or ARCHIVE
// $ptype is pool type (PRIMARY,ACTIVE,COPY)
+#zz
public function getStorageModeVols($dtype,$ptype,$spo='') {
$result = array();
- foreach ($this->VOLUMEUSAGE->where('COPY_TYPE','=',$dtype)->find_all() as $vo)
- if ((! $spo OR $vo->STGPOOL_NAME == $spo) AND $vo->STGPOOL->POOLTYPE == $ptype)
+ 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;
@@ -237,6 +264,7 @@ class Model_NODE extends TSM_ORM {
}
// $ptype is pool type (PRIMARY,ACTIVE,COPY)
+#zz
public function getStorageTypeVols($ptype,$spo='') {
$result = array();
@@ -246,74 +274,243 @@ class Model_NODE extends TSM_ORM {
return $result;
}
- // $dtype is BACKUP (Bkup) or ARCHIVE (Arch)
- // $ptype is pool type (PRIMARY,ACTIVE,COPY)
- public function getStorageModeFiles($dtype,$ptype,$spo='') {
- $count = 0;
+ /**
+ * 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) {
+ $k = sprintf('%s-%s-%s-%s',__METHOD__,$this->NODE_NAME,$pool,$metric);
+ $c = Kohana::$config->load('config')->cache;
- foreach ($this->OCC->where('TYPE','=',$dtype)->find_all() as $oa)
- if ((! $spo OR $oa->STGPOOL_NAME == $spo) AND $oa->STGPOOL->POOLTYPE == $ptype)
- $count += $oa->NUM_FILES;
+ if (is_null($result = Cache::instance($c)->get($k))) {
+ $result = 0;
- return $count;
- }
+ foreach ($this->_occupancy() as $oo)
+ if ($oo->STGPOOL_NAME == $pool)
+ $result += $oo->{$metric};
- // $ptype is pool type (PRIMARY,ACTIVE,COPY)
- public function getStorageTypeFiles($ptype,$spo='') {
- $count = 0;
+ // @todo Cache time should be configurble
+ Cache::instance($c)->set($k,$result,300);
+ }
- foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype)
- $count += $this->getStorageModeFiles($btype,$ptype,$spo);
-
- return $count;
- }
-
- // $dtype is BACKUP (Bkup) or ARCHIVE (Arch)
- // $ptype is pool type (PRIMARY,ACTIVE,COPY)
- public function getStorageModeData($dtype,$ptype,$spo='') {
- $count = 0;
-
- foreach ($this->OCC->where('TYPE','=',$dtype)->find_all() as $oa)
- if ((! $spo OR $oa->STGPOOL_NAME == $spo) AND $oa->STGPOOL->POOLTYPE == $ptype)
- $count += $oa->LOGICAL_MB;
-
- return $count;
- }
-
- // $ptype is pool type (PRIMARY,ACTIVE,COPY)
- public function getStorageTypeData($ptype,$spo='') {
- $count = 0;
-
- foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype)
- $count += $this->getStorageModeData($btype,$ptype,$spo);
-
- return $count;
- }
-
- // Return the volumes that this node uses
- // $dtype is BACKUP or ARCHIVE
- public function volumes($dtype) {
- $volumes = array();
-
- $v = array();
- foreach ($this->VOLUMEUSAGE->where('COPY_TYPE','=',$dtype)->order_by('STGPOOL_NAME,FILESPACE_NAME')->find_all() as $vol)
- if (! in_array($vol->VOLUME->VOLUME_NAME,$v)) {
- $volumes[$vol->STGPOOL_NAME][] = $vol->VOLUME;
- array_push($v,$vol->VOLUME->VOLUME_NAME);
- }
-
- return $volumes;
+ return $result;
}
/**
- * Get all the nodes by OS
+ * Return the FILES that this NODE has in a STORAGE POOL
+ * @param $pool is STORAGE POOL NAME
*/
- public function byos() {
- $a = $this->select('count(*) AS node_name,platform_name')
- ->group_by('platform_name')
- ->order_by('platform_name');
+ public function file_bypool($pool) {
+ return $this->data_bypool($pool,'NUM_FILES');
+ }
- return $a->find_all();
+ /**
+ * Return the FILES that this NODE has in a STORAGE POOL TYPE
+ * @param $type is ACTIVEDATA/PRIMARY/COPY
+ */
+ public function file_byptype($type) {
+ $result = 0;
+
+ foreach ($this->stgpools_byptype($type) as $spo)
+ $result += $this->file_bypool($spo);
+
+ return $result;
+ }
+
+ /**
+ * Return the LOGICAL_MB that this NODE has in a STORAGE POOL
+ * @param $pool is STORAGE POOL NAME
+ */
+ public function logmb_bypool($pool) {
+ return $this->data_bypool($pool,'LOGICAL_MB');
+ }
+
+ /**
+ * Return the FILES that this NODE has in a STORAGE POOL TYPE
+ * @param $type is ACTIVEDATA/PRIMARY/COPY
+ */
+ public function logmb_byptype($type) {
+ $result = 0;
+
+ foreach ($this->stgpools_byptype($type) as $spo)
+ $result += $this->logmb_bypool($spo);
+
+ return $result;
+ }
+
+ /**
+ * Return the STORAGE POOLS this NODE has data in
+ */
+ public function stgpools() {
+ $k = sprintf('%s-%s',__METHOD__,$this->NODE_NAME);
+ $c = Kohana::$config->load('config')->cache;
+
+ if (is_null($result = Cache::instance($c)->get($k))) {
+ $x = $result = array();
+
+ foreach ($this->_volumeusage() as $vuo)
+ if (! in_array($vuo->STGPOOL_NAME,$x)) {
+ array_push($result,$vuo->STGPOOL);
+ array_push($x,$vuo->STGPOOL_NAME);
+ }
+
+ Sort::MASort($result,'STGPOOL_NAME');
+ // @todo Cache time should be configurble
+ Cache::instance($c)->set($k,$result,300);
+ }
+
+ return $result;
+ }
+
+ /**
+ * Return the STORAGE POOL TYPES used by this NODE
+ * ie: ACTIVE/PRIMARY/COPY
+ * @todo This should be sorted by PRIMARY/ACTIVE/COPY
+ */
+ public function stgpooltypes() {
+ $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();
+
+ 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 this NODE uses by BACKUP TYPE
+ * @param $type is BACKUP/ARCHIVE/SPACE MANAGED
+ */
+ public function stgpools_bybtype($type) {
+ $k = sprintf('%s-%s-%s',__METHOD__,$this->NODE_NAME,$type);
+ $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->STGPOOL_NAME,$x)) {
+ array_push($result,$vuo->STGPOOL);
+ array_push($x,$vuo->STGPOOL_NAME);
+ }
+
+ Sort::MASort($result,'STGPOOL_NAME');
+ // @todo Cache time should be configurble
+ Cache::instance($c)->set($k,$result,300);
+ }
+
+ return $result;
+ }
+
+ /**
+ * Return the STORAGE POOLS that this NODE uses by BACKUP TYPE
+ * @param $type is ACTIVEDATA/PRIMARY/COPY
+ */
+ public function stgpools_byptype($type) {
+ $k = sprintf('%s-%s-%s',__METHOD__,$this->NODE_NAME,$type);
+ $c = Kohana::$config->load('config')->cache;
+
+ if (is_null($result = Cache::instance($c)->get($k))) {
+ $result = array();
+
+ foreach ($this->stgpools() as $spo)
+ if ($spo->POOLTYPE == $type)
+ array_push($result,$spo);
+
+ // @todo Cache time should be configurble
+ Cache::instance($c)->set($k,$result,300);
+ }
+
+ return $result;
+ }
+
+ /**
+ * Return the VOLUMES that this NODE uses by BACKUP TYPE
+ * @param $type is BACKUP/ARCHIVE/SPACE MANAGED
+ */
+ public function vols_bybtype($type) {
+ $k = sprintf('%s-%s-%s',__METHOD__,$this->NODE_NAME,$type);
+ $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)) {
+ array_push($result,$vuo->VOLUME);
+ array_push($x,$vuo->VOLUME_NAME);
+ }
+
+ Sort::MASort($result,'VOLUME_NAME');
+ // @todo Cache time should be configurble
+ Cache::instance($c)->set($k,$result,300);
+ }
+
+ return $result;
+ }
+
+ /**
+ * Return the VOLUMES that this NODE uses
+ * @param $pool is STORAGE POOL NAME
+ */
+ public function vols_bypool($pool) {
+ $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);
+ }
+
+ return $result;
+ }
+
+ /**
+ * Return the VOLUMES that this NODE has in a STORAGE POOL TYPE
+ * @param $type is ACTIVEDATA/PRIMARY/COPY
+ */
+ public function vols_byptype($type) {
+ $result = array();
+
+ foreach ($this->stgpools_byptype($type) as $spo)
+ $result = array_merge($result,$this->vols_bypool($spo));
+
+ return $result;
+ }
+
+ /**
+ * 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) {
+ $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;
}
}
?>
diff --git a/application/classes/Model/OCC.php b/application/classes/Model/OCC.php
index b1023bd..1fa311c 100644
--- a/application/classes/Model/OCC.php
+++ b/application/classes/Model/OCC.php
@@ -20,6 +20,7 @@ class Model_OCC extends TSM_ORM {
);
protected $_has_one = array(
+ 'NODE'=>array('foreign_key'=>'NODE_NAME','far_key'=>'NODE_NAME'),
'STGPOOL'=>array('foreign_key'=>'STGPOOL_NAME','far_key'=>'STGPOOL_NAME'),
);
}
diff --git a/application/classes/Model/PATH.php b/application/classes/Model/PATH.php
index 86018e4..b3a8827 100644
--- a/application/classes/Model/PATH.php
+++ b/application/classes/Model/PATH.php
@@ -15,10 +15,5 @@ class Model_PATH extends TSM_ORM {
protected $_sorting = array(
'DESTINATION_NAME'=>'ASC',
);
-
- protected $_has_one = array(
- );
- protected $_has_many = array(
- );
}
?>
diff --git a/application/classes/Model/STGPOOL.php b/application/classes/Model/STGPOOL.php
index 994ade6..0119807 100644
--- a/application/classes/Model/STGPOOL.php
+++ b/application/classes/Model/STGPOOL.php
@@ -27,6 +27,43 @@ class Model_STGPOOL extends TSM_ORM {
'OCC'=>array('foreign_key'=>'STGPOOL_NAME','far_key'=>'STGPOOL_NAME'),
);
+ /**
+ * Get all the OCCUPANCY for this STORAGE POOL
+ */
+ private function _occupancy() {
+ $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->STGPOOL_NAME == $this->STGPOOL_NAME)
+ array_push($result,$o);
+
+ return $result;
+ }
+
+ /**
+ * Get all the NODES for this STORAGE POOL
+ */
+ public function nodes() {
+ $k = sprintf('%s-%s',__METHOD__,$this->STGPOOL_NAME);
+ $c = Kohana::$config->load('config')->cache;
+
+ if (is_null($result = Cache::instance($c)->get($k))) {
+ $result = array();
+
+ // @todo This might want to return the NODE object.
+ foreach ($this->_occupancy() as $oo)
+ if (! in_array($oo->NODE_NAME,$result))
+ array_push($result,$oo->NODE_NAME);
+
+ // @todo Cache time should be configurble
+ Cache::instance($c)->set($k,$result,300);
+ }
+
+ return $result;
+ }
+
// Return a list of volumes
// @param $inout IN|OUT of the library
// @param $status volume status FULL|FILLING|PENDING|EMPTY
diff --git a/application/classes/Model/VOLHISTORY.php b/application/classes/Model/VOLHISTORY.php
index bd02dae..ea0ccc5 100644
--- a/application/classes/Model/VOLHISTORY.php
+++ b/application/classes/Model/VOLHISTORY.php
@@ -20,8 +20,6 @@ class Model_VOLHISTORY extends TSM_ORM {
'LIBVOLUME'=>array('foreign_key'=>'VOLUME_NAME','far_key'=>'VOLUME_NAME'),
'VOLUME'=>array('foreign_key'=>'VOLUME_NAME','far_key'=>'VOLUME_NAME'),
);
- protected $_has_many = array(
- );
protected $_display_filters = array(
'DATE_TIME'=>array(
diff --git a/application/classes/Model/VOLUME.php b/application/classes/Model/VOLUME.php
index 789861d..086910d 100644
--- a/application/classes/Model/VOLUME.php
+++ b/application/classes/Model/VOLUME.php
@@ -34,26 +34,72 @@ class Model_VOLUME extends TSM_ORM {
),
);
- // Show the number of filespaces on a volume
- // $dtype is BACKUP or ARCHIVE
- public function getFSOnVol($dtype) {
- return $this->VOLUMEUSAGE->where('COPY_TYPE','=',$dtype)->find_all()->count();
+ /**
+ * Get all the VOLUMEUSAGE for this VOLUME
+ */
+ private function _volumeusage() {
+ $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->VOLUME_NAME == $this->VOLUME_NAME)
+ array_push($result,$o);
+
+ return $result;
}
- // Show the number of nodes on a volume
- // $dtype is BACKUP or ARCHIVE
- public function getNodesOnVol($dtype) {
- return $this->VOLUMEUSAGE->select('NODE_NAME')->distinct(TRUE)->where('COPY_TYPE','=',$dtype)->find_all()->count();
+ /**
+ * Get FILESYSTEMS on a VOLUME
+ * @param $type is BACKUP/ARCHIVE/SPACE MANAGED
+ */
+ public function fs_bybtype($type) {
+ $k = sprintf('%s-%s-%s',__METHOD__,$this->VOLUME_NAME,$type);
+ $c = Kohana::$config->load('config')->cache;
+
+ if (is_null($result = Cache::instance($c)->get($k))) {
+ $result = array();
+
+ foreach ($this->_volumeusage() as $vuo)
+ if ($vuo->COPY_TYPE == $type)
+ array_push($result,$vuo);
+
+ Sort::MASort($result,'VOLUME_NAME');
+ // @todo Cache time should be configurble
+ Cache::instance($c)->set($k,$result,300);
+ }
+
+ return $result;
+ }
+
+ /**
+ * Get NODES on a VOLUME
+ * @param $type is BACKUP/ARCHIVE/SPACE MANAGED
+ */
+ public function nodes_bybtype($type) {
+ $k = sprintf('%s-%s-%s',__METHOD__,$this->VOLUME_NAME,$type);
+ $c = Kohana::$config->load('config')->cache;
+
+ if (TRUE OR 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->NODE_NAME,$x)) {
+ array_push($result,$vuo);
+ array_push($x,$vuo->NODE_NAME);
+ }
+
+ // @todo Cache time should be configurble
+ Cache::instance($c)->set($k,$result,300);
+ }
+
+ return $result;
}
public function isScratch() {
return $this->SCRATCH === 'YES' ? TRUE : FALSE;
}
- public function location() {
- return $this->display('LOCATION');
- }
-
// Age of a volume, based on last read/write access.
public function age() {
if ((! $this->LAST_READ_DATE AND ! $this->LAST_WRITE_DATE) OR $this->STATUS == 'EMPTY')
diff --git a/application/classes/Model/VOLUMEUSAGE.php b/application/classes/Model/VOLUMEUSAGE.php
index 1faf3ac..0cc1cfc 100644
--- a/application/classes/Model/VOLUMEUSAGE.php
+++ b/application/classes/Model/VOLUMEUSAGE.php
@@ -14,8 +14,6 @@ class Model_VOLUMEUSAGE extends TSM_ORM {
protected $_primary_key = 'NODE_NAME'; // We need a primary key to detect that the object is loaded.
protected $_sorting = array(
'NODE_NAME'=>'ASC',
-# 'FILESPACE_NAME'=>'ASC', // @todo Disabled, as we were getting some SQL errors, when the query returned no records
-# 'VOLUME_NAME'=>'ASC',
);
protected $_has_one = array(
diff --git a/application/classes/TSM/ORM.php b/application/classes/TSM/ORM.php
index b7d7d6d..1a2d014 100644
--- a/application/classes/TSM/ORM.php
+++ b/application/classes/TSM/ORM.php
@@ -51,16 +51,15 @@ abstract class TSM_ORM extends ORM {
public function __get($column) {
// Get a substited column name - need for DB2/DSMADMC schema differences
- if (isset($this->_tsm[$this->_db_group]['translate']) AND array_key_exists($column,$this->_tsm[$this->_db_group]['translate'])) {
+ if (isset($this->_tsm[$this->_db_group]['translate']) AND array_key_exists($column,$this->_tsm[$this->_db_group]['translate']))
return is_null($c=$this->_tsm[$this->_db_group]['translate'][$column]) ? NULL : parent::__get($c);
-}
else
return parent::__get($column);
}
public function find() {
// Check if we can preload our data and havent already done it
- if ($time = $this->isCacheable() AND is_null(Cache::instance()->get($cache_key = 'PRELOAD:'.$this->_table_name))) {
+ if ($time = $this->isCacheable() AND is_null(Cache::instance(Kohana::$config->load('config')->cache)->get($cache_key = 'PRELOAD:'.$this->_table_name))) {
// Firstly set our cache, so that we dont get in a loop
Cache::instance()->set($cache_key,TRUE,$time-1);
diff --git a/application/config/config.php b/application/config/config.php
index 7b2d597..6a82ec0 100644
--- a/application/config/config.php
+++ b/application/config/config.php
@@ -12,6 +12,8 @@
return array(
'cache_type' => 'file',
+ 'cache' => 'apc',
+ 'cache_time' => 86400,
'client' => '/opt/tivoli/tsm/client/ba/bin/dsmadmc',
'client_type' => 'dsmadmc',
'client_errorlogname' => '/tmp/pta-tsm-errorlog.log',
diff --git a/application/views/domain/detail.php b/application/views/domain/detail.php
index d4b0398..44c875a 100644
--- a/application/views/domain/detail.php
+++ b/application/views/domain/detail.php
@@ -1,29 +1,30 @@
- set('o',$o); ?> |
+ set('o',$o); ?> |
- |
+ |
- set('o',$o); ?> |
+ set('o',$o); ?> |
+ |
- |
+ |
- set('o',$o); ?> |
+ set('o',$o); ?> |
- |
+ |
- set('o',$o); ?> |
+ set('o',$o); ?> |
- |
+ |
- set('o',$o); ?> |
+ set('o',$o); ?> |
diff --git a/application/views/domain/nodes.php b/application/views/domain/nodes.php
index e437fa9..337d463 100644
--- a/application/views/domain/nodes.php
+++ b/application/views/domain/nodes.php
@@ -14,27 +14,27 @@
Last IP Addr |
Client Opt |
load('config')->tsmdatatypes as $btype => $ctype) { ?>
- |
+ |
load('config')->tsmpooltypes as $type) { ?>
(Vol/Fil/Dat) |
- NODE->find_all() as $no) { ?>
+ nodes() as $no) { ?>
NODE_NAME,$no->NODE_NAME); ?> |
- tsmclientversion(); ?> |
+ version(); ?> |
platform(); ?> |
display('LASTACC_TIME'); ?> |
display('TCP_ADDRESS'); ?> |
display('OPTION_SET'); ?> |
load('config')->tsmdatatypes as $btype => $ctype) { ?>
- hasData($btype) ? 'Y' : 'N'; ?> |
+ hasData($ctype) ? 'Y' : 'N'; ?> |
load('config')->tsmpooltypes as $type) { ?>
- getStorageTypeVols($type)); ?> |
- getStorageTypeFiles($type); ?> |
- getStorageTypeData($type); ?> |
+ vols_byptype($type)); ?> |
+ file_byptype($type),0); ?> |
+ logmb_byptype($type),0); ?> |
diff --git a/application/views/domain/schedules.php b/application/views/domain/schedules.php
index a64010b..3df593f 100644
--- a/application/views/domain/schedules.php
+++ b/application/views/domain/schedules.php
@@ -15,7 +15,7 @@
Priority |
Nodes |
- SCHEDULE_CLIENT->find_all() as $so) { ?>
+ SCHEDULE_CLIENT->find_all() as $so) { ?>
display('SCHEDULE_NAME'); ?> |
display('STARTTIME'); ?> |
diff --git a/application/views/domain/stgpool_summary.php b/application/views/domain/stgpool_summary.php
new file mode 100644
index 0000000..88e9111
--- /dev/null
+++ b/application/views/domain/stgpool_summary.php
@@ -0,0 +1,36 @@
+
+
+
+ Storage By Pools Summary for Nodes in this Domain |
+
+
+ |
+
+
+ Storage Pool and Type |
+ Scr Use |
+ Scr Avl |
+ Nodes |
+ Vols |
+ Files |
+ MB |
+
+ stgpooltypes() as $type) { ?>
+
+ |
+
+ stgpools_byptype($type) as $spo) { ?>
+
+ |
+ STGPOOL_NAME,$spo->display('STGPOOL_NAME')); ?> |
+ display('NUMSCRATCHUSED'); ?> |
+ display('MAXSCRATCH'); ?> |
+ nodes_bypool($spo)); ?> |
+ vols_bypool($spo)); ?> |
+ file_bypool($spo),0); ?> |
+ logmb_bypool($spo),0); ?> |
+
+
+
+
+
diff --git a/application/views/domain/stgpools.php b/application/views/domain/stgpools.php
deleted file mode 100644
index f69b34b..0000000
--- a/application/views/domain/stgpools.php
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
- Storage Pools used by nodes in this Domain |
-
-
- |
-
-
- Storage Pool |
- Scr Use |
- Scr Avl |
- Access |
- Rec % |
- Util % |
- Migr % |
- High/Low |
- Next |
- Nodes |
- Vols |
- Files |
- MB |
-
- load('config')->tsmdatatypes as $btype => $ctype) { ?>
-
- |
-
- load('config')->tsmpooltypes as $type) { ?>
-
- |
- |
-
- getStoragePoolsType($btype,$type) as $spo) { ?>
-
- |
- STGPOOL_NAME,$spo->display('STGPOOL_NAME')); ?> |
- display('NUMSCRATCHUSED'); ?> |
- display('MAXSCRATCH'); ?> |
- display('ACCESS'); ?> |
- display('RECLAIM'); ?> |
- display('PCT_UTILIZED'); ?> |
- display('PCT_MIGR'); ?> |
- HIGHMIG,$spo->LOWMIG); ?> |
- NEXTSTGPOOL ? HTML::anchor('stgpool/detail/'.$spo->NEXTSTGPOOL,$spo->display('NEXTSTGPOOL')) : ' '; ?> |
- getStorageModeNodes($btype,$type,$spo)); ?> |
- getStorageModeVols($ctype,$type,$spo)); ?> |
- getStorageModeFiles($btype,$type,$spo); ?> |
- getStorageModeData($btype,$type,$spo); ?> |
-
-
-
-
-
diff --git a/application/views/domain/volumes.php b/application/views/domain/volumes.php
index e4bf323..441996a 100644
--- a/application/views/domain/volumes.php
+++ b/application/views/domain/volumes.php
@@ -1,55 +1,51 @@
-
-
- Sequential Volumes needed to restore Data for Nodes in this Domain |
-
-
- |
-
-
- Volume |
- Status |
- Access |
- Scr |
- Pct % |
- Rec % |
- Mounted |
- R/W Err |
- FS |
- Nodes |
- Location |
-
+
load('config')->tsmdatatypes as $btype => $ctype) { ?>
-
- |
+
+
+
+
+ |
+
+ vols_bybtype($ctype)) { ?>
+
+ |
+
+
+ Volume |
+ Last Read Date |
+ Last Write Date |
+ Access |
+ Status |
+ Errors R/W |
+ Util % |
+ Recl % |
+ FS |
+ Nodes |
+
+ stgpools_bybtype($ctype) as $spo) { ?>
+ STGPOOL_NAME,$spo->RECLAIM,$spo->NUMSCRATCHUSED,$spo->MAXSCRATCH,$spo->DEVCLASSES->DEVTYPE); ?> |
+ vols_bypoolbybtype($spo->STGPOOL_NAME,$ctype) as $vuo) {
+ $vo = $vuo->VOLUME; ?>
+
+ VOLUME_NAME,$vo->display('VOLUME_NAME')); ?> |
+ display('LAST_READ_DATE'); ?> |
+ display('LAST_WRITE_DATE'); ?> |
+ display('ACCESS'); ?> |
+ display('STATUS'); ?> |
+ READ_ERRORS,$vo->WRITE_ERRORS); ?> |
+ display('PCT_UTILIZED'); ?> |
+ display('PCT_RECLAIM'); ?> |
+ fs_bybtype($ctype)); ?> |
+ nodes_bybtype($ctype)); ?> |
+
+
+
+
+ |
+
+
+ |
- load('config')->tsmpooltypes as $type) { ?>
-
- |
- |
-
- getStoragePoolsType($btype,$type) as $spo) { ?>
-
- |
- DISPLAY('STGPOOL_NAME'); ?> |
-
- getStorageModeVols($ctype,$type,$spo) as $vuo) { ?>
-
- |
- VOLUME_NAME,$vuo->display('VOLUME_NAME')); ?> |
- VOLUME->display('STATUS'); ?> |
- VOLUME->display('ACCESS'); ?> |
- VOLUME->isScratch() ? 'Y' : 'N'; ?> |
- VOLUME->display('PCT_UTILIZED'); ?> |
- VOLUME->display('PCT_RECLAIM'); ?> |
- VOLUME->display('TIMES_MOUNTED'); ?> |
- VOLUME->READ_ERRORS,$vuo->VOLUME->WRITE_ERRORS); ?> |
- VOLUME->getFSOnVol($ctype); ?> |
- VOLUME->getNodesOnVol($ctype); ?> |
- VOLUME->location(); ?> |
-
-
-
-
diff --git a/application/views/library/drives.php b/application/views/library/drives.php
index 9c068c6..d016ed3 100644
--- a/application/views/library/drives.php
+++ b/application/views/library/drives.php
@@ -13,7 +13,7 @@
State |
Volume |
- DRIVE->find_all() as $do) { ?>
+ DRIVE->find_all() as $do) { ?>
display('DRIVE_NAME'); ?> |
display('DRIVE_SERIAL'); ?> |
diff --git a/application/views/node/filesystems.php b/application/views/node/filesystems.php
index 7b4297d..9770073 100644
--- a/application/views/node/filesystems.php
+++ b/application/views/node/filesystems.php
@@ -7,7 +7,7 @@
Information |
- getStoragePools($btype)) { ?>
+ vols_bybtype($ctype)) { ?>
|
@@ -15,21 +15,17 @@
File Space |
|
Utilisation |
- load('config')->tsmpooltypes as $type)
- if (count($pools = $o->getStoragePoolsType($btype,$type)))
- foreach ($pools as $pool_name) { ?>
- |
+ stgpools() as $spo) { ?>
+ display('STGPOOL_NAME'); ?> display('POOLTYPE'); ?> |
- FILESPACE->find_all() as $fso) { ?>
+ fs() as $fso) { ?>
display('FILESPACE_NAME'); ?> |
display('BACKUP_END') : ' '; ?> |
utilsation(),2); ?> |
- load('config')->tsmpooltypes as $type)
- if (count($pools = $o->getStoragePoolsType($btype,$type)))
- foreach ($pools as $pool_name) { ?>
- pool_logical_util($pool_name,$btype),2); ?> (pool_numvols($pool_name,$ctype); ?>) |
+ stgpools() as $spo) { ?>
+ pool_logical_util($spo->STGPOOL_NAME,$btype),2); ?> (pool_numvols($spo->STGPOOL_NAME,$ctype); ?>) |
diff --git a/application/views/node/info.php b/application/views/node/info.php
index 07f1338..58223c5 100644
--- a/application/views/node/info.php
+++ b/application/views/node/info.php
@@ -20,7 +20,7 @@
TSM Client Version |
- tsmclientversion(); ?> |
+ version(); ?> |
|
diff --git a/application/views/node/stgpool_summary.php b/application/views/node/stgpool_summary.php
index 11ae4d5..b788d10 100644
--- a/application/views/node/stgpool_summary.php
+++ b/application/views/node/stgpool_summary.php
@@ -1,32 +1,32 @@
- Storage Summary |
+ Storage By Pool Summary |
|
- Storage Type |
+ Storage Pool and Type |
Vols |
Files |
MB |
- load('config')->tsmpooltypes as $type) { ?>
+ stgpooltypes() as $type) { ?>
|
getStorageTypeVols($type)); ?> |
- getStorageTypeFiles($type); ?> |
- getStorageTypeData($type); ?> |
+ file_byptype($type),0); ?> |
+ logmb_byptype($type),0); ?> |
- getAllStoragePoolsType($type) as $spo) { ?>
+ stgpools_byptype($type) as $spo) { ?>
|
|
- getStorageTypeVols($type,$spo)); ?> |
- getStorageTypeFiles($type,$spo); ?> |
- getStorageTypeData($type,$spo); ?> |
+ vols_bypool($spo)); ?> |
+ file_bypool($spo),0); ?> |
+ logmb_bypool($spo),0); ?> |
-
+
diff --git a/application/views/node/volumes.php b/application/views/node/volumes.php
index 6407002..4ec9034 100644
--- a/application/views/node/volumes.php
+++ b/application/views/node/volumes.php
@@ -7,7 +7,7 @@
|
- volumes($ctype)) { ?>
+ vols_bybtype($ctype)) { ?>
|
@@ -19,14 +19,14 @@
Status |
Errors R/W |
Util % |
- Reclaim |
+ Recl % |
Other FS |
Other Node |
- volumes($ctype) as $stgpool => $vols) {
- $spo = ORM::factory('STGPOOL',$stgpool); ?>
+ stgpools_bybtype($ctype) as $spo) { ?>
STGPOOL_NAME,$spo->RECLAIM,$spo->NUMSCRATCHUSED,$spo->MAXSCRATCH,$spo->DEVCLASSES->DEVTYPE); ?> |
-
+ vols_bypoolbybtype($spo->STGPOOL_NAME,$ctype) as $vuo) {
+ $vo = $vuo->VOLUME; ?>
VOLUME_NAME,$vo->display('VOLUME_NAME')); ?> |
display('LAST_READ_DATE'); ?> |
@@ -34,21 +34,18 @@
display('ACCESS'); ?> |
display('STATUS'); ?> |
READ_ERRORS,$vo->WRITE_ERRORS); ?> |
- display('EST_CAPACITY_MB'); ?> |
+ display('PCT_UTILIZED'); ?> |
display('PCT_RECLAIM'); ?> |
- getFSOnVol($ctype); ?> |
- getNodesOnVol($ctype); ?> |
+ fs_bybtype($ctype))-1; ?> |
+ nodes_bybtype($ctype))-1; ?> |
-
+
|
-
-
- |
diff --git a/application/views/stgpool/volumes.php b/application/views/stgpool/volumes.php
index 6efd475..7be2c12 100644
--- a/application/views/stgpool/volumes.php
+++ b/application/views/stgpool/volumes.php
@@ -31,8 +31,8 @@
display('PCT_UTILIZED'); ?> |
display('PCT_RECLAIM'); ?> |
load('config')->tsmdatatypes as $btype => $ctype) { ?>
- getFSOnVol($ctype); ?> |
- getNodesOnVol($ctype); ?> |
+ fs_bybtype($ctype)); ?> |
+ nodes_bybtype($ctype)); ?> |
diff --git a/index.php b/index.php
index 3d8a872..c7bb26f 100644
--- a/index.php
+++ b/index.php
@@ -1,11 +1,131 @@
= 5.3, it is recommended to disable
+ * deprecated notices. Disable with: E_ALL & ~E_DEPRECATED
+ */
+error_reporting(E_ALL | E_STRICT);
+
+/**
+ * End of standard configuration! Changing any of the code below should only be
+ * attempted by those with a working knowledge of Kohana internals.
+ *
+ * @link http://kohanaframework.org/guide/using.configuration
*/
-# You should secure your application by making the htdocs/ your docroot.
-header('Location: htdocs/index.php');
-die();
-?>
+// Set the full path to the docroot
+define('DOCROOT', realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR);
+
+// Make the application relative to the docroot, for symlink'd index.php
+if ( ! is_dir($application) AND is_dir(DOCROOT.$application))
+ $application = DOCROOT.$application;
+
+// Make the modules relative to the docroot, for symlink'd index.php
+if ( ! is_dir($modules) AND is_dir(DOCROOT.$modules))
+ $modules = DOCROOT.$modules;
+
+// Make the system relative to the docroot, for symlink'd index.php
+if ( ! is_dir($sysmodules) AND is_dir(DOCROOT.$sysmodules))
+ $sysmodules = DOCROOT.$sysmodules;
+
+// Make the system relative to the docroot, for symlink'd index.php
+if ( ! is_dir($system) AND is_dir(DOCROOT.$system))
+ $system = DOCROOT.$system;
+
+// Define the absolute paths for configured directories
+define('APPPATH', realpath($application).DIRECTORY_SEPARATOR);
+define('MODPATH', realpath($modules).DIRECTORY_SEPARATOR);
+define('SMDPATH', realpath($sysmodules).DIRECTORY_SEPARATOR);
+define('SYSPATH', realpath($system).DIRECTORY_SEPARATOR);
+
+// Clean up the configuration vars
+unset($application, $modules, $sysmodules, $system);
+
+if (file_exists('install'.EXT))
+{
+ // Load the installation check
+ return include 'install'.EXT;
+}
+
+/**
+ * Define the start time of the application, used for profiling.
+ */
+if ( ! defined('KOHANA_START_TIME'))
+{
+ define('KOHANA_START_TIME', microtime(TRUE));
+}
+
+/**
+ * Define the memory usage at the start of the application, used for profiling.
+ */
+if ( ! defined('KOHANA_START_MEMORY'))
+{
+ define('KOHANA_START_MEMORY', memory_get_usage());
+}
+
+// Bootstrap the application
+require APPPATH.'bootstrap'.EXT;
+
+if (PHP_SAPI == 'cli') // Try and load minion
+{
+ class_exists('Minion_Task') OR die('Please enable the Minion module for CLI support.');
+ set_exception_handler(array('Minion_Exception', 'handler'));
+
+ Minion_Task::factory(Minion_CLI::options())->execute();
+}
+else
+{
+ /**
+ * Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
+ * If no source is specified, the URI will be automatically detected.
+ */
+ echo Request::factory(TRUE, array(), FALSE)
+ ->execute()
+ ->send_headers(TRUE)
+ ->body();
+}
diff --git a/kh.php b/kh.php
deleted file mode 100644
index c7bb26f..0000000
--- a/kh.php
+++ /dev/null
@@ -1,131 +0,0 @@
-= 5.3, it is recommended to disable
- * deprecated notices. Disable with: E_ALL & ~E_DEPRECATED
- */
-error_reporting(E_ALL | E_STRICT);
-
-/**
- * End of standard configuration! Changing any of the code below should only be
- * attempted by those with a working knowledge of Kohana internals.
- *
- * @link http://kohanaframework.org/guide/using.configuration
- */
-
-// Set the full path to the docroot
-define('DOCROOT', realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR);
-
-// Make the application relative to the docroot, for symlink'd index.php
-if ( ! is_dir($application) AND is_dir(DOCROOT.$application))
- $application = DOCROOT.$application;
-
-// Make the modules relative to the docroot, for symlink'd index.php
-if ( ! is_dir($modules) AND is_dir(DOCROOT.$modules))
- $modules = DOCROOT.$modules;
-
-// Make the system relative to the docroot, for symlink'd index.php
-if ( ! is_dir($sysmodules) AND is_dir(DOCROOT.$sysmodules))
- $sysmodules = DOCROOT.$sysmodules;
-
-// Make the system relative to the docroot, for symlink'd index.php
-if ( ! is_dir($system) AND is_dir(DOCROOT.$system))
- $system = DOCROOT.$system;
-
-// Define the absolute paths for configured directories
-define('APPPATH', realpath($application).DIRECTORY_SEPARATOR);
-define('MODPATH', realpath($modules).DIRECTORY_SEPARATOR);
-define('SMDPATH', realpath($sysmodules).DIRECTORY_SEPARATOR);
-define('SYSPATH', realpath($system).DIRECTORY_SEPARATOR);
-
-// Clean up the configuration vars
-unset($application, $modules, $sysmodules, $system);
-
-if (file_exists('install'.EXT))
-{
- // Load the installation check
- return include 'install'.EXT;
-}
-
-/**
- * Define the start time of the application, used for profiling.
- */
-if ( ! defined('KOHANA_START_TIME'))
-{
- define('KOHANA_START_TIME', microtime(TRUE));
-}
-
-/**
- * Define the memory usage at the start of the application, used for profiling.
- */
-if ( ! defined('KOHANA_START_MEMORY'))
-{
- define('KOHANA_START_MEMORY', memory_get_usage());
-}
-
-// Bootstrap the application
-require APPPATH.'bootstrap'.EXT;
-
-if (PHP_SAPI == 'cli') // Try and load minion
-{
- class_exists('Minion_Task') OR die('Please enable the Minion module for CLI support.');
- set_exception_handler(array('Minion_Exception', 'handler'));
-
- Minion_Task::factory(Minion_CLI::options())->execute();
-}
-else
-{
- /**
- * Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
- * If no source is specified, the URI will be automatically detected.
- */
- echo Request::factory(TRUE, array(), FALSE)
- ->execute()
- ->send_headers(TRUE)
- ->body();
-}