From fe62c848c4da7c49ea7d98498ea7197aef2d4729 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sun, 26 Jun 2011 22:47:20 +1000 Subject: [PATCH] Library fixes for TSM6 --- application/classes/model/library.php | 2 +- application/classes/model/media.php | 4 + application/classes/model/stgpool.php | 2 +- application/config/database.php | 2 + htdocs/library.info.php | 166 -------------------------- lib/config_custom.php | 2 +- 6 files changed, 9 insertions(+), 169 deletions(-) delete mode 100644 htdocs/library.info.php diff --git a/application/classes/model/library.php b/application/classes/model/library.php index c679fc7..fb25b21 100644 --- a/application/classes/model/library.php +++ b/application/classes/model/library.php @@ -124,7 +124,7 @@ class Model_LIBRARY extends ORMTSM { foreach ($this->storagepools() as $spo) foreach ($spo->VOLUME->find_all() as $vo) - if ($vo->MEDIA->STATUS != 'MOUNTABLEINLIB') + if (! $vo->MEDIA->inlib()) array_push($result,$vo); Sort::masort($result,'VOLUME_NAME'); diff --git a/application/classes/model/media.php b/application/classes/model/media.php index 5a06346..7f9220f 100644 --- a/application/classes/model/media.php +++ b/application/classes/model/media.php @@ -20,5 +20,9 @@ class Model_MEDIA extends ORMTSM { ); protected $_has_many = array( ); + + public function inlib() { + return in_array($this->STATE,array('MOUNTABLEINLIB','Mountable in library')); + } } ?> diff --git a/application/classes/model/stgpool.php b/application/classes/model/stgpool.php index c08bb91..7f16ad4 100644 --- a/application/classes/model/stgpool.php +++ b/application/classes/model/stgpool.php @@ -33,7 +33,7 @@ class Model_STGPOOL extends ORMTSM { if (! isset($result[$inout])) foreach ($this->VOLUME->find_all() as $vo) { - $state = ($vo->MEDIA->STATE == 'MOUNTABLEINLIB') ? 'in' : 'out'; + $state = $vo->MEDIA->inlib() ? 'in' : 'out'; $result[$state][$vo->STATUS][] = $vo; } diff --git a/application/config/database.php b/application/config/database.php index ed37780..9ccc8c0 100644 --- a/application/config/database.php +++ b/application/config/database.php @@ -50,6 +50,7 @@ return array 'FILESPACES' => 1200, 'LIBRARIES' => 1200, 'LIBVOLUMES' => 1200, + 'MEDIA' => 1200, 'MGMTCLASSES' => 1200, 'NODES' => 1200, 'OCCUPANCY' => 1200, @@ -67,6 +68,7 @@ return array 'DRIVES' => 1200, 'LIBVOLUMES' => 1200, 'LIBRARIES' => 1200, + 'MEDIA' => 1200, 'NODES' => 1200, 'STGPOOLS' => 1200, 'VOLHISTORY' => 1200, diff --git a/htdocs/library.info.php b/htdocs/library.info.php deleted file mode 100644 index adcebf1..0000000 --- a/htdocs/library.info.php +++ /dev/null @@ -1,166 +0,0 @@ -getLibraries()) { - foreach ($libraries->getLibraries() as $library) { - - printf(_('Information on libraries %s.'),$library->getName()); - echo ''; - - # Does this library support show slots? - if (isset($library->slots)) { - - printf('', - $library->getAttr('ProductId'), - $library->getAttr('Slots'), - $library->getAttr('Drives')); - - # Show the drives - foreach ($library->getDrives() as $drive) { - printf('', - $drive->getName(), - $drive->volume ? sprintf('%s-%s',$drive->status,$drive->volume) : $drive->status); - } - echo ''; - - # Library Configuration - printf('', - $library->shared); - - printf('', - ($library->autolabel ? $library->autolabel : 'NO')); - - # Volume Details - printf('', - $library->getAttr('Slots') - count($library->slots)); - - printf('', - count($library->slotVolumes(true))+count($library->slotVolumes(false))); - - printf('', - count($library->slotVolumes(false))); - - printf('', - count($library->slotVolumes(true))); - - printf('', - count($library->getLibraryEmpty())); - - printf('', - count($library->getLibraryPending())); - - printf('', - count($library->getLibraryScratch())); - - echo ''; - - # Volumes in Library. - printf('', - _('The following volumes are currently in this library:')); - echo ''; - echo ''; - - } else { - printf('', - $library->type); - - # Show the drives - foreach ($library->getDrives() as $drive) { - printf('', - $drive->getName(), - $drive->volume ? sprintf('%s-%s',$drive->status,$drive->volume) : $drive->status); - } - echo ''; - } - echo '
'. - classValue(_('This is a %s library, with %s slots and %s drives.'),'value'). - ' 
 '. - classValue(_('Drive %s (Status %s).'),'value'). - ' 
 
 '. - classValue(_('%s shared library.'),'value'). - ' 
 '. - classValue(_('%s auto label.'),'value'). - ' 
 '. - classValue(_('%s slots with NO volumes.'),'value'). - ' 
 '. - classValue(_('%s volumes physically in this library.'),'value'). - ' 
 '. - classValue(_('%s volumes NOT checked in.'),'value'). - ' 
 '. - classValue(_('%s volumes are checked into this library.'),'value'). - ' 
  '. - classValue(_('%s EMPTY volumes.'),'value'). - ' 
  '. - classValue(_('%s PENDING volumes.'),'value'). - ' 
  '. - classValue(_('%s SCRATCH volumes.'),'value'). - ' 
 
%s
'; - echo ''; - - foreach ($library->slots as $slotnum => $slot) { - if (isset($slot['barcodelabel']) && strlen($slot['barcodelabel'])) - $volname = $slot['barcodelabel']; - elseif ($volumes->inElement($library->getName(),$slotnum)) - $volname = $volumes->inElement($library->getName(),$slotnum); - else - $volname = 'No Barcode Label'; - - if ($volname && isset($volumes->volumes[$volname]->status['library']) && $volumes->volumes[$volname]->status['library'] == 'Scratch') - echo ''; - elseif ($slot['status'] == 'Full') - echo ''; - else - echo ''; - - printf('', - $slotnum, - $slot['slot'], - $volname, - isset($volumes->volumes[$volname]->stgpool) ? $volumes->volumes[$volname]->stgpool : - (isset($volumes->volumes[$volname]->dbv['type']) ? $volumes->volumes[$volname]->dbv['type'] : ' '), - - isset($volumes->volumes[$volname]->status['volume']) ? sprintf('%s/%s',$volumes->volumes[$volname]->status['volume'],$volumes->volumes[$volname]->access) : - (isset($volumes->volumes[$volname]->dbv) ? - sprintf('%s.%s.%s',$volumes->volumes[$volname]->dbv['series'], - $volumes->volumes[$volname]->dbv['operation'],$volumes->volumes[$volname]->dbv['sequence']) : ' '), - - (isset($library->slots[$slotnum]['status']) && $library->slots[$slotnum]['status'] == 'Allocated') ? - isset($volumes->volumes[$volname]->status['library']) ? $volumes->volumes[$volname]->status['library'].'/'.$volumes->volumes[$volname]->lib['owner'] : ' ' : - _('*NOT CHECKED IN*'), - - (isset($volumes->volumes[$volname]->status['volume']) && $volumes->volumes[$volname]->status['volume'] == 'PENDING') ? - tsmDate($volumes->volumes[$volname]->pending['start'],'notime') : - isset($volumes->volumes[$volname]->utilisation) ? $volumes->volumes[$volname]->utilisation.'%' : ' ', - - isset($volumes->volumes[$volname]->stgpool) ? $stgpools->getReclaim($volumes->volumes[$volname]->stgpool).'%' : 'N/A', - - isset($volumes->volumes[$volname]->reclaim) ? $volumes->volumes[$volname]->reclaim.'%' : ' ', - - isset($volumes->volumes[$volname]->last['read']) ? tsmDate($volumes->volumes[$volname]->last['read'],'notime') : ' ', - isset($volumes->volumes[$volname]->last['write']) ? tsmDate($volumes->volumes[$volname]->last['write'],'notime') : - (isset($volumes->volumes[$volname]->dbv) ? tsmDate($volumes->volumes[$volname]->dbv['date'],'notime') : ' ')); - } - - echo '
SlotBarcode/Vol NameUsageStatus/AccessLibrary AccessUtilisationReclaimLast ReadLast Write
%s%s%s%s%s%s%s%s%s
 
'. - classValue(_('This is a %s library'),'value'). - ' 
 '. - classValue(_('Drive %s (Status %s).'),'value'). - ' 
 
'; - } -} else { - echo _('No Library'); - printf('
%s
', - _('There are no automated libraries defined to this TSM server.')); -} -?> diff --git a/lib/config_custom.php b/lib/config_custom.php index 65c7e98..185e439 100644 --- a/lib/config_custom.php +++ b/lib/config_custom.php @@ -21,7 +21,7 @@ $config->configDefinition('command','help',array( $config->configDefinition('command','libraryinfo',array( 'summary'=>'Library Info', 'desc'=>'Information on Automated Tape Libraries.', - 'default'=>'library.info')); + 'default'=>'redir&page=library')); $config->configDefinition('command','nodedetail',array( 'summary'=>'Node Detail', 'desc'=>'Detail of Node Storage Usage.',