barcode) > 0); } $raw_media = get_all_media_by_library($user, $partitionId, $sortCriteria); $media = array(); if(strlen($filter) > 0) { $media = array_filter($raw_media, matches_filter); } else { $media = $raw_media; } // Don't include any media that are currently loaded in an // EDLM scanning drive, or any media with no label. $loaded_drives = get_all_drives($user, $sortCriteria); foreach($media as $k => $medium) { if($medium->slotType == "Drive") { foreach($loaded_drives as $drive) { if($drive->barcode == $medium->barcode && $drive->isEDLM) { unset($media[$k]); } } } if($medium->barcode == "No_Label") { unset($media[$k]); } } // Determine what types of media we can scan based on the // available EDLM drives. This should work all the way // to LTO-9, if we get that far... $drives = get_all_drives($user, new SortCriteria()); $allowed_media = array(false, false, false, false, false, false, false, false, false, false); foreach($drives as $drive) { if($drive->isEDLM) { $genchar = $drive->driveType[strlen($drive->driveType) - 1]; $gencode = intval($genchar); for($i = $gencode - 2; $i <= $gencode; $i++) { if($i < 0) $i = 0; // this won't happen $allowed_media[$i] = true; } } } $allowed_suffixes = array(); $WORM_codes = array("_", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"); for($i = 0; $i < count($allowed_media); $i++) { if($allowed_media[$i]) { $allowed_suffixes[] = ("L".$i); $allowed_suffixes[] = ("M".$i); $allowed_suffixes[] = ("L".$WORM_codes[$i]); } } // Determine if LME is available on an EDLM partition $libs = get_logical_libraries($user, $sortCriteria); $edlmHasLME = false; foreach($libs as $lib) { if($lib->libraryManaged) { $ekmData = get_partition_enryption($user, $lib->guid); if($ekmData->method == 4) { $edlmHasLME = true; break; } } } function edlm_supported($medium) { global $allowed_suffixes; global $edlmHasLME; $barcode = $medium->barcode; // Can't scan cleaning tapes if(startsWith($barcode, "CLN")) { return false; } // Can't scan encrypted tapes if we don't have an LME-enabled // edlm partition. if(!$edlmHasLME && ($medium->encryption == 2)) { return false; } // Can only scan tapes of at most 2 gens back from installed // edlm drives. for($i = 0; $i < count($allowed_suffixes); $i++) { if(endsWith($barcode, $allowed_suffixes[$i])) { return true; } } return false; } $testResultMap = edlm_get_result_map(); ?> No media found.