(file) Return to cimserver.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Server

Diff for /pegasus/src/Server/cimserver.cpp between version 1.161 and 1.172

version 1.161, 2005/05/05 20:24:31 version 1.172, 2005/11/27 03:11:38
Line 30 
Line 30 
 // Author: Mike Brasher (mbrasher@bmc.com) // Author: Mike Brasher (mbrasher@bmc.com)
 // //
 // Modified By: Mike Day (mdday@us.ibm.com) // Modified By: Mike Day (mdday@us.ibm.com)
 //  //              Karl Schopmeyer (k.schopmeyer@opengroup.org)
 // Modified By: Karl Schopmeyer (k.schopmeyer@opengroup.org)  //              Nag Boranna (nagaraja_boranna@hp.com)
 //  //              Jenny Yu (jenny_yu@hp.com)
 // Modified By: Nag Boranna (nagaraja_boranna@hp.com)  //              Sushma Fernandes (sushma_fernandes@hp.com)
 //  
 // Modified By: Jenny Yu (jenny_yu@hp.com)  
 //  
 // Modified By: Sushma Fernandes (sushma_fernandes@hp.com)  
 //              Carol Ann Krug Graves, Hewlett-Packard Company //              Carol Ann Krug Graves, Hewlett-Packard Company
 //                (carolann_graves@hp.com) //                (carolann_graves@hp.com)
 //      Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com) //      Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com)
 //  //              Dave Rosckes (rosckes@us.ibm.com)
 // Modified By: Dave Rosckes (rosckes@us.ibm.com)  //              Humberto Rivero (hurivero@us.ibm.com)
 //  //              Steve Hills (steve.hills@ncr.com)
 // Modified By: Humberto Rivero (hurivero@us.ibm.com)  
 //  
 // Modified By: Steve Hills (steve.hills@ncr.com)  
 //              Sean Keenan, Hewlett-Packard Company (sean.keenan@hp.com) //              Sean Keenan, Hewlett-Packard Company (sean.keenan@hp.com)
 //  //              Amit K Arora, IBM (amitarora@in.ibm.com) - pep 167
 // Modified By: Amit K Arora, IBM (amitarora@in.ibm.com) - pep 167  //              Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) - Bug#2555
 //  //              Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) - Bug#2032
 // Modified By: Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) - Bug#2555  //              Heather Sterling, IBM (hsterl@us.ibm.com) - PEP#222
 //  //              Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) - Bug#3452
 // Modified By: Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) - Bug#2032  //              David Dillard, VERITAS Software Corp.
 //  //                  (david.dillard@veritas.com)
 // Modified By: Heather Sterling, IBM (hsterl@us.ibm.com) - PEP#222  
 //  
 // Modified By: Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) - Bug#3452  
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
  
 ////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
 // //
 // Notes on deamon operation (Unix) and service operation (Win 32):  // Notes on daemon operation (Unix) and service operation (Win 32):
 // //
 // To run pegasus as a daemon on Unix platforms: // To run pegasus as a daemon on Unix platforms:
 // //
Line 113 
Line 103 
  
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
 #include <Pegasus/Common/Constants.h> #include <Pegasus/Common/Constants.h>
 #include <iostream>  #include <Pegasus/Common/PegasusAssert.h>
 #include <cassert>  
 #include <cstdlib> #include <cstdlib>
 #include <fstream>  
 #include <Pegasus/Common/FileSystem.h> #include <Pegasus/Common/FileSystem.h>
 #include <Pegasus/Common/Monitor.h> #include <Pegasus/Common/Monitor.h>
 #include <Pegasus/Common/PegasusVersion.h> #include <Pegasus/Common/PegasusVersion.h>
Line 201 
Line 189 
  
 AutoPtr<CIMServerProcess> _cimServerProcess(new CIMServerProcess()); AutoPtr<CIMServerProcess> _cimServerProcess(new CIMServerProcess());
 static CIMServer* _cimServer = 0; static CIMServer* _cimServer = 0;
   static Monitor* _monitor = 0;
   static Thread* dummyInitialThread = 0;
 // //
 //  The command name. //  The command name.
 // //
Line 334 
Line 323 
     {     {
         delete _cimServer;         delete _cimServer;
         _cimServer = 0;         _cimServer = 0;
   
   #if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_OS_LINUX) \
   || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || defined(PEGASUS_OS_AIX) \
   || defined(PEGASUS_OS_SOLARIS) || defined(PEGASUS_OS_VMS)
           //
           //  Remove the PID file to indicate CIMServer termination
           //
           FileSystem::removeFile(_cimServerProcess->getPIDFileName());
   #endif
       }
      if (_monitor)
      {
           delete _monitor;
      }
      if (dummyInitialThread)
      {
           Thread::clearLanguages();
           delete dummyInitialThread;
     }     }
 } }
  
Line 349 
Line 356 
    return((PEGASUS_THREAD_RETURN)0);    return((PEGASUS_THREAD_RETURN)0);
 } }
  
   //
   //  Waits until either the CIM Server has terminated, or the shutdown timeout
   //  has expired.  If the shutdown timeout has expired, and the CIM Server is
   //  still running, kills the cimserver process.
   //
   void _waitForTerminationOrTimeout (Uint32 maxWaitTime)
   {
       //
       //  If the CIM Server is still running, and the shutdown timeout has not
       //  expired, loop and wait one second until either the CIM Server has
       //  terminated, or the shutdown timeout has expired
       //
       Boolean running = _cimServerProcess->isCIMServerRunning ();
       while (running && (maxWaitTime > 0))
       {
           System::sleep (1);
           running = _cimServerProcess->isCIMServerRunning ();
           maxWaitTime--;
       }
   
       //
       //  If the shutdown timeout has expired, and the CIM Server is still
       //  running, kill the cimserver process
       //
       if (running)
       {
           int kill_rc = _cimServerProcess->cimserver_kill (0);
   
   #ifdef PEGASUS_OS_OS400
           if (kill_rc == -1)
           {
               _cimServerProcess->cimserver_exitRC (2);
           }
           _cimServerProcess->cimserver_exitRC (1);
   #endif
   
   #if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) \
   || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || defined(PEGASUS_OS_SOLARIS) \
   || defined (PEGASUS_OS_VMS)
           if (kill_rc != -1)
           {
               //l10n - TODO
               Logger::put_l (Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
                   "src.Server.cimserver.TIMEOUT_EXPIRED_SERVER_KILLED",
                   "Shutdown timeout expired.  Forced shutdown initiated.");
               MessageLoaderParms parms
                   ("src.Server.cimserver.TIMEOUT_EXPIRED_SERVER_KILLED",
                   "Shutdown timeout expired.  Forced shutdown initiated.");
               cout << MessageLoader::getMessage(parms) << endl;
               exit (0);
           }
   #endif
       }
   }
   
 void shutdownCIMOM(Uint32 timeoutValue) void shutdownCIMOM(Uint32 timeoutValue)
 { {
     //     //
Line 494 
Line 556 
                                      "Forced shutdown initiated.");                                      "Forced shutdown initiated.");
             PEGASUS_STD(cerr) << MessageLoader::getMessage(parms) << PEGASUS_STD(endl);             PEGASUS_STD(cerr) << MessageLoader::getMessage(parms) << PEGASUS_STD(endl);
         }         }
          PEGASUS_STD(cerr) << "Exit! " << endl;  
         exit(1);         exit(1);
 #endif #endif
     }     }
Line 507 
Line 568 
         // (client timeout value) to terminate, causing this client to         // (client timeout value) to terminate, causing this client to
         // timeout with a "connection timeout" exception.         // timeout with a "connection timeout" exception.
         //         //
         // Check to see if CIM Server is still running.  If CIM Server          //  Wait until either the CIM Server has terminated, or the shutdown
         // is still running and the shutdown timeout has not expired,          //  timeout has expired.  If the timeout has expired and the CIM Server
         // loop and wait one second until either the CIM Server is          //  is still running, kill the cimserver process.
         // terminated or timeout expires.  If timeout expires and  
         // the CIM Server is still running, kill the CIMServer process.  
         //         //
         Uint32 maxWaitTime = timeoutValue - 2;          _waitForTerminationOrTimeout (timeoutValue - 2);
         Boolean running = _cimServerProcess->isCIMServerRunning();  
         while ( running && maxWaitTime > 0 )  
         {  
             System::sleep(1);  
             running = _cimServerProcess->isCIMServerRunning();  
             maxWaitTime = maxWaitTime - 1;  
         }  
   
         if (running)  
         {  
        int kill_rc = _cimServerProcess->cimserver_kill(0);  
   
 #ifdef PEGASUS_OS_OS400  
         if(kill_rc == -1)  
         _cimServerProcess->cimserver_exitRC(2);  
         _cimServerProcess->cimserver_exitRC(1);  
 #endif  
   
 #if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) \  
 || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || defined(PEGASUS_PLATFORM_SOLARIS_SPARC_CC) \  
 || defined (PEGASUS_OS_VMS)  
         if (kill_rc != -1)  
             {  
                 //l10n - TODO  
                 Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,  
                     "src.Server.cimserver.TIMEOUT_EXPIRED_SERVER_KILLED",  
                     "Shutdown timeout expired.  Forced shutdown initiated.");  
                 MessageLoaderParms parms("src.Server.cimserver.TIMEOUT_EXPIRED_SERVER_KILLED",  
                     "Shutdown timeout expired.  Forced shutdown initiated.");  
                 cout << MessageLoader::getMessage(parms) << endl;  
                 exit(0);  
             }  
 #endif  
         }  
     }     }
  
       //
       //  InvokeMethod succeeded.
       //  Wait until either the CIM Server has terminated, or the shutdown
       //  timeout has expired.  If the timeout has expired and the CIM Server
       //  is still running, kill the cimserver process.
       //
       _waitForTerminationOrTimeout (timeoutValue);
     return;     return;
 } }
  
Line 613 
Line 645 
 #else #else
   #if defined(PEGASUS_OS_AIX) && defined(PEGASUS_USE_RELEASE_DIRS)   #if defined(PEGASUS_OS_AIX) && defined(PEGASUS_USE_RELEASE_DIRS)
     pegasusHome = AIX_RELEASE_PEGASUS_HOME;     pegasusHome = AIX_RELEASE_PEGASUS_HOME;
   #elif !defined(PEGASUS_USE_RELEASE_DIRS)    #elif !defined(PEGASUS_USE_RELEASE_DIRS) || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM)
     const char* tmp = getenv("PEGASUS_HOME");     const char* tmp = getenv("PEGASUS_HOME");
  
     if (tmp)     if (tmp)
Line 752 
Line 784 
     ConfigManager::setPegasusHome(pegasusHome);     ConfigManager::setPegasusHome(pegasusHome);
  
     //     //
     // Do the plaform specific run      // Do the platform specific run
     //     //
  
     return _cimServerProcess->platform_run( argc, argv, shutdownOption );     return _cimServerProcess->platform_run( argc, argv, shutdownOption );
Line 770 
Line 802 
 // will fail to shutdown properly/cleanly. // will fail to shutdown properly/cleanly.
 // //
 // TODO: Current change minimal for platform "service" shutdown bug fixes. // TODO: Current change minimal for platform "service" shutdown bug fixes.
 // Perhpas further extract out common stuff and put into main(), put  // Perhaps further extract out common stuff and put into main(), put
 // daemon stuff into platform specific platform_run(), etc. // daemon stuff into platform specific platform_run(), etc.
 // Note: make sure to not put error handling stuff that platform // Note: make sure to not put error handling stuff that platform
 // specific runs may need to deal with bettter (instead of exit(), etc).  // specific runs may need to deal with better (instead of exit(), etc).
 // //
  
 int CIMServerProcess::cimserver_run( int argc, char** argv, Boolean shutdownOption ) int CIMServerProcess::cimserver_run( int argc, char** argv, Boolean shutdownOption )
Line 807 
Line 839 
         os400StartupOption = true;         os400StartupOption = true;
         daemonOption = true;         daemonOption = true;
       }       }
   
       if (!os400StartupOption)
       {
           // If this is the server job, then set the job
           // to save the job log.
           system ("QSYS/CHGJOB JOB(*) LOG(4 00 *SECLVL)");
       }
 #endif #endif
  
     //     //
Line 1134 
Line 1173 
     // because this thread is not in a ThreadPool, but is used     // because this thread is not in a ThreadPool, but is used
     // to service CIM requests.     // to service CIM requests.
     // The run function for the dummy Thread should never be called,     // The run function for the dummy Thread should never be called,
     Thread *dummyInitialThread = new Thread(dummyThreadFunc, NULL, false);      dummyInitialThread = new Thread(dummyThreadFunc, NULL, false);
     Thread::setCurrent(dummyInitialThread);     Thread::setCurrent(dummyInitialThread);
     AcceptLanguages default_al;     AcceptLanguages default_al;
     try{     try{
Line 1165 
Line 1204 
     }     }
 #endif #endif
  
   #ifndef PEGASUS_OS_TYPE_WINDOWS
       umask(S_IRWXG|S_IRWXO);
   #endif
  
 #if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) \ #if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) \
 || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || defined(PEGASUS_OS_AIX) \ || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || defined(PEGASUS_OS_AIX) \
 || defined(PEGASUS_PLATFORM_SOLARIS_SPARC_CC) || defined (PEGASUS_OS_VMS)  || defined(PEGASUS_OS_SOLARIS) || defined (PEGASUS_OS_VMS)
     umask(S_IWGRP|S_IWOTH);  
  
     //     //
     // check if CIMServer is already running     // check if CIMServer is already running
Line 1200 
Line 1241 
     try     try
     {     {
  
     Monitor monitor;      _monitor  = new Monitor();
     //PEP#222     //PEP#222
     //CIMServer server(&monitor);     //CIMServer server(&monitor);
     //CimserverHolder cimserverHolder( &server );     //CimserverHolder cimserverHolder( &server );
     _cimServer = new CIMServer(&monitor);      _cimServer = new CIMServer(_monitor);
  
  
         if (enableHttpConnection)         if (enableHttpConnection)
Line 1282 
Line 1323 
 #endif #endif
  
         // bind throws an exception if the bind fails         // bind throws an exception if the bind fails
           try {
         _cimServer->bind();         _cimServer->bind();
           } catch (const BindFailedException &e)
           {
   #ifdef PEGASUS_DEBUG
           MessageLoaderParms parms("src.Server.cimserver.BIND_FAILED",
                    "Could not bind: $0.", e.getMessage());
           cout << MessageLoader::getMessage(parms) << endl;
   #endif
           Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
               "src.Server.cimserver.BIND.FAILED",
               "Could not bind:  $0", e.getMessage());
  
              deleteCIMServer();
              return 1;
           }
     // notify parent process (if there is a parent process) to terminate     // notify parent process (if there is a parent process) to terminate
         // so user knows that there is cimserver ready to serve CIM requests.         // so user knows that there is cimserver ready to serve CIM requests.
     if (daemonOption)     if (daemonOption)
Line 1292 
Line 1347 
     time_t last = 0;     time_t last = 0;
  
 #if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_OS_LINUX) || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) \ #if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_OS_LINUX) || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) \
     || defined(PEGASUS_OS_AIX) || defined(PEGASUS_PLATFORM_SOLARIS_SPARC_CC) \      || defined(PEGASUS_OS_AIX) || defined(PEGASUS_OS_SOLARIS) \
     || defined(PEGASUS_OS_VMS)     || defined(PEGASUS_OS_VMS)
         //         //
         // create a file to indicate that the cimserver has started and         // create a file to indicate that the cimserver has started and
Line 1343 
Line 1398 
             Logger::INFORMATION, "src.Server.cimserver.STOPPED",             Logger::INFORMATION, "src.Server.cimserver.STOPPED",
             "$0 stopped.", _cimServerProcess->getProductName());             "$0 stopped.", _cimServerProcess->getProductName());
  
 #if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) \  #if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_OS_LINUX) \
 || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || defined(PEGASUS_OS_AIX) \ || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || defined(PEGASUS_OS_AIX) \
 || defined(PEGASUS_PLATFORM_SOLARIS_SPARC_CC) || defined(PEGASUS_OS_VMS)  || defined(PEGASUS_OS_SOLARIS) || defined(PEGASUS_OS_VMS)
         //         //
         // close the file created at startup time to indicate that the          //  Note: do not remove the PID file created at startup time, since
         // cimserver has terminated normally.          //  shutdown is not complete until the CIMServer destructor completes.
         //         //
         FileSystem::removeFile(_cimServerProcess->getPIDFileName());  
 #endif #endif
     }     }
     catch(Exception& e)     catch(Exception& e)


Legend:
Removed from v.1.161  
changed lines
  Added in v.1.172

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2