|
|
|
@@ -33,7 +33,7 @@ class Model_LIBRARY extends ORMTSM {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Return a list of scratch volumes
|
|
|
|
|
public function scratch() {
|
|
|
|
|
public function scratchvol() {
|
|
|
|
|
$return = array();
|
|
|
|
|
|
|
|
|
|
foreach ($this->slots() as $slot)
|
|
|
|
@@ -44,7 +44,7 @@ class Model_LIBRARY extends ORMTSM {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Return a list of volumes that are readonly
|
|
|
|
|
public function readonly() {
|
|
|
|
|
public function readonlyvol() {
|
|
|
|
|
$return = array();
|
|
|
|
|
|
|
|
|
|
foreach ($this->slots() as $slot)
|
|
|
|
@@ -60,7 +60,7 @@ class Model_LIBRARY extends ORMTSM {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Return the slots that are used, but not checked in.
|
|
|
|
|
public function notcheckedin() {
|
|
|
|
|
public function notcheckedinvol() {
|
|
|
|
|
$return = array();
|
|
|
|
|
|
|
|
|
|
foreach ($this->slots() as $slot)
|
|
|
|
@@ -95,20 +95,22 @@ class Model_LIBRARY extends ORMTSM {
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Return a list of volumes
|
|
|
|
|
// $ptype is pool type (PRIMARY,ACTIVE,COPY)
|
|
|
|
|
// @param $inout IN|OUT of the library
|
|
|
|
|
// @param $status volume status FULL|FILLING|PENDING|EMPTY
|
|
|
|
|
// @note This is an intensive method that needs caching.
|
|
|
|
|
public function volstype($type,$inout,$status) {
|
|
|
|
|
/**
|
|
|
|
|
* Return a list of volumes
|
|
|
|
|
*
|
|
|
|
|
* @param $ptype is pool type (PRIMARY,ACTIVE,COPY)
|
|
|
|
|
* @param $inout IN|OUT of the library
|
|
|
|
|
* @param $status volume status FULL|FILLING|PENDING|EMPTY
|
|
|
|
|
* @note This is an intensive method that needs caching.
|
|
|
|
|
*/
|
|
|
|
|
public function volstype($ptype,$inout,$status) {
|
|
|
|
|
static $CACHE = array();
|
|
|
|
|
$ainout = array('in','out');
|
|
|
|
|
$astatus = array('FULL','FILLING','PENDING','EMPTY');
|
|
|
|
|
$ainout = array('IN','OUT');
|
|
|
|
|
|
|
|
|
|
if (! isset($CACHE[__METHOD__][$type]))
|
|
|
|
|
foreach ($this->storagepoolstype($type) as $spo)
|
|
|
|
|
if (! isset($CACHE[__METHOD__][$ptype]))
|
|
|
|
|
foreach ($this->storagepoolstype($ptype) as $spo)
|
|
|
|
|
foreach ($ainout as $cinout)
|
|
|
|
|
foreach ($astatus as $cstatus) {
|
|
|
|
|
foreach (Kohana::config('config.tsmvolstatus') as $cstatus) {
|
|
|
|
|
if (! isset($CACHE[__METHOD__][$spo->POOLTYPE][$cinout][$cstatus]))
|
|
|
|
|
$CACHE[__METHOD__][$spo->POOLTYPE][$cinout][$cstatus] = array();
|
|
|
|
|
|
|
|
|
@@ -116,7 +118,36 @@ class Model_LIBRARY extends ORMTSM {
|
|
|
|
|
array_merge($CACHE[__METHOD__][$spo->POOLTYPE][$cinout][$cstatus],$spo->libvolstype($cinout,$cstatus));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return isset($CACHE[__METHOD__][$type][$inout][$status]) ? $CACHE[__METHOD__][$type][$inout][$status] : array();
|
|
|
|
|
return isset($CACHE[__METHOD__][$ptype][$inout][$status]) ? $CACHE[__METHOD__][$ptype][$inout][$status] : array();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return a list of DB volumes
|
|
|
|
|
*
|
|
|
|
|
* @param $inout IN|OUT of the library
|
|
|
|
|
* @note This is an intensive method that needs caching.
|
|
|
|
|
*/
|
|
|
|
|
public function dbvolsloc($inout) {
|
|
|
|
|
static $CACHE = array();
|
|
|
|
|
|
|
|
|
|
if (! isset($CACHE[__METHOD__]))
|
|
|
|
|
foreach (ORM::factory('volhistory')->where('TYPE','IN',Kohana::config('config.tsmdbtypes'))->find_all() as $vho)
|
|
|
|
|
$CACHE[__METHOD__][$vho->LIBVOLUME ? 'IN' : 'OUT'][] = $vho;
|
|
|
|
|
|
|
|
|
|
return isset($CACHE[__METHOD__][$inout]) ? $CACHE[__METHOD__][$inout] : array();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Return a list of DB volumes by type
|
|
|
|
|
// @param $inout IN|OUT of the library
|
|
|
|
|
// @param $dtype is DB vole type (BACKUPFULL,BACKUPINCR,DBSNAPSHOT)
|
|
|
|
|
public function dbvolstype($inout,$dtype) {
|
|
|
|
|
$result = array();
|
|
|
|
|
|
|
|
|
|
foreach ($this->dbvolsloc($inout) as $vho)
|
|
|
|
|
if ($vho->TYPE ==$dtype)
|
|
|
|
|
array_push($result,$vho);
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function volsnotinlib() {
|
|
|
|
@@ -130,5 +161,28 @@ class Model_LIBRARY extends ORMTSM {
|
|
|
|
|
Sort::masort($result,'VOLUME_NAME');
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Volumes that are stale
|
|
|
|
|
public function stalevol() {
|
|
|
|
|
$result = array();
|
|
|
|
|
|
|
|
|
|
foreach ($this->storagepools() as $spo)
|
|
|
|
|
foreach ($spo->VOLUME->find_all() as $vo)
|
|
|
|
|
if ($vo->recycle())
|
|
|
|
|
array_push($result,$vo);
|
|
|
|
|
|
|
|
|
|
Sort::masort($result,'VOLUME_NAME');
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function removablelibvol() {
|
|
|
|
|
$result = array();
|
|
|
|
|
|
|
|
|
|
foreach ($this->slots() as $slot)
|
|
|
|
|
if ($slot->LIBVOLUME->removable())
|
|
|
|
|
array_push($result,$slot->LIBVOLUME);
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|