Logo ROOT   6.10/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 
54 class XrdSysPlugin;
55 
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);
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  const char *RootdExe() const { return fRootdExe.c_str(); }
100  const char **RootdArgs() const { return fRootdArgsPtrs; }
101  bool IsRootdAllowed(const char *host);
102  rpdunixsrv *RootdUnixSrv() const { return fRootdUnixSrv; }
103  bool RootdFork() const { return fRootdFork; }
104 
105  bool RemotePLite() const { return fRemotePLite; }
106 
107  std::list<XrdProofdDSInfo *> *DataSetSrcs() { return &fDataSetSrcs; }
108 
109  // Services
111  const char *EffectiveUser() const { return fEffectiveUser.c_str(); }
112  XrdProofGroupMgr *GroupsMgr() const { return fGroupsMgr; }
113  XrdProofSched *ProofSched() const { return fProofSched; }
115  XrdProofdNetMgr *NetMgr() const { return fNetMgr; }
116  XrdProofdAdmin *Admin() const { return fAdmin; }
117  XrdROOTMgr *ROOTMgr() const { return fROOTMgr; }
119  XrdScheduler *Sched() const { return fSched; }
120 
121  XrdProtocol *Xrootd() const { return fXrootd; }
122 
123  // Request processor
124  int Process(XrdProofdProtocol *p);
125 
126  private:
127  XrdSysRecMutex fMutex; // Atomize this instance
128 
129  bool fSuperMst; // true if this node is a SuperMst
130  bool fRemotePLite; // true if remote PLite mode is allowed
131 
132  XrdOucString fAdminPath; // Path to the PROOF admin area
133 
134  int fSrvType; // Master, Submaster, Worker or any
135  XrdOucString fEffectiveUser; // Effective user
136  XrdOucString fHost; // local host name
137  int fPort; // Port for client-like connections
138  XrdOucString fImage; // image name for these servers
139  XrdOucString fWorkDir; // working dir for these servers
140  XrdOucString fMUWorkDir; // template working dir in multi-user mode
141  int fCronFrequency; // Frequency of cron checks
142 
143  XrdOucString fBareLibPath; // LIBPATH cleaned from ROOT dists
144  XrdOucString fSockPathDir; // directory for Unix sockets
145  XrdOucString fTMPdir; // directory for temporary files
146  XrdOucString fPoolURL; // Local pool URL
147  XrdOucString fNamespace; // Local pool namespace
148  XrdOucString fLocalroot; // Local root prefix (directive oss.localroot)
149  XrdOucString fDataDir; // Directory under which to create the sub-dirs for users data
150  XrdOucString fDataDirOpts; // String specifying options for fDataDir handling
151  XrdOucString fDataDirUrlOpts; // String specifying URL type options for fDataDir
152  XrdOucString fDataSetExp; // List of local dataset repositories to be asserted
153  XrdOucString fStageReqRepo; // Directive for staging requests
154 
155 
156  XrdOucString fRootdExe; // Path to 'rootd' to be use for protocol 'rootd://'
157  std::list<XrdOucString> fRootdArgs;// Rootd arguments
158  const char **fRootdArgsPtrs; // Null terminated array of arguments to execv 'rootd'
159  std::list<XrdOucString> fRootdAllow;// Host allowed to open files via 'rootd'
160  rpdunixsrv *fRootdUnixSrv; // Unix socket for rootd callbacks
161  bool fRootdFork; // If true use fork to start rootd
162 
163  XrdProtocol *fXrootd; // Reference instance of XrdXrootdProtocol
164  XrdOucString fXrootdLibPath; // Path to 'xrootd' plug-in
165  XrdSysPlugin *fXrootdPlugin; // 'xrootd' plug-in handler
166 
167  // Services
168  XrdProofdClientMgr *fClientMgr; // Client manager
169  XrdProofGroupMgr *fGroupsMgr; // Groups manager
170  XrdProofSched *fProofSched; // Instance of the PROOF scheduler
171  XrdProofdProofServMgr *fSessionMgr; // Proof session manager
172  XrdProofdNetMgr *fNetMgr; // Proof network manager
173  XrdProofdAdmin *fAdmin; // Admin services
174  XrdROOTMgr *fROOTMgr; // ROOT versions manager
175  XrdProofdPriorityMgr *fPriorityMgr;// Priority manager
176 
177  XrdScheduler *fSched; // System scheduler
178 
179  XrdOucString fSuperUsers; // ':' separated list of privileged users
180  //
181  int fOperationMode; // Operation mode
182  XrdOucHash<int> fAllowedUsers; // UNIX users allowed in controlled mode
183  XrdOucHash<int> fAllowedGroups; // UNIX groups allowed in controlled mode
184  bool fMultiUser; // Allow/disallow multi-user mode
185  bool fChangeOwn; // TRUE is ownership has to be changed
186 
187  // Lib paths for proofserv
188  bool fRemoveROOTLibPaths; // If true the existing ROOT lib paths are removed
189  XrdOucHash<XrdOucString> fLibPathsToRemove; // Additional paths to be removed
190 
191  //
192  // Lists
193  std::list<XrdOucString *> fMastersAllowed; // list of master (domains) allowed
194  std::list<XrdProofdDSInfo *> fDataSetSrcs; // sources of dataset info
195 
196  // Temporary storage: not to be trusted after construction
197  char *fParms;
198  XrdProtocol_Config *fPi;
199 
200 
201  int DoDirectiveAllow(char *, XrdOucStream *, bool);
202  int DoDirectiveAllowedGroups(char *, XrdOucStream *, bool);
203  int DoDirectiveAllowedUsers(char *, XrdOucStream *, bool);
204  int DoDirectiveDataDir(char *, XrdOucStream *, bool);
205  int DoDirectiveDataSetSrc(char *, XrdOucStream *, bool);
206  int DoDirectiveDataSetReqRepo(char *, XrdOucStream *, bool);
207  int DoDirectiveFilterLibPaths(char *, XrdOucStream *, bool);
208  int DoDirectiveGroupfile(char *, XrdOucStream *, bool);
209  int DoDirectiveMaxOldLogs(char *, XrdOucStream *, bool);
210  int DoDirectiveMultiUser(char *, XrdOucStream *, bool);
211  int DoDirectivePort(char *, XrdOucStream *, bool);
212  int DoDirectiveRole(char *, XrdOucStream *, bool);
213  int DoDirectiveRootd(char *, XrdOucStream *, bool);
214  int DoDirectiveRootdAllow(char *, XrdOucStream *, bool);
215  int DoDirectiveTrace(char *, XrdOucStream *, bool);
216  int DoDirectiveXrootd(char *, XrdOucStream *, bool);
217 
218  bool ValidateLocalDataSetSrc(XrdOucString &url, bool &local);
219 
220  // Load services
222  XrdProtocol *LoadXrootd(char *parms, XrdProtocol_Config *pi, XrdSysError *edest);
223 };
224 
225 // Aux structures
226 typedef struct {
231 
232 #endif
XrdProofdProofServMgr * fSessionMgr
const char * WorkDir() 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 ...
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.
const char * RootdExe() const
XrdOucString fDataDir
XrdProofdProofServMgr * SessionMgr() const
int DoDirectiveRole(char *, XrdOucStream *, bool)
Process &#39;role&#39; directive.
const char * BareLibPath() const
XrdOucString fSuperUsers
const double pi
std::list< XrdOucString * > fMastersAllowed
XrdProofdNetMgr * NetMgr() const
#define XrdSysRecMutex
Definition: XrdSysToOuc.h:18
int Config(bool rcf=0)
Run configuration and parse the entered config directives.
XrdROOTMgr * fROOTMgr
virtual ~XrdProofdManager()
Destructor.
XrdOucString fLocalroot
int Process(XrdProofdProtocol *p)
Process manager request.
XrdScheduler * Sched() const
XrdOucString fPoolURL
XrdOucHash< int > fAllowedUsers
XrdProtocol * fXrootd
XrdProofdManager(char *parms, XrdProtocol_Config *pi, XrdSysError *edest)
Constructor.
XrdScheduler * fSched
bool ChangeOwn() const
const char * DataDir() const
XrdProofdAdmin * Admin() const
XrdSysRecMutex fMutex
XrdProofdPriorityMgr * fPriorityMgr
rpdunixsrv * RootdUnixSrv() const
bool RootdFork() const
const char * StageReqRepo() const
const char * SockPathDir() const
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.
XrdProofSched * ProofSched() const
XrdProofGroupMgr * GroupsMgr() const
XrdOucString fEffectiveUser
XrdOucString fStageReqRepo
int SrvType() const
XrdProofdClientMgr * fClientMgr
int DoDirectiveAllowedGroups(char *, XrdOucStream *, bool)
Process &#39;allowedgroups&#39; directive.
XrdOucString fMUWorkDir
const char * NameSpace() 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.
XrdProofSched * fProofSched
XrdOucString fBareLibPath
int DoDirectiveDataSetReqRepo(char *, XrdOucStream *, bool)
int DoDirectiveAllow(char *, XrdOucStream *, bool)
Process &#39;allow&#39; directive.
const char * DataDirUrlOpts() const
XrdSysPlugin * fXrootdPlugin
bool MultiUser() const
std::list< XrdProofdDSInfo * > fDataSetSrcs
XrdSysRecMutex * Mutex()
std::list< XrdOucString > fRootdArgs
const char ** RootdArgs() const
bool IsRootdAllowed(const char *host)
Check if &#39;host&#39; is allowed to access files via rootd.
const char * Host() 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
#define XrdSysPlugin
Definition: XpdSysPlugin.h:8
TMarker * m
Definition: textangle.C:8
XrdOucString fNamespace
XrdProtocol_Config * fPi
XrdProofdClientMgr * ClientMgr() const
rpdunixsrv * fRootdUnixSrv
XrdOucString fRootdExe
XrdOucString fImage
std::list< XrdProofdDSInfo * > * DataSetSrcs()
const char * TMPdir() const
void RegisterDirectives()
Register directives for configuration.
XrdROOTMgr * ROOTMgr() 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
const char * LocalROOT() const
std::list< XrdOucString > fRootdAllow
XrdOucHash< XrdOucString > fLibPathsToRemove
XrdProtocol * Xrootd() const
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
const char * AdminPath() const
const char * EffectiveUser() const
XrdProtocol * LoadXrootd(char *parms, XrdProtocol_Config *pi, XrdSysError *edest)
Load the Xrootd protocol, if required.
const char * PoolURL() const
XrdOucString fDataDirOpts
XrdProofdNetMgr * fNetMgr
XrdProofdAdmin * fAdmin
int DoDirectiveGroupfile(char *, XrdOucStream *, bool)
Process &#39;groupfile&#39; directive.
int DoDirectivePort(char *, XrdOucStream *, bool)
Process &#39;xrd.protocol&#39; directive to find the port.
int DoDirectiveMultiUser(char *, XrdOucStream *, bool)
Process &#39;multiuser&#39; directive.
XrdProofdPriorityMgr * PriorityMgr() const
XrdOucString fWorkDir
const char * DataDirOpts() const
bool IsSuperMst() const
void CheckLogFileOwnership()
Make sure that the log file belongs to the original effective user.
const char * Image() const
int DoDirectiveDataSetSrc(char *, XrdOucStream *, bool)
Process &#39;datasetsrc&#39; directive.
const char * DataSetExp() const
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).
bool RemotePLite() const
int DoDirectiveAllowedUsers(char *, XrdOucStream *, bool)
Process &#39;allowedusers&#39; directive.
XrdOucString fTMPdir