Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
XrdProofdManager.h
Go to the documentation of this file.
1 // @(#)root/proofd:$Id$
2 // Author: G. Ganis June 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_XrdProofdManager
13 #define ROOT_XrdProofdManager
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // XrdProofdManager //
18 // //
19 // Author: G. Ganis, CERN, 2007 //
20 // //
21 // Class mapping manager functionality. //
22 // On masters it keeps info about the available worker nodes and allows //
23 // communication with them. In particular, it reads the proof.conf file //
24 // when working with static resources. //
25 // On workers it handles the communication with the master //
26 // (to be implemented). //
27 // //
28 //////////////////////////////////////////////////////////////////////////
29 #include <list>
30 
31 #include "XpdSysPthread.h"
32 
33 #include "XrdOuc/XrdOucString.hh"
34 
35 #include "XrdProofdAux.h"
36 #include "XrdProofdConfig.h"
37 
38 class rpdunixsrv;
39 class XrdProofdAdmin;
40 class XrdProofdClient;
41 class XrdProofdClientMgr;
42 class XrdProofdNetMgr;
43 class XrdProofdPriorityMgr;
44 class XrdProofdProofServMgr;
45 class XrdProofdProtocol;
46 class XrdProofGroupMgr;
47 class XrdProofSched;
48 class XrdProofdProofServ;
49 class XrdProofWorker;
50 class XrdProtocol;
51 class XrdROOT;
52 class XrdROOTMgr;
53 
54 class XrdSysPlugin;
55 
56 class XrdProofdManager : public XrdProofdConfig {
57 
58  public:
59  XrdProofdManager(char *parms, XrdProtocol_Config *pi, XrdSysError *edest);
60  virtual ~XrdProofdManager();
61 
62  XrdSysRecMutex *Mutex() { return &fMutex; }
63 
64  // Config
65  int Config(bool rcf = 0);
66  int DoDirective(XrdProofdDirective *d,
67  char *val, XrdOucStream *cfg, bool rcf);
68  void RegisterDirectives();
69 
70  int ResolveKeywords(XrdOucString &s, XrdProofdClient *pcl);
71 
72  int GetWorkers(XrdOucString &workers, XrdProofdProofServ *, const char *);
73 
74  const char *AdminPath() const { return fAdminPath.c_str(); }
75  const char *BareLibPath() const { return fBareLibPath.c_str(); }
76  bool ChangeOwn() const { return fChangeOwn; }
77  void CheckLogFileOwnership();
78  bool CheckMaster(const char *m);
79  int CheckUser(const char *usr, const char *grp, XrdProofUI &ui, XrdOucString &e, bool &su);
80  int CronFrequency() { return fCronFrequency; }
81  const char *Host() const { return fHost.c_str(); }
82  const char *Image() const { return fImage.c_str(); }
83  bool IsSuperMst() const { return fSuperMst; }
84  const char *LocalROOT() const { return fLocalroot.c_str(); }
85  bool MultiUser() const { return fMultiUser; }
86  const char *NameSpace() const { return fNamespace.c_str(); }
87  const char *PoolURL() const { return fPoolURL.c_str(); }
88  int Port() const { return fPort; }
89  int SrvType() const { return fSrvType; }
90  const char *SockPathDir() const { return fSockPathDir.c_str(); }
91  const char *TMPdir() const { return fTMPdir.c_str(); }
92  const char *WorkDir() const { return fWorkDir.c_str(); }
93  const char *DataDir() const { return fDataDir.c_str(); }
94  const char *DataDirOpts() const { return fDataDirOpts.c_str(); }
95  const char *DataDirUrlOpts() const { return fDataDirUrlOpts.c_str(); }
96  const char *DataSetExp() const { return fDataSetExp.c_str(); }
97  const char *StageReqRepo() const { return fStageReqRepo.c_str(); }
98 
99  bool RemotePLite() const { return fRemotePLite; }
100 
101  std::list<XrdProofdDSInfo *> *DataSetSrcs() { return &fDataSetSrcs; }
102 
103  // Services
104  XrdProofdClientMgr *ClientMgr() const { return fClientMgr; }
105  const char *EffectiveUser() const { return fEffectiveUser.c_str(); }
106  XrdProofGroupMgr *GroupsMgr() const { return fGroupsMgr; }
107  XrdProofSched *ProofSched() const { return fProofSched; }
108  XrdProofdProofServMgr *SessionMgr() const { return fSessionMgr; }
109  XrdProofdNetMgr *NetMgr() const { return fNetMgr; }
110  XrdProofdAdmin *Admin() const { return fAdmin; }
111  XrdROOTMgr *ROOTMgr() const { return fROOTMgr; }
112  XrdProofdPriorityMgr *PriorityMgr() const { return fPriorityMgr; }
113  XrdScheduler *Sched() const { return fSched; }
114 
115  XrdProtocol *Xrootd() const { return fXrootd; }
116 
117  // Request processor
118  int Process(XrdProofdProtocol *p);
119 
120  private:
121  XrdSysRecMutex fMutex; // Atomize this instance
122 
123  bool fSuperMst; // true if this node is a SuperMst
124  bool fRemotePLite; // true if remote PLite mode is allowed
125 
126  XrdOucString fAdminPath; // Path to the PROOF admin area
127 
128  int fSrvType; // Master, Submaster, Worker or any
129  XrdOucString fEffectiveUser; // Effective user
130  XrdOucString fHost; // local host name
131  int fPort; // Port for client-like connections
132  XrdOucString fImage; // image name for these servers
133  XrdOucString fWorkDir; // working dir for these servers
134  XrdOucString fMUWorkDir; // template working dir in multi-user mode
135  int fCronFrequency; // Frequency of cron checks
136 
137  XrdOucString fBareLibPath; // LIBPATH cleaned from ROOT dists
138  XrdOucString fSockPathDir; // directory for Unix sockets
139  XrdOucString fTMPdir; // directory for temporary files
140  XrdOucString fPoolURL; // Local pool URL
141  XrdOucString fNamespace; // Local pool namespace
142  XrdOucString fLocalroot; // Local root prefix (directive oss.localroot)
143  XrdOucString fDataDir; // Directory under which to create the sub-dirs for users data
144  XrdOucString fDataDirOpts; // String specifying options for fDataDir handling
145  XrdOucString fDataDirUrlOpts; // String specifying URL type options for fDataDir
146  XrdOucString fDataSetExp; // List of local dataset repositories to be asserted
147  XrdOucString fStageReqRepo; // Directive for staging requests
148 
149  XrdProtocol *fXrootd; // Reference instance of XrdXrootdProtocol
150  XrdOucString fXrootdLibPath; // Path to 'xrootd' plug-in
151  XrdSysPlugin *fXrootdPlugin; // 'xrootd' plug-in handler
152 
153  // Services
154  XrdProofdClientMgr *fClientMgr; // Client manager
155  XrdProofGroupMgr *fGroupsMgr; // Groups manager
156  XrdProofSched *fProofSched; // Instance of the PROOF scheduler
157  XrdProofdProofServMgr *fSessionMgr; // Proof session manager
158  XrdProofdNetMgr *fNetMgr; // Proof network manager
159  XrdProofdAdmin *fAdmin; // Admin services
160  XrdROOTMgr *fROOTMgr; // ROOT versions manager
161  XrdProofdPriorityMgr *fPriorityMgr;// Priority manager
162 
163  XrdScheduler *fSched; // System scheduler
164 
165  XrdOucString fSuperUsers; // ':' separated list of privileged users
166  //
167  int fOperationMode; // Operation mode
168  XrdOucHash<int> fAllowedUsers; // UNIX users allowed in controlled mode
169  XrdOucHash<int> fAllowedGroups; // UNIX groups allowed in controlled mode
170  bool fMultiUser; // Allow/disallow multi-user mode
171  bool fChangeOwn; // TRUE is ownership has to be changed
172 
173  // Lib paths for proofserv
174  bool fRemoveROOTLibPaths; // If true the existing ROOT lib paths are removed
175  XrdOucHash<XrdOucString> fLibPathsToRemove; // Additional paths to be removed
176 
177  //
178  // Lists
179  std::list<XrdOucString *> fMastersAllowed; // list of master (domains) allowed
180  std::list<XrdProofdDSInfo *> fDataSetSrcs; // sources of dataset info
181 
182  // Temporary storage: not to be trusted after construction
183  char *fParms;
184  XrdProtocol_Config *fPi;
185 
186 
187  int DoDirectiveAllow(char *, XrdOucStream *, bool);
188  int DoDirectiveAllowedGroups(char *, XrdOucStream *, bool);
189  int DoDirectiveAllowedUsers(char *, XrdOucStream *, bool);
190  int DoDirectiveDataDir(char *, XrdOucStream *, bool);
191  int DoDirectiveDataSetSrc(char *, XrdOucStream *, bool);
192  int DoDirectiveDataSetReqRepo(char *, XrdOucStream *, bool);
193  int DoDirectiveFilterLibPaths(char *, XrdOucStream *, bool);
194  int DoDirectiveGroupfile(char *, XrdOucStream *, bool);
195  int DoDirectiveMaxOldLogs(char *, XrdOucStream *, bool);
196  int DoDirectiveMultiUser(char *, XrdOucStream *, bool);
197  int DoDirectivePort(char *, XrdOucStream *, bool);
198  int DoDirectiveRole(char *, XrdOucStream *, bool);
199  int DoDirectiveRootd(char *, XrdOucStream *, bool);
200  int DoDirectiveRootdAllow(char *, XrdOucStream *, bool);
201  int DoDirectiveTrace(char *, XrdOucStream *, bool);
202  int DoDirectiveXrootd(char *, XrdOucStream *, bool);
203 
204  bool ValidateLocalDataSetSrc(XrdOucString &url, bool &local);
205 
206  // Load services
207  XrdProofSched *LoadScheduler();
208  XrdProtocol *LoadXrootd(char *parms, XrdProtocol_Config *pi, XrdSysError *edest);
209 };
210 
211 // Aux structures
212 typedef struct {
213  XrdProofdClientMgr *fClientMgr;
214  XrdProofdProofServMgr *fSessionMgr;
215  XrdProofSched *fProofSched;
216 } XpdManagerCron_t;
217 
218 #endif