registerFunction("getEKMPartitions"); session_start(); $user = $_SESSION['user']; $in_xAjax = false; $xAjax_objResponse; include('IOB_inc.htm'); include('common_admin_inc.htm'); $akmResult = akm_get_error_codes(); //error_log("akm_get_errorcodes = ". print_r($akmResult,true) ); class EKMdata { var $primaryIP; var $primaryPort; // default is 3801 (decimal) var $secondaryIP; var $secondaryPort; // default is 3801 (decimal) var $useSSL; function EKMdata( $primaryIP, $primaryPort, $secondaryIP, $secondaryPort, $ssl ) { $this->primaryIP = $primaryIP; $this->primaryPort = $primaryPort; $this->secondaryIP = $secondaryIP; $this->secondaryPort = $secondaryPort; $this->useSSL = $ssl; } }; class Encryption { var $libGuid; var $method; var $policy; var $density; var $key_path; var $method_not_used; var $policy_not_used; function Encryption( $libGuid, $method, $policy, $density, $key_path, $method_not_used, $policy_not_used) { $this->libGuid = $libGuid; $this->method = $method; $this->policy = $policy; $this->density = $density; $this->key_path = $key_path; $this->method_not_used = $method_not_used; $this->policy_not_used = $policy_not_used; } }; // The php function that is called from JavaScript tough xAjax when the user selects a I/O Blade. function getEKMPartitions($aBladeID) { global $in_xAjax; $user = $_SESSION['user']; $xAjax_objResponse = new xajaxResponse(); /// $in_xAjax = true; return $xAjax_objResponse; } $xajax->processRequest(); /*******************************************************************************************/ // Post needs this data also $libs = get_logical_libraries($user, $sortCriteria); //error_log("get_logical_libraries = ". print_r($libs,true) ); $lib_count = count($libs); // Handle the progress screen if opened and set the NEW data if ($_SERVER[REQUEST_METHOD] == "POST") { $operationInProgress = true; $status = new ReturnStatus(); error_log($_SERVER['PHP_SELF']." POST = ". print_r($_POST, true) ); $akmWasRan = false; $akm1st = true; foreach( $libs as $lib ) { // Construct the _POST variables to look for. $theMeth = "selMethod".$lib->name; $thePol = "selPolicy".$lib->name; $theServ = "serverType".$lib->name; // Did the setting for this LL change? if( $_POST[$theMeth] != $_POST[$lib->name] ) { if( isset( $_POST[$theMeth] ) ) { // Doubble check if any if this library's drives are loaded. $drives = get_all_drives_by_library($user, $lib->guid, $sortCriteria, (int)0,(int)MEDIA_TYPE_ANY); //error_log( "\nDrives = ". print_r($drives, true) ); foreach($drives as $drive ) { $disableIt = true; // Default to disabled incase it's not an LTO4 // If any Drive is loaded with a tape we need to disable the changing of the paritions encryption. if(($drive->driveType == 'LTO-4') && ($drive->name == $lib->name)) { // It's an LTO4 drive that might be capable of encryption //error_log("+-=-=-=- ". $drive->location . "= \n". print_r($drive,true) ); if($drive->active || $drive->mediaPresent == "1") { error_log("Disabling changing Encryption because Meida is present in one of the drives"); error_back(0x50021); } } } $method = $_POST[$theMeth]; if( isset( $_POST[$thePol] ) ) $policy = $_POST[$thePol]; else $policy = 0; // REQ-Change - undo anything done above with policy if( $method == 4 ) // Library Managed $policy = 2; else $policy = 0xff; //PCR 22652 (This was 0) // If QKM to LME - Make sure the servers are up $iAkmReady = true; $bSet = true; if( $method == 4 && $_POST['qkmEnabled']==true && $_POST[$theServ] == 2) { $iAkmReady = akm_servers_available($user, true); // $iAkmReady = (akm_servers_available($user) == 1); error_log("\nakm_servers_available returned: ". print_r($iAkmReady, true)); } // Don't run the setupServer call if QKM is being set to LME without both servers running. // Or if it's already been run this iteration. if( $iAkmReady ) { // This only needs called when setting QKM to LME if( $akm1st == true && $method == 4 && $_POST['qkmEnabled']==true && $_POST[$theServ] == 2) // Library Managed { error_log("A QKM parition is being set to LME........."); if( $iAkmReady ) { $akm1st = false; // Reset the flag so we only run this once. error_log("\n\n*** We are running the QKM setupServer call. ***\n\n"); $iRes = akm_setup_servers($user); do { // NOTE: The check progress may not be started when you call it the first time so t get around this I am doing the sleep before chacking the status. sleep(10); @reset_inactive_timer($user); $akmStatus = akm_setup_progress($user, 0); error_log("Looped - akm_setup_progress returned: ". print_r($akmStatus,true) ); }while( $akmStatus->status != $akmResult->StatusFinished ); error_log("\n\n\n>>>>>>>>>>>>>>>>>>>>>>>>> We have finished the progress check <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n\n\n"); error_log("\nakm_setup_progress returned: ". print_r($akmStatus,true) ); error_log("$akmStatus->status != $akmResult->StatusFinished"); if( $akmStatus->status != $akmResult->SUCCEEDED && $akmStatus->status != $akmResult->StatusFinished ) { $status->setErrorCode( $akmStatus->status ); $bSet = false; } if( $akmStatus->result == $akmResult->SetupSucceededKeysGenerated ) $akmWasRan = true; } else //!?! This is OLD code that will be needed when we don't need both server to set LME for QKM { error_log("The severs are not ready - so the setupServer call is being skipped and an error is being retunred."); $status->setErrorCode( $iAkmReady ); $bSet = false; } } if( $bSet ) { // !?! NOTE: When we do overrides this call will need to happen AFTER we set the new IP's error_log( "Setting encryption for library ". $lib->name. " | Method = ". $method ." | Policy = ". $policy ); $encypt = new Encryption( $lib->guid, (int)$method, (int)$policy, -1, -1, -1, -1 ); set_partition_enryption( $user, $encypt ); } else error_log(">>> NOT RUNNING set_partition_enryption because of error <<<"); } else error_log(">>> NOT RUNNING set_partition_enryption because qkm is not ready<<<"); } } else error_log("Encryption Method for ".$lib->name." did not change!"); //if( $Brand == 'dell' ) { // See if we need to save server Setting onl;y (We don't do overrides) error_log( "if('". $_POST["serverType".$lib->name] ."' != '". $_POST["serverTypeOrig".$lib->name]."');" ); if( isset($_POST["serverType".$lib->name]) && ($_POST["serverType".$lib->name] != $_POST["serverTypeOrig".$lib->name]) ) { error_log("We are saving set_ekm_by_library! for $lib->name"); + // Create some varliables so the code is easier to read. $thePaddr = $_POST["paddr_".$lib->name]; $thePport = (int)$_POST["pport_".$lib->name]; $theSaddr = $_POST["saddr_".$lib->name]; $theSport = (int)$_POST["sport_".$lib->name]; $theSSL = isset($_POST["ssl_".$lib->name]); $ekmPaddr = $_POST["ekmPHost".$lib->name]; $ekmPport = (int)$_POST["ekmPPort".$lib->name]; $ekmSaddr = $_POST["ekmSHost".$lib->name]; $ekmSport = (int)$_POST["ekmSPort".$lib->name]; $ekmSSL = $_POST["ekmSSL".$lib->name]; $servType = $_POST["serverType".$lib->name]; error_log( "\nthePaddr - ekmPaddr | thePport - ekmPport == theSaddr -ekmSaddr | theSport - ekmSport - servType" ); error_log( "\n". $thePaddr ." - ". $ekmPaddr ." | ". $thePport ." - ". $ekmPport ."\n". $theSaddr ." - ". $ekmSaddr ." | ". $theSport ." - ". $ekmSport ." - ". $servType."\n" ); //if( $thePaddr != $ekmPaddr || $thePport != $ekmPport || // $theSaddr != $ekmSaddr || $theSport != $ekmSport || $theSSL != $ekmSSL ) { error_log("There was a change in the Overrides for ".$lib->name."!"); //$ekmData = new EKMdata($thePaddr, $thePport, $theSaddr, $theSport, $theSSL); $ekmData = new EKMdata($ekmPaddr, $ekmPport, $ekmSaddr, $ekmSport, $ekmSSL); error_log("Setting library ". $lib->guid ." to serverType ". $servType ."\n". print_r($ekmData, true) ); set_ekm_by_library($user, $lib->guid, $ekmData, $servType); } //else // error_log("There was NO changes in the Overrides for ".$lib->name."!"); } else error_log("Server Type for ".$lib->name." did not change!"); }// if DELL }// for lib if( $akmWasRan == true ) { print $status->closeMsg(4, "akm_setup_servers was run" ); //print $status->qkm CheckStatus('finishLogDump', $fileName, $OpGuid); } else print $status->out(); return; } $ekm_data = get_ekm( $user, 1 ); $qkm_data = get_ekm( $user, 2 ); // get QKM Data error_log("\nekm_data = " . print_r($ekm_data, true) ); error_log("\nqkm_data = " . print_r($qkm_data, true) ); $isQKM = isQKMEnabled( $qkm_data ); error_log("isQKMEnabled returned a ". $isQKM?"true":"false"); $isQEKM = isQEKMEnabled( $ekm_data ); error_log("isQEKMEnabled returned a ". $isQEKM?"true":"false"); $ekmMax = get_ekm_drive_cnt($user); $akmStatus = @akm_setup_progress($user, 0); error_log("\nakm_setup_progress returned: ". print_r($akmStatus,true) ); error_log("$akmStatus->status != $akmResult->StatusFinished"); if( $akmStatus->status == $akmResult->StatusFinished || $akmStatus->status == $akmResult->StatusNotStarted ) $libBusy = false; else $libBusy = true; ?>
printJavascript(); ?>