1, "h_wwnn" => 2, "h_type" => 333); $p_columnMap = array("p_name" => 1); $d_columnMap = array("d_partitionName" =>0, "d_location" =>1); $origAccessMap = array(); // Note: columnSize arrays are duped in hostAccessManagementList.htm (the must match) $h_columnSize = array( 4, 32, 32, 32 ); $p_columnSize = array( 4, 34, 34, 28 ); $d_columnSize = array( 4, 12, 16, 24, 12, 16, 16); if($_SERVER[REQUEST_METHOD] == "POST" ) { error_log("hostAccessConnectionList POST = ". print_r($_POST, true )); $status = new ReturnStatus(); //$operation = $_POST['operation']; //if($operation == "HostSelection") //{ // $Wwnn = $_POST['hostSelected']; // $accessList = get_host_mappings($user, $Wwnn); //} //else { $type = $_POST['type']; if( $type == 'Hosts') $sortCriteria = new SortCriteria($h_columnMap[$_POST['orderOn']], ($_POST['orderBy']=="ASC")?(1):(0)); else if( $type == 'Partitions') $sortCriteria = new SortCriteria($p_columnMap[$_POST['orderOn']], ($_POST['orderBy']=="ASC")?(1):(0)); else if ($type == 'Devices') $sortCriteria = new SortCriteria($d_columnMap[$_POST['orderOn']], ($_POST['orderBy']=="ASC")?(1):(0)); $sortCriteria->filterPattern = $_POST['filterPattern']; } } else { error_log("hostAccessConnectionList GET = ". print_r($_GET, true )); $type = $_GET['type']; if( $type == 'Hosts') $sortCriteria = new SortCriteria($h_columnMap["h_name"], "1"); else if ($type == 'Partitions') $sortCriteria = new SortCriteria($p_columnMap["p_name"], "1"); else if ($type == 'Devices') $sortCriteria = new SortCriteria($d_columnMap["d_partitionName"], "1"); $sortCriteria->filterPattern = ""; } $disabled = ''; // Leaving all checkbox's enabled for the time being $currentType = $type; $FiberChannel = 1; // from CMI::ConnectionPointCode $TapeDriveModel_LTO_5 = 9; // from eTapeDriveModel $operation = $_GET['operation']; error_log("hostAccessConnectionList.htm operation = " . print_r($operation, true)); if ($operation == 'HostSelection') { $Wwnn = $_GET['host']; //error_log("hostAccessConnectionList.htm Wwnn = " . print_r($Wwnn, true)); $accessListItems = get_host_mappings($user, $Wwnn); } if ($currentType == 'Partitions' ) { $libs = array(); $tmplibs = get_logical_libraries($user, $sortCriteria); foreach ($tmplibs as $tmplib) { $CP_drives = get_command_path_drives($user, $tmplib->guid); //error_log("hostAccessConnectionList.htm CP_drives = " . print_r($CP_drives, true)); if (count($CP_drives)) { $DPS_drives = array(); $tmp_drives = get_all_drives_by_library($user, $tmplib->guid, $sortCriteria,(int)0,(int)MEDIA_TYPE_ANY); foreach ($tmp_drives as $tmp_drive) { if (($tmp_drive->driveType == "LTO-5") && ($tmp_drive->vendor == "HP") && ($tmp_drive->interfaceType == "Fibre")) { array_push($DPS_drives, $tmp_drive); } } //error_log("hostAccessConnectionList.htm DPS_drives = " . print_r($DPS_drives, true)); // All CP drives must be DPS drives enabled for LUN mapping for this partition to be mappable. foreach ($CP_drives as $CP_drive) { $DPS = false; $DPSLicense = get_dps_license($user, $CP_drive); //error_log("hostAccessConnectionList.htm DPSLicense = " . print_r($DPSLicense, true)); if ($DPSLicense->LMEnabled == 1) //LUN mapping must be enabled for all control path drives to be mappable { foreach ($DPS_drives as $DPS_drive) { if ($DPS_drive->interfaceTypeEnum == $FiberChannel) { if ($DPS_drive->guid == $CP_drive) { $DPS = true; break; } } } } if ($DPS == false) break; } // if all CPs are DPs enabled for LUN mapping, this library will be added, now determine if the CPs are mapped if ($DPS) { $mapped = false; if (count($accessListItems)) // A host was selected and it returned an access list { foreach ($CP_drives as $CP_drive) { $accessMap = 0x0; $smcMap = 0x2; foreach ($accessListItems as $accessListItem) { if ($CP_drive == $accessListItem->guid) { $accessMap = $accessListItem->map; break; } } if ($accessMap & $smcMap) { $mapped = true; } else { $mapped = false; break; } } } // Define a ctor for this when time allows $theDPSlib = new DPSlib(); $theDPSlib->guid = $tmplib->guid; $theDPSlib->name = $tmplib->name; $theDPSlib->serialNumber = $tmplib->serialNumber; $theDPSlib->status = $tmplib->status; $theDPSlib->mapped = $mapped; array_push($libs, $theDPSlib); } } } $lib_count = count($libs); $numRows = $lib_count; $numPages = ceil($numRows / ITEMS_PER_PAGE); $lowPageList = 1; $highPageList = min($numRows, ITEMS_PER_PAGE); echo "\n"; error_log("hostConnectionList libs = ". print_r($libs,true) ); } else if ($currentType == 'Hosts') { $hosts = get_registered_hosts($user, $sortCriteria); $host_count = count($hosts); $numRows = $host_count; $numPages = ceil($numRows / ITEMS_PER_PAGE); $lowPageList = 1; $highPageList = min($numRows, ITEMS_PER_PAGE); echo "\n"; error_log( "hostAccessConnectionList hosts = ". print_r($hosts, true) ); } else if ($currentType == 'Devices') { $drives = array(); $tmpdrives = get_all_drives_by_type($user, (int)$TapeDriveModel_LTO_5, (int)$FiberChannel, $sortCriteria); foreach($tmpdrives as $tmpdrive) { $dpsLicense = get_dps_license($user, $tmpdrive->guid); if ((strcmp($tmpdrive->name, "Physical Library") != 0) && ($dpsLicense->LMEnabled)) { $accessMap = 0x0; if (count($accessListItems)) // A host was selected and it returned an access list { foreach ($accessListItems as $accessListItem) { if ($accessListItem->guid == $tmpdrive->guid) { $accessMap = $accessListItem->map; } } } // check if its a command path drive (library reports is not reliable) $isCPDrive = 0; $cpDrives = get_command_path_drives($user, $tmpdrive->libGuid); foreach ($cpDrives as $cpDrive) { //error_log("hostAccessConnectionList cpDrive = ".print_r($cpDrive,true)); if ($tmpdrive->guid == $cpDrive) { $isCPDrive = 1; break; } } //error_log("hostAccessConnectionList tmpdrive = ".print_r($tmpdrive,true)); $theDPSdrive = new DPSdrive(); $theDPSdrive->guid = $tmpdrive->guid; $theDPSdrive->name = $tmpdrive->name; $theDPSdrive->location = $tmpdrive->location; $theDPSdrive->serialNumber = $tmpdrive->serialNumber; $theDPSdrive->wwnn = $tmpdrive->wwnn; $theDPSdrive->status = $tmpdrive->status; $theDPSdrive->access = $accessMap; $theDPSdrive->isCommandPath = $isCPDrive; error_log("hostAccessConnectionList DPSdrive = ".print_r($theDPSdrive,true)); array_push($drives, $theDPSdrive); } } $dev_count = count($drives); $numRows = $dev_count; $numPages = ceil($numRows / ITEMS_PER_PAGE); $lowPageList = 1; $highPageList = min($numRows, ITEMS_PER_PAGE); echo "\n"; error_log("hostManagementConnectionList drives = ". print_r($drives,true) ); } ?>
include('pageIsLoaded_inc.htm'); ?>