Logo ROOT   6.07/09
Reference Guide
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;
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 
55 
56  public:
57  XrdProofdManager(char *parms, XrdProtocol_Config *pi, XrdSysError *edest);
58  virtual ~XrdProofdManager();
59 
60  XrdSysRecMutex *Mutex() { return &fMutex; }
61 
62  // Config
63  int Config(bool rcf = 0);
65  char *val, XrdOucStream *cfg, bool rcf);
66  void RegisterDirectives();
67 
68  int ResolveKeywords(XrdOucString &s, XrdProofdClient *pcl);
69 
70  int GetWorkers(XrdOucString &workers, XrdProofdProofServ *, const char *);
71 
72  const char *AdminPath() const { return fAdminPath.c_str(); }
73  const char *BareLibPath() const { return fBareLibPath.c_str(); }
74  bool ChangeOwn() const { return fChangeOwn; }
75  void CheckLogFileOwnership();
76  bool CheckMaster(const char *m);
77  int CheckUser(const char *usr, const char *grp, XrdProofUI &ui, XrdOucString &e, bool &su);
78  int CronFrequency() { return fCronFrequency; }
79  const char *Host() const { return fHost.c_str(); }
80  const char *Image() const { return fImage.c_str(); }
81  bool IsSuperMst() const { return fSuperMst; }
82  const char *LocalROOT() const { return fLocalroot.c_str(); }
83  bool MultiUser() const { return fMultiUser; }
84  const char *NameSpace() const { return fNamespace.c_str(); }
85  const char *PoolURL() const { return fPoolURL.c_str(); }
86  int Port() const { return fPort; }
87  int SrvType() const { return fSrvType; }
88  const char *SockPathDir() const { return fSockPathDir.c_str(); }
89  const char *TMPdir() const { return fTMPdir.c_str(); }
90  const char *WorkDir() const { return fWorkDir.c_str(); }
91  const char *DataDir() const { return fDataDir.c_str(); }
92  const char *DataDirOpts() const { return fDataDirOpts.c_str(); }
93  const char *DataDirUrlOpts() const { return fDataDirUrlOpts.c_str(); }
94  const char *DataSetExp() const { return fDataSetExp.c_str(); }
95  const char *StageReqRepo() const { return fStageReqRepo.c_str(); }
96 
97  const char *RootdExe() const { return fRootdExe.c_str(); }
98  const char **RootdArgs() const { return fRootdArgsPtrs; }
99  bool IsRootdAllowed(const char *host);
100  rpdunixsrv *RootdUnixSrv() const { return fRootdUnixSrv; }
101  bool RootdFork() const { return fRootdFork; }
102 
103  bool RemotePLite() const { return fRemotePLite; }
104 
105  std::list<XrdProofdDSInfo *> *DataSetSrcs() { return &fDataSetSrcs; }
106 
107  // Services
109  const char *EffectiveUser() const { return fEffectiveUser.c_str(); }
110  XrdProofGroupMgr *GroupsMgr() const { return fGroupsMgr; }
111  XrdProofSched *ProofSched() const { return fProofSched; }
113  XrdProofdNetMgr *NetMgr() const { return fNetMgr; }
114  XrdProofdAdmin *Admin() const { return fAdmin; }
115  XrdROOTMgr *ROOTMgr() const { return fROOTMgr; }
117  XrdScheduler *Sched() const { return fSched; }
118 
119  XrdProtocol *Xrootd() const { return fXrootd; }
120 
121  // Request processor
122  int Process(XrdProofdProtocol *p);
123 
124  private:
125  XrdSysRecMutex fMutex; // Atomize this instance
126 
127  bool fSuperMst; // true if this node is a SuperMst
128  bool fRemotePLite; // true if remote PLite mode is allowed
129 
130  XrdOucString fAdminPath; // Path to the PROOF admin area
131 
132  int fSrvType; // Master, Submaster, Worker or any
133  XrdOucString fEffectiveUser; // Effective user
134  XrdOucString fHost; // local host name
135  int fPort; // Port for client-like connections
136  XrdOucString fImage; // image name for these servers
137  XrdOucString fWorkDir; // working dir for these servers
138  XrdOucString fMUWorkDir; // template working dir in multi-user mode
139  int fCronFrequency; // Frequency of cron checks
140 
141  XrdOucString fBareLibPath; // LIBPATH cleaned from ROOT dists
142  XrdOucString fSockPathDir; // directory for Unix sockets
143  XrdOucString fTMPdir; // directory for temporary files
144  XrdOucString fPoolURL; // Local pool URL
145  XrdOucString fNamespace; // Local pool namespace
146  XrdOucString fLocalroot; // Local root prefix (directive oss.localroot)
147  XrdOucString fDataDir; // Directory under which to create the sub-dirs for users data
148  XrdOucString fDataDirOpts; // String specifying options for fDataDir handling
149  XrdOucString fDataDirUrlOpts; // String specifying URL type options for fDataDir
150  XrdOucString fDataSetExp; // List of local dataset repositories to be asserted
151  XrdOucString fStageReqRepo; // Directive for staging requests
152 
153 
154  XrdOucString fRootdExe; // Path to 'rootd' to be use for protocol 'rootd://'
155  std::list<XrdOucString> fRootdArgs;// Rootd arguments
156  const char **fRootdArgsPtrs; // Null terminated array of arguments to execv 'rootd'
157  std::list<XrdOucString> fRootdAllow;// Host allowed to open files via 'rootd'
158  rpdunixsrv *fRootdUnixSrv; // Unix socket for rootd callbacks
159  bool fRootdFork; // If true use fork to start rootd
160 
161  XrdProtocol *fXrootd; // Reference instance of XrdXrootdProtocol
162  XrdOucString fXrootdLibPath; // Path to 'xrootd' plug-in
163 
164  // Services
165  XrdProofdClientMgr *fClientMgr; // Client manager
166  XrdProofGroupMgr *fGroupsMgr; // Groups manager
167  XrdProofSched *fProofSched; // Instance of the PROOF scheduler
168  XrdProofdProofServMgr *fSessionMgr; // Proof session manager
169  XrdProofdNetMgr *fNetMgr; // Proof network manager
170  XrdProofdAdmin *fAdmin; // Admin services
171  XrdROOTMgr *fROOTMgr; // ROOT versions manager
172  XrdProofdPriorityMgr *fPriorityMgr;// Priority manager
173 
174  XrdScheduler *fSched; // System scheduler
175 
176  XrdOucString fSuperUsers; // ':' separated list of privileged users
177  //
178  int fOperationMode; // Operation mode
179  XrdOucHash<int> fAllowedUsers; // UNIX users allowed in controlled mode
180  XrdOucHash<int> fAllowedGroups; // UNIX groups allowed in controlled mode
181  bool fMultiUser; // Allow/disallow multi-user mode
182  bool fChangeOwn; // TRUE is ownership has to be changed
183 
184  // Lib paths for proofserv
185  bool fRemoveROOTLibPaths; // If true the existing ROOT lib paths are removed
186  XrdOucHash<XrdOucString> fLibPathsToRemove; // Additional paths to be removed
187 
188  //
189  // Lists
190  std::list<XrdOucString *> fMastersAllowed; // list of master (domains) allowed
191  std::list<XrdProofdDSInfo *> fDataSetSrcs; // sources of dataset info
192 
193  // Temporary storage: not to be trusted after construction
194  char *fParms;
195  XrdProtocol_Config *fPi;
196 
197 
198  int DoDirectiveAllow(char *, XrdOucStream *, bool);
199  int DoDirectiveAllowedGroups(char *, XrdOucStream *, bool);
200  int DoDirectiveAllowedUsers(char *, XrdOucStream *, bool);
201  int DoDirectiveDataDir(char *, XrdOucStream *, bool);
202  int DoDirectiveDataSetSrc(char *, XrdOucStream *, bool);
203  int DoDirectiveDataSetReqRepo(char *, XrdOucStream *, bool);
204  int DoDirectiveFilterLibPaths(char *, XrdOucStream *, bool);
205  int DoDirectiveGroupfile(char *, XrdOucStream *, bool);
206  int DoDirectiveMaxOldLogs(char *, XrdOucStream *, bool);
207  int DoDirectiveMultiUser(char *, XrdOucStream *, bool);
208  int DoDirectivePort(char *, XrdOucStream *, bool);
209  int DoDirectiveRole(char *, XrdOucStream *, bool);
210  int DoDirectiveRootd(char *, XrdOucStream *, bool);
211  int DoDirectiveRootdAllow(char *, XrdOucStream *, bool);
212  int DoDirectiveTrace(char *, XrdOucStream *, bool);
213  int DoDirectiveXrootd(char *, XrdOucStream *, bool);
214 
215  bool ValidateLocalDataSetSrc(XrdOucString &url, bool &local);
216 
217  // Load services
219  XrdProtocol *LoadXrootd(char *parms, XrdProtocol_Config *pi, XrdSysError *edest);
220 };
221 
222 // Aux structures
223 typedef struct {
228 
229 #endif
XrdProofdProofServMgr * fSessionMgr
bool ChangeOwn() const
int DoDirectiveXrootd(char *, XrdOucStream *, bool)
Process &#39;xrootd&#39; directive xpd.xrootd [path/]libXrdXrootd.so.
int DoDirectiveRootdAllow(char *, XrdOucStream *, bool)
Process &#39;rootdallow&#39; directive xpd.rootdallow host1,host2 host3 Host names may contain the wild card ...
XrdProofdClientMgr * ClientMgr() const
const char * DataDirUrlOpts() const
int DoDirectiveFilterLibPaths(char *, XrdOucStream *, bool)
Process &#39;filterlibpaths&#39; directive xpd.filterlibpaths 1|0 [path1,path2 path3 path4 ...
XrdProofdClientMgr * fClientMgr
int GetWorkers(XrdOucString &workers, XrdProofdProofServ *, const char *)
Get a list of workers from the available resource broker.
XrdOucString fDataDir
int DoDirectiveRole(char *, XrdOucStream *, bool)
Process &#39;role&#39; directive.
const char * PoolURL() const
XrdOucString fSuperUsers
const double pi
std::list< XrdOucString * > fMastersAllowed
const char * SockPathDir() const
const char ** RootdArgs() const
#define XrdSysRecMutex
Definition: XrdSysToOuc.h:18
int Config(bool rcf=0)
Run configuration and parse the entered config directives.
const char * DataDir() const
int SrvType() const
XrdProofGroupMgr * GroupsMgr() const
XrdROOTMgr * fROOTMgr
virtual ~XrdProofdManager()
Destructor.
XrdOucString fLocalroot
int Process(XrdProofdProtocol *p)
Process manager request.
const char * RootdExe() const
XrdOucString fPoolURL
int Port() const
const char * BareLibPath() const
XrdProofdProofServMgr * SessionMgr() const
XrdOucHash< int > fAllowedUsers
bool MultiUser() const
XrdProtocol * fXrootd
XrdProofdManager(char *parms, XrdProtocol_Config *pi, XrdSysError *edest)
Constructor.
XrdScheduler * fSched
XrdSysRecMutex fMutex
XrdProofdPriorityMgr * fPriorityMgr
int DoDirectiveRootd(char *, XrdOucStream *, bool)
Process &#39;rootd&#39; directive xpd.rootd deny|allow [rootsys:<tag>] [path:abs-path/] [mode:ro|rw] [auth:no...
XrdProofSched * LoadScheduler()
Load PROOF scheduler.
XrdProofGroupMgr * fGroupsMgr
int DoDirective(XrdProofdDirective *d, char *val, XrdOucStream *cfg, bool rcf)
Update the priorities of the active sessions.
const char * DataSetExp() const
XrdOucString fEffectiveUser
XrdOucString fStageReqRepo
XrdProofdClientMgr * fClientMgr
int DoDirectiveAllowedGroups(char *, XrdOucStream *, bool)
Process &#39;allowedgroups&#39; directive.
XrdProtocol * Xrootd() const
XrdOucString fMUWorkDir
XrdProofSched * ProofSched() const
int DoDirectiveTrace(char *, XrdOucStream *, bool)
Scan the config file for tracing settings.
int DoDirectiveDataDir(char *, XrdOucStream *, bool)
Process &#39;datadir&#39; directive.
XrdProofSched * fProofSched
bool CheckMaster(const char *m)
Check if master &#39;m&#39; is allowed to connect to this host.
const char * NameSpace() const
XrdProofSched * fProofSched
XrdOucString fBareLibPath
int DoDirectiveDataSetReqRepo(char *, XrdOucStream *, bool)
int DoDirectiveAllow(char *, XrdOucStream *, bool)
Process &#39;allow&#39; directive.
const char * Image() const
std::list< XrdProofdDSInfo * > fDataSetSrcs
XrdSysRecMutex * Mutex()
std::list< XrdOucString > fRootdArgs
bool IsRootdAllowed(const char *host)
Check if &#39;host&#39; is allowed to access files via rootd.
XrdScheduler * Sched() const
int CheckUser(const char *usr, const char *grp, XrdProofUI &ui, XrdOucString &e, bool &su)
Check if the user is allowed to use the system Return 0 if OK, -1 if not.
#define XrdSysError
Definition: XpdSysError.h:8
XrdOucString fHost
XrdOucString fDataDirUrlOpts
TMarker * m
Definition: textangle.C:8
XrdOucString fNamespace
bool IsSuperMst() const
XrdProtocol_Config * fPi
rpdunixsrv * fRootdUnixSrv
XrdProofdAdmin * Admin() const
XrdProofdNetMgr * NetMgr() const
XrdOucString fRootdExe
XrdOucString fImage
std::list< XrdProofdDSInfo * > * DataSetSrcs()
const char * StageReqRepo() const
const char * AdminPath() const
void RegisterDirectives()
Register directives for configuration.
rpdunixsrv * RootdUnixSrv() const
XrdProofdProofServMgr * fSessionMgr
XrdOucHash< int > fAllowedGroups
const char ** fRootdArgsPtrs
int ResolveKeywords(XrdOucString &s, XrdProofdClient *pcl)
Resolve special keywords in &#39;s&#39; for client &#39;pcl&#39;.
XrdOucString fDataSetExp
std::list< XrdOucString > fRootdAllow
XrdOucHash< XrdOucString > fLibPathsToRemove
const char * Host() const
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
XrdProtocol * LoadXrootd(char *parms, XrdProtocol_Config *pi, XrdSysError *edest)
Load the Xrootd protocol, if required.
XrdOucString fDataDirOpts
XrdProofdNetMgr * fNetMgr
XrdProofdAdmin * fAdmin
int DoDirectiveGroupfile(char *, XrdOucStream *, bool)
Process &#39;groupfile&#39; directive.
const char * LocalROOT() const
int DoDirectivePort(char *, XrdOucStream *, bool)
Process &#39;xrd.protocol&#39; directive to find the port.
XrdProofdPriorityMgr * PriorityMgr() const
int DoDirectiveMultiUser(char *, XrdOucStream *, bool)
Process &#39;multiuser&#39; directive.
XrdOucString fWorkDir
const char * EffectiveUser() const
void CheckLogFileOwnership()
Make sure that the log file belongs to the original effective user.
XrdROOTMgr * ROOTMgr() const
const char * DataDirOpts() const
int DoDirectiveDataSetSrc(char *, XrdOucStream *, bool)
Process &#39;datasetsrc&#39; directive.
XrdOucString fXrootdLibPath
int DoDirectiveMaxOldLogs(char *, XrdOucStream *, bool)
Process &#39;maxoldlogs&#39; directive.
XrdOucString fSockPathDir
XrdOucString fAdminPath
bool ValidateLocalDataSetSrc(XrdOucString &url, bool &local)
Validate local dataset src at URL (check the URL and make the relevant directories).
const char * TMPdir() const
bool RemotePLite() const
bool RootdFork() const
int DoDirectiveAllowedUsers(char *, XrdOucStream *, bool)
Process &#39;allowedusers&#39; directive.
XrdOucString fTMPdir
const char * WorkDir() const