00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "SystemManager.h"
00026
00027
00028 #include "ObjectManager.h"
00029 #include "Router.h"
00030 #include "RouterTypes.h"
00031 #include "SessionManager.h"
00032 #include "StreamManager.h"
00033 #include "UserManager.h"
00034 #include "Random.h"
00035 #include "RioError.h"
00036 #include "DiskMgr.h"
00037 #include "token.h"
00038 #include "Event.h"
00039 #include "timer.h"
00040 #include "MonitorTable.h"
00041
00042 #include <string.h>
00043 #include <errno.h>
00044 #include <stdio.h>
00045 #include <sys/stat.h>
00046 #include <sys/types.h>
00047 #include <fcntl.h>
00048 #include <unistd.h>
00049
00050 const int NUMBER_OF_TIMERS = 10;
00051
00052
00053
00054 const char* const CONFIGSSUBDIR = "etc/RIO/";
00055
00056
00057 const char* const LOGSSUBDIR = "var/log/RIO/";
00058
00059 const char* const CONFIGNAME = "RIOsystem.cfg";
00060
00061 CEventManager EventManager;
00062 CTimer Timer;
00063
00064
00065
00066
00067 CSystemManager::CSystemManager()
00068 {
00069 m_BlockSize = 0;
00070 m_MaxDisks = 0;
00071 m_MaxReplications = 0;
00072 m_UseReplications = 0;
00073 m_MaxDataRequests = 0;
00074 m_MaxPendingRequests = 0;
00075 m_FileRoot = NULL;
00076 m_MetaRoot = NULL;
00077 m_UserRoot = NULL;
00078 m_MaxSessions = 0;
00079 m_MaxStreams = 0;
00080 m_MaxOpenObjects = 0;
00081 m_MaxRate = 0.0;
00082 m_NRTReservedRate = 0.0;
00083
00084
00085 m_NumberOfBuffersForEachClient = 0;
00086 m_BurstSizeOfEachClient = 0;
00087 m_MaxNumberAtDiskQueueToEachClient = 0;
00088 m_CollectMeasures = NULL;
00089 m_UseServerSideBuffers = NULL;
00090 m_UseNewCAC = NULL;
00091 m_NetworkRate = 0.0;
00092 m_EstimatedTimeParameter = 0.0;
00093 m_MaxIntervalEmpty = 0.0;
00094 m_NumberOfEmptyTimes = 0;
00095
00096
00097 m_GenerateLogs = 0;
00098 m_DiskMgr = NULL;
00099 m_objectManager = NULL;
00100 m_Router = NULL;
00101 m_StreamManager = NULL;
00102 m_SessionManager = NULL;
00103 m_UserManager = NULL;
00104
00105 m_initialized = false;
00106 m_started = false;
00107
00108
00109
00110
00111 m_ConfigsDirectory = NULL;
00112 m_LogsDirectory = NULL;
00113
00114
00115
00116
00117 m_MaxAttempts = 20;
00118 m_TimeBetweenAttempts = 2;
00119
00120
00121 m_ClientsTimeOut = 0;
00122
00123
00124
00125
00126 m_MaxLogFileSize = MAXLOGFILESIZE;
00127 m_MaxCombinedLogFilesSize = MAXCOMBINEDLOGSFILESIZE;
00128
00129
00130 m_SaveLogs = NULL;
00131 }
00132
00133
00134 CSystemManager::~CSystemManager()
00135 {
00136 #ifdef RIO_DEBUG1
00137 RioErr << "[CSystemManager] Destructor Start" << endl;
00138 #endif
00139
00140 if( m_FileRoot != 0 )
00141 {
00142 delete[] m_FileRoot;
00143 }
00144 if( m_MetaRoot != 0 )
00145 {
00146 delete[] m_MetaRoot;
00147 }
00148 if( m_UserRoot != 0 )
00149 {
00150 delete[] m_UserRoot;
00151 }
00152
00153
00154
00155
00156 if( m_ConfigsDirectory != NULL )
00157 delete[] m_ConfigsDirectory;
00158
00159 if( m_LogsDirectory != NULL )
00160 delete[] m_LogsDirectory;
00161
00162
00163 if( m_UseServerSideBuffers != NULL )
00164 delete[] m_UseServerSideBuffers;
00165 if( m_UseNewCAC != NULL )
00166 delete[] m_UseNewCAC;
00167 if( m_CollectMeasures != NULL )
00168 delete[] m_CollectMeasures;
00169 if( m_SaveLogs != NULL )
00170 delete[] m_SaveLogs;
00171
00172 #ifdef RIO_DEBUG1
00173 RioErr << "[CSystemManager] Destructor End" << endl;
00174 #endif
00175 }
00176
00177
00178
00179
00180
00181
00182
00183
00184 int CSystemManager::Run(int DebugFlag, int FormatFlag, char *PrefixDirectory)
00185 {
00186
00187
00188
00189 if( PrefixDirectory == NULL )
00190 {
00191
00192
00193
00194
00195 m_ConfigsDirectory = new char[ 1 ];
00196 if( m_ConfigsDirectory == NULL )
00197 {
00198 RioErr << "CSystemManager::Run Erro ao alocar a memoria" << endl;
00199 return -1;
00200 }
00201 m_LogsDirectory = new char[ 1 ];
00202 if( m_LogsDirectory == NULL )
00203 {
00204 RioErr << "CSystemManager::Run Erro ao alocar a memoria" << endl;
00205 delete[] m_ConfigsDirectory;
00206 m_ConfigsDirectory = NULL;
00207 return -1;
00208 }
00209 m_ConfigsDirectory[ 0 ] = 0;
00210 m_LogsDirectory[ 0 ] = 0;
00211 }
00212 else
00213 {
00214
00215
00216 unsigned int PrefixDirectorySize, ConfigsDirectorySize,
00217 LogsDirectorySize;
00218 PrefixDirectorySize = strlen( PrefixDirectory );
00219 ConfigsDirectorySize = PrefixDirectorySize + strlen( CONFIGSSUBDIR ) +
00220 1;
00221 LogsDirectorySize = PrefixDirectorySize + strlen( LOGSSUBDIR ) + 1;
00222
00223 if( PrefixDirectory[ PrefixDirectorySize - 1 ] != '/' )
00224 {
00225
00226
00227
00228 ConfigsDirectorySize++;
00229 LogsDirectorySize++;
00230 }
00231 m_ConfigsDirectory = new char[ ConfigsDirectorySize ];
00232 if( m_ConfigsDirectory == NULL )
00233 {
00234 RioErr << "CSystemManager::Run Erro ao alocar a memoria" << endl;
00235 return -1;
00236 }
00237 m_LogsDirectory = new char[ LogsDirectorySize ];
00238 if( m_LogsDirectory == NULL )
00239 {
00240 RioErr << "CSystemManager::Run Erro ao alocar a memoria" << endl;
00241 delete[] m_ConfigsDirectory;
00242 m_ConfigsDirectory = NULL;
00243 return -1;
00244 }
00245 strcpy( m_ConfigsDirectory, PrefixDirectory );
00246 strcpy( m_LogsDirectory, PrefixDirectory );
00247 if( PrefixDirectory[ PrefixDirectorySize - 1 ] != '/' )
00248 {
00249
00250
00251 strcat( m_ConfigsDirectory, "/" );
00252 strcat( m_LogsDirectory, "/" );
00253 }
00254 strcat( m_ConfigsDirectory, CONFIGSSUBDIR );
00255 strcat( m_LogsDirectory, LOGSSUBDIR );
00256 }
00257
00258
00259 InitializeRandomNumber();
00260
00261
00262
00263 if( ReadConfiguration() )
00264 {
00265 RioErr << "SystemManager::ReadConfiguration failed" << endl;
00266 RioErr << "Server not running. Check error messages!" << endl;
00267 return -1;
00268 }
00269
00270 if( FormatFlag )
00271 {
00272 return Format();
00273 }
00274
00275
00276 pthread_t monitor_table_thread;
00277 pthread_attr_t attr_monitor_table_thread;
00278 pthread_attr_init( &attr_monitor_table_thread );
00279 pthread_attr_setstacksize( &attr_monitor_table_thread,
00280 2*PTHREAD_STACK_MIN );
00281
00282 pthread_create( &monitor_table_thread, &attr_monitor_table_thread,
00283 CSystemManager::MonitorTableTrigger, (void *)this );
00284
00285 int rc;
00286 rc = Start();
00287 if( rc )
00288 {
00289 RioErr << "Server not running. Check error messages!" << endl;
00290 return -1;
00291 }
00292 else
00293 {
00294
00295 cout << endl;
00296 cout << " LAND/COPPE - UFRJ" << endl<<endl;
00297 cout << " RIO Multimedia Storage Server" << endl;
00298 cout << " Running ..." << endl;
00299 }
00300
00301
00302 pthread_join( monitor_table_thread, NULL );
00303
00304
00305
00306
00307
00308
00309
00310
00311 return 0;
00312 }
00313
00314
00315
00316
00317
00318
00319
00320
00321 int CSystemManager::Format()
00322 {
00323 int rc = 0;
00324
00325 if( mkdir( m_FileRoot, 0700 ) )
00326 {
00327 RioErr << "SystemManager.Format - mkdir failed for "
00328 << m_FileRoot << " (m_FileRoot) "
00329 << strerror(errno) << endl;
00330 rc = 1;
00331 }
00332
00333 if( mkdir( m_MetaRoot, 0700 ) )
00334 {
00335 RioErr << "SystemManager.Format - mkdir failed for "
00336 << m_MetaRoot << " (m_MetaRoot) "
00337 << strerror(errno) << endl;
00338 rc = 1;
00339 }
00340
00341 if( mkdir( m_UserRoot, 0700 ) ) {
00342 RioErr << "SystemManager.Format - mkdir failed for "
00343 << m_UserRoot << " (m_UserRoot) "
00344 << strerror(errno) << endl;
00345
00346
00347 if( !rc )
00348 RioErr << "\t\t...continuing anyway... " << endl;
00349 }
00350
00351 if( rc )
00352 {
00353 RioErr << "fatal format error above, exiting.." << endl;
00354 return 1;
00355 }
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365 EventManager.Initialize( EventTypeStorageRequest, 2*m_MaxDisks );
00366 EventManager.Initialize( EventTypeStorageReply, 2*m_MaxDisks );
00367 EventManager.Initialize( EventTypeAddDisk, m_MaxDisks );
00368
00369
00370
00371 EventManager.Initialize( EventTypeStorageDown, MAXNUMSTORAGES );
00372 EventManager.Initialize( EventTypeStorageUp, MAXNUMSTORAGES );
00373
00374
00375
00376 EventManager.Initialize( EventTypeFinalizeThread, 1 );
00377
00378
00379 if( StartDiskMgr(1) )
00380 return 1;
00381
00382
00383 sleep(5);
00384
00385
00386 return m_DiskMgr->Format();
00387 }
00388
00389
00390 int CSystemManager::ReadConfiguration()
00391 {
00392
00393
00394 char ConfigFileName[ MaxPathSize ];
00395
00396 enum keys
00397 {
00398 BlockSize = 1, MaxDisks, MaxSessions, MaxStreams,
00399 MaxOpenObjects, MaxReplications, UseReplications,
00400 MaxDataRequests, MaxPendingRequests,
00401 FileRoot, MetaRoot, UserRoot, TotalRate, NRTReservedRate,
00402 NumberOfBuffersForEachClient, BurstSizeOfEachClient,
00403 NetworkRate, CollectMeasures,
00404 UseServerSideBuffers, UseNewCAC,
00405 EstimatedTimeParameter,
00406 NumberOfEmptyTimes, MaxIntervalEmpty,
00407 GenerateLogs, MaxAttempts, TimeBetweenAttempts,
00408 ClientsTimeOut, MaxLogFileSize, MaxCombinedLogFilesSize,
00409 LogRotation
00410 };
00411
00412 static struct token_kw mykeys[] = {
00413 {"BlockSize", BlockSize},
00414 {"MaxDisks", MaxDisks},
00415 {"MaxSessions", MaxSessions},
00416 {"MaxStreams", MaxStreams},
00417 {"MaxOpenObjects", MaxOpenObjects},
00418 {"MaxReplications", MaxReplications},
00419 {"UseReplications", UseReplications},
00420 {"MaxDataRequests", MaxDataRequests},
00421 {"MaxPendingRequests", MaxPendingRequests},
00422 {"FileRoot", FileRoot},
00423 {"MetaRoot", MetaRoot},
00424 {"UserRoot", UserRoot},
00425 {"TotalRate", TotalRate},
00426 {"NRTReservedRate", NRTReservedRate},
00427 {"NumberOfBuffersForEachClient", NumberOfBuffersForEachClient},
00428 {"BurstSizeOfEachClient", BurstSizeOfEachClient},
00429 {"NetworkRate", NetworkRate},
00430 {"CollectMeasures", CollectMeasures},
00431 {"UseServerSideBuffers", UseServerSideBuffers},
00432 {"UseNewCAC", UseNewCAC},
00433 {"EstimatedTimeParameter", EstimatedTimeParameter},
00434 {"NumberOfEmptyTimes", NumberOfEmptyTimes},
00435 {"MaxIntervalEmpty", MaxIntervalEmpty},
00436 {"GenerateLogs", GenerateLogs},
00437
00438
00439
00440
00441
00442 {"MaxAttempts", MaxAttempts},
00443 {"TimeBetweenAttempts", TimeBetweenAttempts},
00444
00445
00446
00447
00448 {"ClientsTimeOut", ClientsTimeOut},
00449
00450
00451
00452 {"MaxLogFileSize", MaxLogFileSize},
00453 {"MaxCombinedLogFilesSize", MaxCombinedLogFilesSize},
00454
00455
00456 {"LogRotation", LogRotation},
00457
00458 {NULL, 0}
00459 };
00460
00461 cout << endl;
00462 token tok;
00463
00464
00465
00466
00467
00468
00469 strcpy( ConfigFileName, m_ConfigsDirectory );
00470 strcat( ConfigFileName, CONFIGNAME );
00471
00472 if( tok.openfile( ConfigFileName ) )
00473 return 1;
00474
00475 int word;
00476 int number;
00477
00478 while( ( word = tok.parseline( mykeys )) != END_TOKEN )
00479 {
00480 switch( word )
00481 {
00482 case BlockSize:
00483 tok.getnumber(&m_BlockSize);
00484 break;
00485
00486 case MaxDisks:
00487 tok.getnumber(&m_MaxDisks);
00488 break;
00489
00490 case MaxSessions:
00491 tok.getnumber(&m_MaxSessions);
00492 break;
00493
00494 case MaxStreams:
00495 tok.getnumber(&m_MaxStreams);
00496 break;
00497
00498 case MaxOpenObjects:
00499 tok.getnumber(&m_MaxOpenObjects);
00500 break;
00501
00502 case MaxReplications:
00503 tok.getnumber(&m_MaxReplications);
00504 break;
00505
00506 case UseReplications:
00507 tok.getnumber(&m_UseReplications);
00508 break;
00509
00510 case MaxDataRequests:
00511 tok.getnumber(&m_MaxDataRequests);
00512 break;
00513
00514 case MaxPendingRequests:
00515 tok.getnumber(&m_MaxPendingRequests);
00516 break;
00517
00518 case FileRoot:
00519 tok.getstrnew(&m_FileRoot);
00520 break;
00521
00522 case MetaRoot:
00523 tok.getstrnew(&m_MetaRoot);
00524 break;
00525
00526 case UserRoot:
00527 tok.getstrnew(&m_UserRoot);
00528 break;
00529
00530 case TotalRate:
00531 tok.getnumber(&number);
00532
00533 m_MaxRate = ((number * 1000) / 8);
00534 break;
00535
00536 case NRTReservedRate:
00537 tok.getnumber(&number);
00538
00539 m_NRTReservedRate = ((number * 1000) / 8);
00540 break;
00541
00542 case NumberOfBuffersForEachClient:
00543 tok.getnumber(&m_NumberOfBuffersForEachClient);
00544 break;
00545
00546 case BurstSizeOfEachClient:
00547 tok.getnumber(&m_BurstSizeOfEachClient);
00548 break;
00549
00550 case NetworkRate:
00551 tok.getdouble(&m_NetworkRate);
00552 break;
00553
00554 case EstimatedTimeParameter:
00555 tok.getdouble(&m_EstimatedTimeParameter);
00556 break;
00557
00558 case UseServerSideBuffers:
00559 tok.getstrnew(&m_UseServerSideBuffers);
00560 break;
00561
00562 case UseNewCAC:
00563 tok.getstrnew(&m_UseNewCAC);
00564 break;
00565
00566 case CollectMeasures:
00567 tok.getstrnew(&m_CollectMeasures);
00568 break;
00569
00570 case NumberOfEmptyTimes:
00571 tok.getnumber(&m_NumberOfEmptyTimes);
00572 break;
00573
00574 case MaxIntervalEmpty:
00575 tok.getdouble(&m_MaxIntervalEmpty);
00576 break;
00577
00578 case GenerateLogs:
00579 tok.getnumber(&m_GenerateLogs);
00580 break;
00581
00582
00583
00584
00585
00586 case MaxAttempts:
00587 tok.getnumber(&m_MaxAttempts);
00588 break;
00589 case TimeBetweenAttempts:
00590 tok.getnumber(&m_TimeBetweenAttempts);
00591 break;
00592
00593
00594
00595
00596 case ClientsTimeOut:
00597 tok.getnumber( &m_ClientsTimeOut );
00598 break;
00599
00600
00601
00602 case MaxLogFileSize:
00603
00604 tok.getnumber( &number );
00605 m_MaxLogFileSize = number * 1024;
00606 break;
00607 case MaxCombinedLogFilesSize:
00608 tok.getnumber( &number );
00609
00610 m_MaxCombinedLogFilesSize = ( ( unsigned long long int ) number ) *
00611 1024;
00612 break;
00613
00614
00615 case LogRotation:
00616 tok.getstrnew( &m_SaveLogs );
00617 break;
00618
00619
00620 case ERROR_TOKEN:
00621 char *Aux;
00622 tok.getstrnew( &Aux );
00623 RioErr << "warning: invalid keyword " << Aux << " ignored!"
00624 << endl;
00625 delete[] Aux;
00626 break;
00627
00628
00629 default:
00630 RioErr << "word " << word << endl;
00631 tok.emsg("{default} invalid word");
00632 continue;
00633 }
00634 tok.ckend();
00635 }
00636 tok.closefile();
00637 return CheckConfiguration();
00638 }
00639
00640
00641 int CSystemManager::CheckConfiguration()
00642 {
00643
00644 if( ( m_BlockSize < 512 ) || ( m_BlockSize % 512 != 0 ) )
00645 {
00646 RioErr << "SystemManager.CheckConfiguration "
00647 << " - Invalid block size " << m_BlockSize
00648 << " (must be multiple of physical sector) " << endl;
00649 return ERROR_SYSTEMMANAGER + ERROR_INVALID_BLOCKSIZE;
00650 }
00651
00652
00653 if( ( m_MaxDisks < 1 ) || ( m_MaxDisks > (int) ( MAXNUMSTORAGES *
00654 MAXSTORAGEDISKSARRAY ) ) )
00655 {
00656 RioErr << "SystemManager::CheckConfiguration "
00657 << "MaxDisks: " << m_MaxDisks
00658 << " invalid (range 1-" << MAXNUMSTORAGES * MAXSTORAGEDISKSARRAY
00659 << ")" << endl;
00660 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00661 }
00662
00663 if( m_MaxSessions < 1 )
00664 {
00665 RioErr << "SystemManager.CheckConfiguration "
00666 << "MaxSessions: " << m_MaxSessions
00667 << " invalid (must be > 1)" << endl;
00668 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00669 }
00670
00671 if( m_MaxStreams < 1 )
00672 {
00673 RioErr << "SystemManager.CheckConfiguration "
00674 << "MaxStreams: " << m_MaxStreams
00675 << " invalid (must be > 1)" << endl;
00676 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00677 }
00678
00679 if( m_MaxOpenObjects < 1 )
00680 {
00681 RioErr << "SystemManager.CheckConfiguration "
00682 << "MaxOpenObjects: " << m_MaxOpenObjects
00683 << " invalid (must be > 1)" << endl;
00684 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00685 }
00686
00687
00688 if( ( m_UseReplications < 1 ) || ( m_UseReplications > 8 ) )
00689 {
00690 RioErr << "SystemManager.CheckConfiguration "
00691 "UseReplications must be between 1 and 8" << endl;
00692 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00693 }
00694 if( ( m_MaxReplications < 1 ) || ( m_MaxReplications > 8 ) )
00695 {
00696 RioErr << "SystemManager.CheckConfiguration "
00697 "MaxReplications must be between 1 and 8" << endl;
00698 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00699 }
00700
00701 if( m_UseReplications > m_MaxReplications )
00702 {
00703 RioErr << "SystemManager.CheckConfiguration "
00704 "UseReplications > MaxReplications " << endl;
00705 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00706 }
00707
00708 if( ( m_UseReplications > 1 ) && ( m_MaxDisks < MAXSTORAGEDISKSARRAY ) )
00709 {
00710 RioErr << "SystemManager.CheckConfiguration warning: "
00711 "using replication > 1 with few disks or nodes may not work "
00712 << endl;
00713 }
00714
00715 if( m_BurstSizeOfEachClient < 0 )
00716 {
00717 RioErr << "SystemManager.CheckConfiguration "
00718 << "BurstSizeOfEachClient: " << m_BurstSizeOfEachClient
00719 << " invalid (must be > 0)" << endl;
00720 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00721 }
00722
00723 if( ( m_NumberOfBuffersForEachClient < 0 ) ||
00724 ( m_NumberOfBuffersForEachClient > 20 ))
00725 {
00726 RioErr << "SystemManager.CheckConfiguration "
00727 << "NumberOfBuffersForEachClient: "
00728 << m_NumberOfBuffersForEachClient
00729 << " invalid (must be between 0 and 20)" << endl;
00730 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00731 }
00732
00733 if( m_NetworkRate < 0 )
00734 {
00735 RioErr << "SystemManager.CheckConfiguration "
00736 << "NetworkRate: " << m_NetworkRate
00737 << " invalid (must be > 0)" << endl;
00738 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00739 }
00740 else
00741 {
00742 m_NetworkRate = (m_NetworkRate * 1024.0 * 1024.0) / 8;
00743 }
00744
00745 if( ( m_EstimatedTimeParameter < 0 ) || ( m_EstimatedTimeParameter > 1 ) )
00746 {
00747 RioErr << "SystemManager.CheckConfiguration "
00748 << "EstimatedTimeParameter: " << m_EstimatedTimeParameter
00749 << " invalid (must be between 0 and 1)" << endl;
00750 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00751 }
00752
00753 if( ( strcasecmp( m_UseServerSideBuffers, "on" ) != 0 ) &&
00754 ( strcasecmp( m_UseServerSideBuffers, "off" ) != 0 ))
00755 {
00756 RioErr << "SystemManager.CheckConfiguration "
00757 << "UseServerSideBuffers: " << m_UseServerSideBuffers
00758 << " invalid (must be 'on' or 'off')" << endl;
00759 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00760 }
00761 if( ( strcasecmp( m_UseNewCAC, "on" ) != 0 ) &&
00762 ( strcasecmp( m_UseNewCAC, "off" ) != 0 ))
00763 {
00764 RioErr << "SystemManager.CheckConfiguration "
00765 << "UseNewCAC: " << m_UseNewCAC
00766 << " invalid (must be 'on' or 'off')" << endl;
00767 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00768 }
00769 if( ( strcasecmp( m_CollectMeasures, "on" ) != 0 ) &&
00770 ( strcasecmp( m_CollectMeasures, "off" ) != 0 ))
00771 {
00772 RioErr << "SystemManager.CheckConfiguration "
00773 << "CollectMeasures: " << m_CollectMeasures
00774 << " invalid (must be 'on' or 'off')" << endl;
00775 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00776 }
00777
00778 if( ( m_GenerateLogs != 0 ) && ( m_GenerateLogs != 1 ) )
00779 {
00780 RioErr << "SystemManager.CheckConfiguration "
00781 << "GenerateLogs: " << m_GenerateLogs
00782 << " invalid (must be '0' or '1')" << endl;
00783 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00784 }
00785
00786 if( strcasecmp( m_UseNewCAC, "on" ) == 0 )
00787 {
00788 strcpy( m_UseNewCAC, "on" );
00789 strcpy( m_UseServerSideBuffers, "on" );
00790 strcpy( m_CollectMeasures, "on" );
00791 }
00792
00793 if( m_NumberOfEmptyTimes < 0 )
00794 {
00795 RioErr << "SystemManager.CheckConfiguration "
00796 << "NumberOfEmptyTimes: " << m_NumberOfEmptyTimes
00797 << " invalid (must be >= 0)" << endl;
00798 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00799 }
00800 if( m_MaxIntervalEmpty < 0 )
00801 {
00802 RioErr << "SystemManager.CheckConfiguration "
00803 << "MaxIntervalEmpty: " << m_MaxIntervalEmpty
00804 << " invalid (must be >= 0)" << endl;
00805 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00806 }
00807
00808 RioErr << "UseNewCAC " << m_UseNewCAC << endl;
00809 RioErr << "UseServerSideBuffers " << m_UseServerSideBuffers << endl;
00810 RioErr << "CollectMeasures " << m_CollectMeasures << endl;
00811
00812
00813
00814 if( CheckString( "FileRoot", m_FileRoot ) )
00815 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00816 if( CheckString( "MetaRoot", m_MetaRoot ) )
00817 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00818 if( CheckString( "UserRoot", m_UserRoot ) )
00819 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00820
00821
00822
00823
00824
00825
00826
00827 if( m_MaxAttempts < 0 )
00828 {
00829 RioErr << "SystemManager.CheckConfiguration "
00830 << "MaxAttempts: " << m_MaxAttempts
00831 << " invalid (must be >= 0)" << endl;
00832 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00833 }
00834
00835 if( m_TimeBetweenAttempts < 0 )
00836 {
00837 RioErr << "SystemManager.CheckConfiguration "
00838 << "TimeBetweenAttempts: " << m_TimeBetweenAttempts
00839 << " invalid (must be >= 0)" << endl;
00840 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00841 }
00842
00843
00844
00845
00846
00847 if( m_ClientsTimeOut < 0 )
00848 {
00849 RioErr << "SystemManager.CheckConfiguration "
00850 << "ClientsTimeOut: " << m_ClientsTimeOut
00851 << " invalid (must be >= 0)" << endl;
00852 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00853 }
00854
00855
00856
00857
00858
00859 if( m_MaxLogFileSize <= 0 )
00860 {
00861 RioErr << "SystemManager.CheckConfiguration "
00862 << "MaxLogFileSize: " << m_MaxLogFileSize
00863 << " invalid (must be > 0)" << endl;
00864 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00865 }
00866
00867 if( m_MaxCombinedLogFilesSize <= 0 )
00868 {
00869 RioErr << "SystemManager.CheckConfiguration "
00870 << "MaxCombinedLogFilesSize: " << m_MaxCombinedLogFilesSize
00871 << " invalid (must be > 0)" << endl;
00872 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00873 }
00874
00875
00876
00877 if( ( m_SaveLogs != NULL ) && ( strcasecmp( m_SaveLogs, "on" ) != 0 ) &&
00878 ( strcasecmp( m_SaveLogs, "off" ) != 0 ) )
00879 {
00880 RioErr << "SystemManager.CheckConfiguration "
00881 << "LogRotation: " << m_SaveLogs
00882 << " invalid (must be 'on' or 'off')" << endl;
00883 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00884 }
00885
00886 printSystemConfiguration();
00887
00888 return 0;
00889 }
00890
00891
00892 int CSystemManager::CheckString( const char *name, const char *x )
00893 {
00894 if( ( x == 0 ) || ( strlen( x ) < 1 ) )
00895 {
00896 RioErr << "SystemManager::CheckConfiguration "
00897 << name << " not specified or null string" << endl;
00898 return ERROR_SYSTEMMANAGER + ERROR_INVALID_PARAM;
00899 }
00900 return 0;
00901 }
00902
00903
00904 int CSystemManager::Start()
00905 {
00906 int hResult;
00907
00908 #ifdef RIO_DEBUG1
00909 RioErr << "### [CSystemManager - Start] Start" << endl;
00910 #endif
00911
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921 EventManager.Initialize(EventTypeStorageRequest, 2*m_MaxDisks);
00922 EventManager.Initialize(EventTypeStorageReply, 2*m_MaxDisks);
00923 EventManager.Initialize(EventTypeAddDisk, m_MaxDisks);
00924
00925
00926
00927 EventManager.Initialize( EventTypeStorageDown, MAXNUMSTORAGES );
00928 EventManager.Initialize( EventTypeStorageUp, MAXNUMSTORAGES );
00929
00930
00931
00932 EventManager.Initialize( EventTypeFinalizeThread, 1 );
00933
00934 Timer.Initialize (NUMBER_OF_TIMERS);
00935
00936
00937 cout << "Starting Disk Manager ....... ";
00938 #ifdef RIO_DEBUG2
00939 RioErr << "Starting Disk Manager ....... " << endl;
00940 #endif
00941 hResult = StartDiskMgr(0);
00942 if( hResult )
00943 {
00944 cout << "failed "<<endl;
00945 RioErr << "Start Disk Manager failed" << endl;
00946 FreeMembers();
00947 return hResult;
00948 }
00949
00950
00951 cout << "Starting User Manager ..... ";
00952 #ifdef RIO_DEBUG2
00953 RioErr << "Starting User Manager ..... " << endl;
00954 #endif
00955
00956 hResult = StartUserManager();
00957 if( hResult )
00958 {
00959 cout << "failed "<<endl;
00960 RioErr << "Start User Manager failed" << endl;
00961 FreeMembers();
00962 return hResult;
00963 }
00964 cout << "OK "<<endl;
00965
00966
00967 cout << "Starting Object Manager ..... ";
00968 #ifdef RIO_DEBUG2
00969 RioErr << "Starting Object Manager ..... " << endl;
00970 #endif
00971 hResult = StartObjectManager();
00972 if( hResult )
00973 {
00974 cout << "failed "<<endl;
00975 RioErr << "Start Object Manager failed" << endl;
00976 FreeMembers();
00977 return hResult;
00978 }
00979 cout << "OK "<<endl;
00980
00981
00982 cout << "Starting Router ............. ";
00983 #ifdef RIO_DEBUG2
00984 RioErr << "Starting Router ............. " << endl;
00985 #endif
00986 hResult = StartRouter();
00987 if( hResult )
00988 {
00989 cout << "failed "<<endl;
00990 RioErr << "Start Router failed" << endl;
00991 FreeMembers();
00992 return hResult;
00993 }
00994 cout << "OK "<<endl;
00995
00996
00997 cout << "Starting Stream Manager ..... ";
00998 #ifdef RIO_DEBUG2
00999 RioErr << "Starting Stream Manager ..... " << endl;
01000 #endif
01001 hResult = StartStreamManager();
01002 if( hResult )
01003 {
01004 cout << "failed "<<endl;
01005 RioErr << "Start Stream Manager failed" << endl;
01006 FreeMembers();
01007 return hResult;
01008 }
01009 cout << "OK "<<endl;
01010
01011
01012 cout << "Starting Session Manager .... ";
01013 #ifdef RIO_DEBUG2
01014 RioErr << "Starting Session Manager .... " << endl;
01015 #endif
01016 hResult = StartSessionManager();
01017 if( hResult )
01018 {
01019 cout << "failed "<<endl;
01020 RioErr << "Start Session Manager failed" << endl;
01021 FreeMembers();
01022 return hResult;
01023 }
01024 cout << "OK "<<endl;
01025
01026 m_started = true;
01027
01028 #ifdef RIO_DEBUG1
01029 RioErr << "### [CSystemManager - Start] End" << endl;
01030 #endif
01031
01032 return 0;
01033 }
01034
01035
01036 int CSystemManager::StartDiskMgr( int formatflag )
01037 {
01038 int hResult;
01039
01040
01041 m_Router = new CRouter;
01042
01043
01044 m_DiskMgr = new DiskMgr;
01045
01046
01047 RouterConfig Config;
01048 Config.nDisks = m_MaxDisks;
01049 Config.BlockSize = m_BlockSize;
01050 Config.MaxDataRequests = m_MaxDataRequests;
01051 Config.MaxPending = m_MaxPendingRequests;
01052 Config.CollectMeasures = (( strcasecmp( m_CollectMeasures, "on" ) == 0 )||
01053 ( strcasecmp( m_UseNewCAC, "on" ) == 0 ))? true:false;
01054 Config.EstimatedTimeParameter = m_EstimatedTimeParameter;
01055
01056
01057 Config.DiskManager = m_DiskMgr;
01058 Config.SystemManager = this;
01059
01060
01061
01062 #ifdef __QUEUE_RESP_LOG
01063 Config.LogsDirectory = m_LogsDirectory;
01064 #endif
01065
01066 hResult = m_Router->Initialize( &Config );
01067
01068 if( hResult )
01069 {
01070 RioErr << "Start(): Failed to initialize Router"
01071 << ". hresult=" << hResult << endl;
01072 delete m_Router;
01073 m_Router = 0;
01074 return hResult;
01075 }
01076
01077
01078 DiskMgrConfig ConfigDisk;
01079 ConfigDisk.BlockSize = m_BlockSize;
01080 ConfigDisk.MaxDisks = m_MaxDisks;
01081 ConfigDisk.MetaRoot = m_MetaRoot;
01082 ConfigDisk.router = m_Router;
01083 ConfigDisk.manager = this;
01084 ConfigDisk.GenerateLogs = m_GenerateLogs;
01085 ConfigDisk.MaxReps = m_UseReplications;
01086 ConfigDisk.ConfigsDirectory = m_ConfigsDirectory;
01087 ConfigDisk.LogsDirectory = m_LogsDirectory;
01088 ConfigDisk.MaxAttempts = m_MaxAttempts;
01089 ConfigDisk.TimeBetweenAttempts = m_TimeBetweenAttempts;
01090
01091
01092 ConfigDisk.IsFormatting = ( formatflag != 0 );
01093
01094 hResult = m_DiskMgr->Initialize( &ConfigDisk );
01095
01096 if( hResult )
01097 {
01098 RioErr << "SystemManager.StartDiskMgr: DiskMgr.Initialize failed."
01099 << endl;
01100 return hResult;
01101 }
01102
01103
01104
01105 if( formatflag )
01106 return 0;
01107
01108 hResult = m_DiskMgr->Start();
01109 if( hResult )
01110 {
01111 RioErr << "SystemManager.StartDiskMgr: DiskMgr.Start failed." << endl;
01112 return hResult;
01113 }
01114
01115 return 0;
01116 }
01117
01118
01119 int CSystemManager::StartObjectManager()
01120 {
01121
01122 m_objectManager = new CObjectManager;
01123
01124
01125 ObjectManagerConfig ObjectConfig;
01126 ObjectConfig.BlockSize = m_BlockSize;
01127 ObjectConfig.FileRoot = m_FileRoot;
01128 ObjectConfig.MaxNhandle = m_MaxOpenObjects;
01129 ObjectConfig.MaxReplications = m_MaxReplications;
01130 ObjectConfig.UseReplications = m_UseReplications;
01131 ObjectConfig.c_DiskMgr = m_DiskMgr;
01132 ObjectConfig.UserManager = m_UserManager;
01133
01134
01135
01136
01137 ObjectConfig.GenerateLogs = m_GenerateLogs;
01138 ObjectConfig.LogsDirectory = m_LogsDirectory;
01139
01140
01141
01142
01143
01144 int hResult = m_objectManager->Initialize( &ObjectConfig );
01145 if( hResult )
01146 {
01147 RioErr << "Start(): Failed to initialize object manager"
01148 << ". hresult=" << hResult << endl;
01149 delete m_objectManager;
01150 m_objectManager = 0;
01151 return hResult;
01152 }
01153
01154 hResult = m_objectManager->Start();
01155 if( hResult )
01156 {
01157 RioErr << "Start(): Failed to start object manager"
01158 << ". hresult=" << hResult << endl;
01159 delete m_objectManager;
01160 m_objectManager = 0;
01161 return hResult;
01162 }
01163
01164 return 0;
01165 }
01166
01167
01168 int CSystemManager::StartRouter()
01169 {
01170
01171
01172 int hResult = m_Router->Start();
01173 if( hResult )
01174 {
01175 RioErr << "Start(): Failed to initialize Router"
01176 << ". hresult=" << hResult << endl;
01177 delete m_Router;
01178 m_Router = 0;
01179 return hResult;
01180 }
01181
01182 return 0;
01183 }
01184
01185
01186 int CSystemManager::StartStreamManager()
01187 {
01188 #ifdef RIO_DEBUG1
01189 RioErr << "### [CSystemManager - StartStreamManager] Start" << endl;
01190 #endif
01191
01192
01193 m_StreamManager = new CStreamManager;
01194
01195
01196 StreamManagerConfig Config;
01197 Config.BlockSize = m_BlockSize;
01198 Config.MaxStreams = m_MaxStreams;
01199 Config.TotalRate = m_MaxRate;
01200 Config.NRTReservedRate = m_NRTReservedRate;
01201 Config.FileRoot = m_FileRoot;
01202
01203 Config.MaxPending = m_MaxPendingRequests;
01204 Config.NumberOfBuffersForEachClient = m_NumberOfBuffersForEachClient;
01205 Config.BurstSizeOfEachClient = m_BurstSizeOfEachClient;
01206 Config.NetworkRate = m_NetworkRate;
01207 Config.EstimatedTimeParameter = m_EstimatedTimeParameter;
01208 Config.NumberOfEmptyTimes = m_NumberOfEmptyTimes;
01209 Config.MaxIntervalEmpty = m_MaxIntervalEmpty;
01210 if( strcasecmp( m_UseNewCAC, "on" ) == 0 )
01211 {
01212 Config.UseNewCAC = true;
01213 Config.UseServerSideBuffers = true;
01214 Config.CollectMeasures = true;
01215 }
01216 else
01217 {
01218 Config.UseNewCAC = false;
01219 Config.UseServerSideBuffers = ( strcasecmp( m_UseServerSideBuffers, "on" ) == 0 )? true:false;
01220 Config.CollectMeasures = ( strcasecmp( m_CollectMeasures, "on" ) == 0 )? true:false;
01221 }
01222
01223
01224 Config.MaxDiskQueueSize = m_MaxDataRequests;
01225 Config.ExtraStreamRequests = 3;
01226
01227 unsigned int nDisks;
01228
01229 m_DiskMgr->GetNumberOfNeededDisks( &nDisks );
01230 Config.nDisks = nDisks;
01231 #ifdef RIO_DEBUG2
01232 RioErr << "### [CSystemManager - StartStreamManager] Numero de discos "
01233 << Config.nDisks << endl;
01234 #endif
01235
01236 Config.ObjectManager = m_objectManager;
01237 Config.Router = m_Router;
01238 Config.SystemManager = this;
01239
01240
01241
01242
01243
01244 Config.GenerateLogs = m_GenerateLogs;
01245 Config.LogsDirectory = m_LogsDirectory;
01246
01247
01248
01249 Config.ClientsTimeOut = m_ClientsTimeOut;
01250
01251
01252
01253
01254 int hResult = m_StreamManager->Initialize( &Config );
01255 if( hResult )
01256 {
01257 RioErr << "Start(): Failed to initialize Stream Manager"
01258 << ". hresult=" << (int *)hResult << endl;
01259 delete m_StreamManager;
01260 m_StreamManager = 0;
01261 return hResult;
01262 }
01263
01264 #ifdef RIO_DEBUG1
01265 RioErr << "### [CSystemManager - StartStreamManager] End" << endl;
01266 #endif
01267
01268 return 0;
01269 }
01270
01271
01272 int CSystemManager::StartSessionManager()
01273 {
01274
01275 m_SessionManager = new CSessionManager;
01276
01277
01278 SessionManagerConfig Config;
01279 Config.MaxSessions = m_MaxSessions;
01280 Config.BlockSize = m_BlockSize;
01281 Config.StreamManager = m_StreamManager;
01282 Config.ObjectManager = m_objectManager;
01283 Config.UserManager = m_UserManager;
01284 Config.Router = m_Router;
01285 Config.SystemManager = this;
01286
01287
01288 Config.diskMgr = m_DiskMgr;
01289 m_DiskMgr->GetNumberOfActiveDisks( &Config.NumberOfDisks );
01290 m_DiskMgr->GetNumberOfStorageNodes( &Config.NumberOfStorageNodes );
01291
01292
01293 Config.FileRoot = m_FileRoot;
01294
01295
01296
01297
01298
01299 Config.GenerateLogs = m_GenerateLogs;
01300 Config.LogsDirectory = m_LogsDirectory;
01301
01302
01303
01304
01305 Config.ClientsTimeOut = m_ClientsTimeOut;
01306
01307
01308
01309 Config.MaxLogFileSize = m_MaxLogFileSize;
01310 Config.MaxCombinedLogFilesSize = m_MaxCombinedLogFilesSize;
01311
01312
01313 Config.SaveLogs = ( ( m_SaveLogs == NULL ) ||
01314 ( strcasecmp( m_SaveLogs, "on" ) == 0 ) );
01315
01316
01317
01318
01319 int hResult = m_SessionManager->Initialize( &Config );
01320 if( hResult )
01321 {
01322 RioErr << "Start(): Failed to initialize Session Manager"
01323 << ". hresult=" << (int *)hResult << endl;
01324 delete m_SessionManager;
01325 m_SessionManager = 0;
01326 return hResult;
01327 }
01328
01329 return 0;
01330 }
01331
01332
01333 int CSystemManager::StartUserManager()
01334 {
01335
01336 m_UserManager = new CUserManager;
01337
01338
01339 UserManagerConfig Config;
01340 Config.UserRoot = m_UserRoot;
01341 Config.FileRoot = m_FileRoot;
01342 Config.GenerateLogs = m_GenerateLogs;
01343 Config.ConfigsDirectory = m_ConfigsDirectory;
01344 Config.LogsDirectory = m_LogsDirectory;
01345
01346
01347 int hResult = m_UserManager->Initialize( &Config );
01348 if( hResult )
01349 {
01350 RioErr << "Start(): Failed to initialize User Manager"
01351 << ". hresult=" << (int *)hResult << endl;
01352
01353 delete m_UserManager;
01354
01355 m_UserManager = 0;
01356 return hResult;
01357 }
01358
01359 return 0;
01360 }
01361
01362
01363 int CSystemManager::Stop()
01364 {
01365
01366
01367 if( !m_started )
01368 {
01369 RioErr << "stop(): System Manager not started" << endl;
01370 return ERROR_SYSTEMMANAGER + ERROR_NOT_STARTED;
01371 }
01372
01373 m_started = false;
01374 return FreeMembers();
01375 }
01376
01377
01378 int CSystemManager::FreeMembers()
01379 {
01380 int result = S_OK;
01381 int result2;
01382
01383 if( m_UserManager != 0 )
01384 {
01385 delete m_UserManager;
01386 m_UserManager = 0;
01387 }
01388
01389 if( m_SessionManager != 0 )
01390 {
01391 delete m_SessionManager;
01392 m_SessionManager = 0;
01393 }
01394
01395 if( m_StreamManager != 0 )
01396 {
01397 delete m_StreamManager;
01398 m_StreamManager = 0;
01399 }
01400
01401 if( m_Router != 0 )
01402 {
01403 result2 = m_Router->Stop();
01404 if( ( ( unsigned int ) result2 !=
01405 ( ERROR_ROUTER + ERROR_NOT_STARTED )
01406 ) &&
01407 ( FAILED ( result2 ) )
01408 )
01409 {
01410 RioErr << "FreeMembers(): Failed to stop Router" << endl;
01411 result = result2;
01412 }
01413 delete m_Router;
01414 m_Router = 0;
01415 }
01416
01417 if( m_objectManager != 0 )
01418 {
01419 result2 = m_objectManager->Stop();
01420 if( FAILED( result2 ) )
01421 {
01422 RioErr << "FreeMembers(): Failed to stop Object Manager" << endl;
01423 result = result2;
01424 }
01425 delete m_objectManager;
01426 m_objectManager = 0;
01427 }
01428
01429
01430 if( m_DiskMgr != 0 )
01431 delete m_DiskMgr;
01432
01433
01434 m_MonitorTable.Stop();
01435
01436 return result;
01437 }
01438
01439
01440 void CSystemManager::printSystemConfiguration()
01441 {
01442 cout << "---------------------------------------------------" << endl;
01443 cout << " RIO Configuration " << endl;
01444 cout << "---------------------------------------------------" << endl;
01445 cout << "RIO System Block Size \t\t" << m_BlockSize << " Bytes" << endl;
01446 cout << "Maximum Number of disks \t" << m_MaxDisks << endl;
01447 cout << "Maximum Number of sessions \t" << m_MaxSessions << endl;
01448 cout << "Maximum Number of streams \t" << m_MaxStreams << endl;
01449 cout << "Maximum Number of open objects \t" << m_MaxOpenObjects << endl;
01450
01451 cout << "MaxReplications \t\t" << m_MaxReplications << endl;
01452 cout << "UseReplications \t\t" << m_UseReplications << endl;
01453
01454 cout << "MaxDataRequests \t\t" << m_MaxDataRequests << endl;
01455 cout << "MaxPendingRequests \t\t" << m_MaxPendingRequests << endl;
01456
01457 cout << "FileRoot \t\t\t" << m_FileRoot << endl;
01458 cout << "MetaRoot \t\t\t" << m_MetaRoot << endl;
01459 cout << "UserRoot \t\t\t" << m_UserRoot << endl;
01460
01461 cout << "Buffers to each client \t\t" << m_NumberOfBuffersForEachClient << endl;
01462 cout << "Burst Size of each client \t" << m_BurstSizeOfEachClient << endl;
01463
01464
01465 double networkrate = (m_NetworkRate * 8 )/1024.0/1024.0;
01466 cout << "NetworkRate \t\t\t" << networkrate <<" Mbps"<< endl;
01467 cout << "CollectMeasures \t\t" << m_CollectMeasures << endl;
01468 cout << "UseServerSideBuffers \t\t" << m_UseServerSideBuffers << endl;
01469 cout << "UseNewCAC \t\t\t" << m_UseNewCAC << endl;
01470 cout << "EstimatedTimeParameter \t\t" << m_EstimatedTimeParameter << endl;
01471 cout << "NumberOfEmptyTimes \t\t" << m_NumberOfEmptyTimes << endl;
01472 cout << "MaxIntervalEmpty \t\t" << m_MaxIntervalEmpty << " msec" << endl;
01473
01474 cout << "GenerateLogs \t\t\t" << m_GenerateLogs << endl;
01475
01476
01477
01478
01479
01480
01481 cout << "MaxAttempts \t\t\t" << m_MaxAttempts << endl;
01482 cout << "TimeBetweenAttempts \t\t" << m_TimeBetweenAttempts << endl;
01483
01484
01485
01486 cout << "ClientsTimeOut \t\t\t" << m_ClientsTimeOut << endl;
01487
01488
01489
01490 cout << "MaxLogFileSize \t\t\t" << m_MaxLogFileSize / 1024 << " Kbytes"
01491 << endl;
01492 cout << "MaxCombinedLogFilesSize \t" << m_MaxCombinedLogFilesSize / 1024
01493 << " Kbytes" << endl;
01494
01495
01496 if( m_SaveLogs != NULL )
01497 cout << "LogRotation \t\t\t" << m_SaveLogs << endl;
01498 else
01499 cout << "LogRotation \t\t\tOn" << endl;
01500
01501 cout << "---------------------------------------------------" << endl
01502 << endl;
01503 }
01504
01505
01506 void *CSystemManager::MonitorTableTrigger( void *param )
01507 {
01508 ((CSystemManager *)param)->m_MonitorTable.Monitor();
01509 return NULL;
01510 }
01511
01512
01513 void CSystemManager::PostITEvent( MonitorEvent *event )
01514 {
01515 m_MonitorTable.putMonitorEvent( event );
01516 }
01517
01518
01519 int CSystemManager::GetMonitorTable( vector<ClientData> &clientTable,
01520 vector<StorageData> &storageTable )
01521 {
01522 m_MonitorTable.getData( clientTable, storageTable );
01523 return 0;
01524 }
01525
01526
01527
01528
01529
01530 void CSystemManager::InvalidateStorageNatMappings( int StorageId )
01531 {
01532
01533
01534 if( m_SessionManager != NULL )
01535 m_SessionManager->InvalidateStorageNatMappings( StorageId );
01536 else
01537 RioErr << "CSystemManager::InvalidateStorageNatMappings aviso a funcao "
01538 << "foi chamada antes da criacao e inicializacao do objecto da "
01539 << "classe CSessionManager" << endl;
01540
01541 }
01542
01543
01544
01545
01546 void CSystemManager::SetNumberOfDisks( unsigned int NumberOfDisks )
01547 {
01548
01549
01550 if( m_SessionManager != NULL )
01551 m_SessionManager->SetNumberOfDisks( NumberOfDisks );
01552 else
01553 RioErr << "CSystemManager::SetNumberOfDisks aviso a funcao foi chamada "
01554 << "antes da criacao e inicializacao do objecto da classe "
01555 << "CSessionManager" << endl;
01556
01557
01558 if( m_StreamManager != NULL )
01559 m_StreamManager->SetNumberOfDisks( NumberOfDisks );
01560 else
01561 RioErr << "CSystemManager::SetNumberOfDisks aviso a funcao foi chamada "
01562 << "antes da criacao e inicializacao do objecto da classe "
01563 << "CStreamManager" << endl;
01564 }
01565