(file) Return to ServerProcessOS400.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Service / Attic

Diff for /pegasus/src/Service/Attic/ServerProcessOS400.cpp between version 1.2 and 1.11

version 1.2, 2005/03/10 23:23:12 version 1.11, 2007/05/08 18:30:52
Line 1 
Line 1 
 //%2005////////////////////////////////////////////////////////////////////////  //%2006////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
Line 8 
Line 8 
 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 // EMC Corporation; VERITAS Software Corporation; The Open Group. // EMC Corporation; VERITAS Software Corporation; The Open Group.
   // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
   // EMC Corporation; Symantec Corporation; The Open Group.
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to // of this software and associated documentation files (the "Software"), to
Line 27 
Line 29 
 // //
 //============================================================================== //==============================================================================
 // //
 // Author: Diane Olson (dianeols@us.ibm.com)  
 //  
 // Modified By: Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com)  
 //  
 // Modified By: Dave Rosckes (rosckes@us.ibm.com)  
 //  
 // Modified By: Bert Rivero (hurivero@us.ibm.com)  
 //  
 //  
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
 #include <sys/types.h> #include <sys/types.h>
 #include <sys/stat.h> #include <sys/stat.h>
 #include <fcntl.h> #include <fcntl.h>
 #include <unistd.h> #include <unistd.h>
   #include <sys/wait.h>
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
 #include <Pegasus/Common/String.h> #include <Pegasus/Common/String.h>
 #include <Pegasus/Common/Logger.h> #include <Pegasus/Common/Logger.h>
   #include <Pegasus/Config/ConfigManager.h>
 #include "OS400ConvertChar.h" #include "OS400ConvertChar.h"
   #include "SSLWrapperOS400.h"
   #include "OS400SystemState.h"
   #include "CIMRepositoryUpdate400.h"  // upgrade utility
 #include <Pegasus/Common/MessageLoader.h> //l10n #include <Pegasus/Common/MessageLoader.h> //l10n
 #include <except.h> #include <except.h>
  
Line 86 
Line 84 
 // no-ops // no-ops
 void ServerProcess::notify_parent(int id) {} void ServerProcess::notify_parent(int id) {}
 void ServerProcess::cimserver_set_process(void* p) {} void ServerProcess::cimserver_set_process(void* p) {}
 long ServerProcess::get_server_pid(void) { return 0; }  
 void ServerProcess::set_parent_pid(int pid) {}  
 int ServerProcess::get_proc(int pid) { return 0; }  
 int ServerProcess::cimserver_wait(void) { return 1; } int ServerProcess::cimserver_wait(void) { return 1; }
 String ServerProcess::getHome(void) { return String::EMPTY; } String ServerProcess::getHome(void) { return String::EMPTY; }
  
Line 105 
Line 100 
 /////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
 int ServerProcess::cimserver_fork(void) int ServerProcess::cimserver_fork(void)
 { {
     // First migrate the server configuration settings into the planned file.
     CIMRepositoryUpdate400 obj;
     obj.preserveConfigSettings();
   
     // TODO:  This is here for now until we can move it into initialize.  Right now it doesn't run because qycmsetupr won't work in a multi-threaded environment.  See issue #AD2
     obj.doIt();
   
 #pragma convert(37) #pragma convert(37)
   char rc5[3] = "05"; // rc5 means the CIMOM Server failed to start   char rc5[3] = "05"; // rc5 means the CIMOM Server failed to start
   char cppServ[10] = "QYCMCIMOM";   char cppServ[10] = "QYCMCIMOM";
Line 177 
Line 179 
 //       so that iNavigator can start/stop it. //       so that iNavigator can start/stop it.
 //    -- Swaps the job user to QSYS. //    -- Swaps the job user to QSYS.
 //    -- Changes the authority of QYCMJOBD //    -- Changes the authority of QYCMJOBD
   //    -- Calls the upgrade utility
 //////////////////////////////////////////////////// ////////////////////////////////////////////////////
 int ServerProcess::cimserver_initialize(void) int ServerProcess::cimserver_initialize(void)
 { {
Line 189 
Line 192 
    //        (it's a known problem) and we can uncomment this #pragma.    //        (it's a known problem) and we can uncomment this #pragma.
 //   #pragma cancel_handler (CancelHandler, NULL) //   #pragma cancel_handler (CancelHandler, NULL)
     try {     try {
    system ("QSYS/CHGJOB JOB(*) LOG(4 00 *SECLVL)");  
  
 #pragma convert(37) #pragma convert(37)
    //////////////////////////////////////////    //////////////////////////////////////////
Line 226 
Line 228 
    // Set the SQL server mode to true.    // Set the SQL server mode to true.
    // This will allow multiple connections to the same data source.    // This will allow multiple connections to the same data source.
    SQLSetEnvAttr(henv,SQL_ATTR_SERVER_MODE, &attr,0);    SQLSetEnvAttr(henv,SQL_ATTR_SERVER_MODE, &attr,0);
   
      //--------------------------------------------------
      // Create server SSL certificate and private key
      // if they do not already exist.
      //--------------------------------------------------
   
      // Check if SSL is enabled on the wbem-https port
      ConfigManager * configManager = ConfigManager::getInstance();
      Boolean enableHttpsConnection = ConfigManager::parseBooleanValue(
           configManager->getCurrentValue("enableHttpsConnection"));
      if (enableHttpsConnection)
      {
          // Initialize the OS400 OpenSSL wrapper.
          // This checks if the OpenSSL LPO is installed.
          // It also activates the OpenSSL *SRVPGM and gets exports.
          SSL_OS400_Init();
   
          // Create the certificate if needed
          // Get the location of the certificate
          String certPath;
          certPath = ConfigManager::getHomedPath(
               configManager->getCurrentValue("sslCertificateFilePath"));
   
          // Get the location of the private key
          String keyPath;
          keyPath = ConfigManager::getHomedPath(
               configManager->getCurrentValue("sslKeyFilePath"));
   
          SSL_CreateCert_OS400(keyPath, certPath);
      }
     }
     catch (Exception & e)
     {
         //l10n
         Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
                     e.getMessage());
         return(-1);
  }  }
   catch (...)   catch (...)
   {   {
Line 240 
Line 279 
       return(-1);       return(-1);
   }   }
  
   // TODO:  add this back in when we fix the problem with setupr not working in a multi-threaded environment.
     // Call into the upgrade utility.  This will perform any necessary upgrade step that need to be done.  The upgrade program keys off of marker files which are created on install.  This means that in most cases, nothing will be done unless the server is starting for the first time after an install.
   //  CIMRepositoryUpdate400 obj;
   //  obj.doIt();
   
    // TODO:  this is currently commented out because it causes build errors -    // TODO:  this is currently commented out because it causes build errors -
    //        it compiles just fine though.  Hopefully this problem will be fixed    //        it compiles just fine though.  Hopefully this problem will be fixed
    //        (it's a known problem) and we can uncomment this #pragma.    //        (it's a known problem) and we can uncomment this #pragma.
Line 248 
Line 292 
     return(0);     return(0);
 } }
  
 ///////////////////////////////////////////////////////////////////////  
 // cimserver_kill()  
 //  
 // The iSeries qycmctlcimCimomServer.C (QYCMCTLCIM program) code has  
 // already checked that the CIMOM server is already running prior to  
 // calling the CIMOM server (QYCMCIMOM) and telling it to shutdown.  
 // However, a check is still made in this method because we have to  
 // find the job number in order to kill the job.  
 //  
 // For iSeries, this method is called regardless of whether we took  
 // errors trying to connect to the server - if the CIMOM server job  
 // is anywhere on the system, in any state, this method will find it  
 // and kill it dead!!  
 //  
 // NEVER call this method unless the server is unable to be shut down  
 // gracefully.  
 ///////////////////////////////////////////////////////////////////////  
 int ServerProcess::cimserver_kill(int id)  
 {  // Need to kill the server  
 #pragma convert(37)  
   char rc2[3] = "02"; // CIMOM server failed to end  
   char cppServ[10] = "QYCMCIMOM";  
   
   // Construct a ycmJob object  
   ycmJob cppJob(YCMJOB_SRVNAME_10, YCMJOB_SRVUSER_10);  
   // Find the QYCMCIMOM job  
   char cppStatus  = cppJob.find(YCMJOB_ALL_NUMBERS);  
   
   if (cppStatus == YCMJOB_FOUND)       // CIMOM Server is Running  
   {  
     if (cppJob.end((char *)cppJob.getNumber().c_str(), 'C', 30) == YCMJOB_END_FAILED)  
     {  
   
       char chData[sizeof(rc2)+sizeof(cppServ)];  
       strcpy((char *)&chData,rc2);  
       strcat(chData,cppServ);  
   
       ycmMessage message("CPDDF81",  
                          chData,  
              strlen(chData),  
                          "cimserver_os400::cimserver_kill()",  
                          ycmCTLCIMID,  
              utf8);  
       message.joblogIt(UserError,ycmMessage::Diagnostic);  
   
 #pragma convert(0)  
   
       //l10n  
       //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,  
           //"cimserver_os400::cimserver_kill - FAILED to end the QYCMCIMOM job!!");  
     Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,  
             "src.Server.cimserver_os400.FAILED_TO_END_JOB",  
             "$0 FAILED to end the $1 job!!",  
             "cimserver_os400::cimserver_kill -",  
             "QYCMCIMOM");  
   
   
       return -1; // Note: this return code is ignored by the CIMOM server.  
     }  
   }  
   // The case of the job not found is already handled in QYCMCTLCIM program  
     return(0);  
 }  
   
 ////////////////////////////////////////////////////  
 //  Checks if the QYCMCIMOM server job is running.  
 ////////////////////////////////////////////////////  
 Boolean ServerProcess::isCIMServerRunning(void)  
 {  
 #pragma convert(37)  
   // Construct a ycmJob object  
   ycmJob cppJob(YCMJOB_SRVNAME_10, YCMJOB_SRVUSER_10);  
   
   // Find the QYCMCIMOM job  
   char cppStatus  = cppJob.find(YCMJOB_ALL_NUMBERS);  
   
   if (cppStatus == YCMJOB_FOUND)       // CIMOM Server is Running  
   {  
       return true;  
   }  
   
   return false;  
 #pragma convert(0)  
 }  
   
 //////////////////////////////////////////////////// ////////////////////////////////////////////////////
 //  Setup a fifo for process communication //  Setup a fifo for process communication
 //////////////////////////////////////////////////// ////////////////////////////////////////////////////
Line 378 
Line 337 
 //////////////////////////////////////////////////// ////////////////////////////////////////////////////
 // Platform specific run // Platform specific run
 //////////////////////////////////////////////////// ////////////////////////////////////////////////////
 int ServerProcess::platform_run( int argc, char** argv, Boolean shutdownOption )  int ServerProcess::platform_run(
       int argc,
       char** argv,
       Boolean shutdownOption,
       Boolean debugOutputOption)
 { {
     return cimserver_run( argc, argv, shutdownOption );      return cimserver_run(argc, argv, shutdownOption, debugOutputOption);
 } }
  


Legend:
Removed from v.1.2  
changed lines
  Added in v.1.11

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2