Library fixes for TSM6

This commit is contained in:
Deon George 2011-06-26 22:47:20 +10:00
parent 9cfd1dc3df
commit fe62c848c4
6 changed files with 9 additions and 169 deletions

View File

@ -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');

View File

@ -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'));
}
}
?>

View File

@ -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;
}

View File

@ -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,

View File

@ -1,166 +0,0 @@
<?php
// $Header: /cvsroot/phptsmadmin/phpTSMadmin/htdocs/library.info.php,v 1.21 2008/08/14 06:44:39 wurley Exp $
# @todo: It would be nice, if show slots hasnt been run, that we display a message to run audit libr. Then we will know that slots are empty, and be able to show that correctly.
# Required Libraries
require './common.php';
# Data collection.
$libraries = objectCache('libraries');
$volumes = objectCache('volumes');
$stgpools = objectCache('stgps');
# Library
if ($libraries->getLibraries()) {
foreach ($libraries->getLibraries() as $library) {
printf(_('Information on libraries %s.'),$library->getName());
echo '<table width="100%" class="result" border=0>';
# Does this library support show slots?
if (isset($library->slots)) {
printf('<tr><td colspan=3>'.
classValue(_('This is a %s library, with %s slots and %s drives.'),'value').
'</td><td>&nbsp;</td></tr>',
$library->getAttr('ProductId'),
$library->getAttr('Slots'),
$library->getAttr('Drives'));
# Show the drives
foreach ($library->getDrives() as $drive) {
printf('<tr><td>&nbsp;</td><td colspan=2>'.
classValue(_('Drive %s (Status %s).'),'value').
'</td><td>&nbsp;</td></tr>',
$drive->getName(),
$drive->volume ? sprintf('%s-%s',$drive->status,$drive->volume) : $drive->status);
}
echo '<tr><td colspan=3>&nbsp;</td></tr>';
# Library Configuration
printf('<tr><td>&nbsp;</td><td colspan=2>'.
classValue(_('%s shared library.'),'value').
'</td><td>&nbsp;</td></tr>',
$library->shared);
printf('<tr><td>&nbsp;</td><td colspan=2>'.
classValue(_('%s auto label.'),'value').
'</td><td>&nbsp;</td></tr>',
($library->autolabel ? $library->autolabel : 'NO'));
# Volume Details
printf('<tr><td>&nbsp;</td><td colspan=2>'.
classValue(_('%s slots with NO volumes.'),'value').
'</td><td>&nbsp;</td></tr>',
$library->getAttr('Slots') - count($library->slots));
printf('<tr><td>&nbsp;</td><td colspan=2>'.
classValue(_('%s volumes physically in this library.'),'value').
'</td><td>&nbsp;</td></tr>',
count($library->slotVolumes(true))+count($library->slotVolumes(false)));
printf('<tr><td>&nbsp;</td><td colspan=2>'.
classValue(_('%s volumes NOT checked in.'),'value').
'</td><td>&nbsp;</td></tr>',
count($library->slotVolumes(false)));
printf('<tr><td>&nbsp;</td><td colspan=2>'.
classValue(_('%s volumes are checked into this library.'),'value').
'</td><td>&nbsp;</td></tr>',
count($library->slotVolumes(true)));
printf('<tr><td>&nbsp;</td><td>&nbsp;</td><td>'.
classValue(_('%s EMPTY volumes.'),'value').
'</td><td>&nbsp;</td></tr>',
count($library->getLibraryEmpty()));
printf('<tr><td>&nbsp;</td><td>&nbsp;</td><td>'.
classValue(_('%s PENDING volumes.'),'value').
'</td><td>&nbsp;</td></tr>',
count($library->getLibraryPending()));
printf('<tr><td>&nbsp;</td><td>&nbsp;</td><td>'.
classValue(_('%s SCRATCH volumes.'),'value').
'</td><td>&nbsp;</td></tr>',
count($library->getLibraryScratch()));
echo '<tr><td colspan=4>&nbsp;</td></tr>';
# Volumes in Library.
printf('<tr><td colspan=3>%s</td></tr>',
_('The following volumes are currently in this library:'));
echo '<tr><td colspan=3><table width="100%" class="result_table" border=0>';
echo '<tr><td class="heading">Slot</td><td class="heading">Barcode/Vol Name</td><td class="heading">Usage</td><td class="heading">Status/Access</td><td class="heading">Library Access</td><td class="heading">Utilisation</td><td class="heading">Reclaim</td><td class="heading">Last Read</td><td class="heading">Last Write</td></tr>';
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 '<tr class="highlight">';
elseif ($slot['status'] == 'Full')
echo '<tr class="shadow">';
else
echo '<tr class="'.(@$counter++%2==0?'even':'odd').'">';
printf('<td><acronym title="Element: %s">%s</acronym></td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td><acronym title="Storage Pool Reclaim: %s">%s</acronym></td><td>%s</td><td>%s</td></tr>',
$slotnum,
$slot['slot'],
$volname,
isset($volumes->volumes[$volname]->stgpool) ? $volumes->volumes[$volname]->stgpool :
(isset($volumes->volumes[$volname]->dbv['type']) ? $volumes->volumes[$volname]->dbv['type'] : '&nbsp;'),
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']) : '&nbsp;'),
(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'] : '&nbsp;' :
_('*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.'%' : '&nbsp;',
isset($volumes->volumes[$volname]->stgpool) ? $stgpools->getReclaim($volumes->volumes[$volname]->stgpool).'%' : 'N/A',
isset($volumes->volumes[$volname]->reclaim) ? $volumes->volumes[$volname]->reclaim.'%' : '&nbsp;',
isset($volumes->volumes[$volname]->last['read']) ? tsmDate($volumes->volumes[$volname]->last['read'],'notime') : '&nbsp;',
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') : '&nbsp;'));
}
echo '</table></td></tr>';
echo '<tr><td colspan=3>&nbsp;</td></tr>';
} else {
printf('<tr><td colspan=2>'.
classValue(_('This is a %s library'),'value').
'</td><td>&nbsp;</td></tr>',
$library->type);
# Show the drives
foreach ($library->getDrives() as $drive) {
printf('<tr><td>&nbsp;</td><td>'.
classValue(_('Drive %s (Status %s).'),'value').
'</td><td>&nbsp;</td></tr>',
$drive->getName(),
$drive->volume ? sprintf('%s-%s',$drive->status,$drive->volume) : $drive->status);
}
echo '<tr><td colspan=3>&nbsp;</td></tr>';
}
echo '</table>';
}
} else {
echo _('No Library');
printf('<table><tr><td colspan=3>%s</td></tr></table>',
_('There are no automated libraries defined to this TSM server.'));
}
?>

View File

@ -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.',