ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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;
45 class XrdProofdProtocol;
46 class XrdProofGroupMgr;
47 class XrdProofSched;
48 class XrdProofdProofServ;
49 class XrdProofWorker;
50 class XrdROOT;
51 class XrdROOTMgr;
52 
54 
55  public:
56  XrdProofdManager(XrdProtocol_Config *pi, XrdSysError *edest);
57  virtual ~XrdProofdManager();
58 
59  XrdSysRecMutex *Mutex() { return &fMutex; }
60 
61  // Config
62  int Config(bool rcf = 0);
64  char *val, XrdOucStream *cfg, bool rcf);
65  void RegisterDirectives();
66 
67  int ResolveKeywords(XrdOucString &s, XrdProofdClient *pcl);
68 
69  int GetWorkers(XrdOucString &workers, XrdProofdProofServ *, const char *);
70 
71  const char *AdminPath() const { return fAdminPath.c_str(); }
72  const char *BareLibPath() const { return fBareLibPath.c_str(); }
73  bool ChangeOwn() const { return fChangeOwn; }
74  void CheckLogFileOwnership();
75  bool CheckMaster(const char *m);
76  int CheckUser(const char *usr, const char *grp, XrdProofUI &ui, XrdOucString &e, bool &su);
77  int CronFrequency() { return fCronFrequency; }
78  const char *Host() const { return fHost.c_str(); }
79  const char *Image() const { return fImage.c_str(); }
80  bool IsSuperMst() const { return fSuperMst; }
81  const char *LocalROOT() const { return fLocalroot.c_str(); }
82  bool MultiUser() const { return fMultiUser; }
83  const char *NameSpace() const { return fNamespace.c_str(); }
84  const char *PoolURL() const { return fPoolURL.c_str(); }
85  int Port() const { return fPort; }
86  int SrvType() const { return fSrvType; }
87  const char *SockPathDir() const { return fSockPathDir.c_str(); }
88  const char *TMPdir() const { return fTMPdir.c_str(); }
89  const char *WorkDir() const { return fWorkDir.c_str(); }
90  const char *DataDir() const { return fDataDir.c_str(); }
91  const char *DataDirOpts() const { return fDataDirOpts.c_str(); }
92  const char *DataDirUrlOpts() const { return fDataDirUrlOpts.c_str(); }
93  const char *DataSetExp() const { return fDataSetExp.c_str(); }
94  const char *StageReqRepo() const { return fStageReqRepo.c_str(); }
95 
96  const char *RootdExe() const { return fRootdExe.c_str(); }
97  const char **RootdArgs() const { return fRootdArgsPtrs; }
98  bool IsRootdAllowed(const char *host);
99  rpdunixsrv *RootdUnixSrv() const { return fRootdUnixSrv; }
100  bool RootdFork() const { return fRootdFork; }
101 
102  bool RemotePLite() const { return fRemotePLite; }
103 
104  std::list<XrdProofdDSInfo *> *DataSetSrcs() { return &fDataSetSrcs; }
105 
106  // Services
108  const char *EffectiveUser() const { return fEffectiveUser.c_str(); }
109  XrdProofGroupMgr *GroupsMgr() const { return fGroupsMgr; }
110  XrdProofSched *ProofSched() const { return fProofSched; }
112  XrdProofdNetMgr *NetMgr() const { return fNetMgr; }
113  XrdProofdAdmin *Admin() const { return fAdmin; }
114  XrdROOTMgr *ROOTMgr() const { return fROOTMgr; }
116  XrdScheduler *Sched() const { return fSched; }
117 
118  // Request processor
119  int Process(XrdProofdProtocol *p);
120 
121  private:
122  XrdSysRecMutex fMutex; // Atomize this instance
123 
124  bool fSuperMst; // true if this node is a SuperMst
125  bool fRemotePLite; // true if remote PLite mode is allowed
126 
127  XrdOucString fAdminPath; // Path to the PROOF admin area
128 
129  int fSrvType; // Master, Submaster, Worker or any
130  XrdOucString fEffectiveUser; // Effective user
131  XrdOucString fHost; // local host name
132  int fPort; // Port for client-like connections
133  XrdOucString fImage; // image name for these servers
134  XrdOucString fWorkDir; // working dir for these servers
135  XrdOucString fMUWorkDir; // template working dir in multi-user mode
136  int fCronFrequency; // Frequency of cron checks
137 
138  XrdOucString fBareLibPath; // LIBPATH cleaned from ROOT dists
139  XrdOucString fSockPathDir; // directory for Unix sockets
140  XrdOucString fTMPdir; // directory for temporary files
141  XrdOucString fPoolURL; // Local pool URL
142  XrdOucString fNamespace; // Local pool namespace
143  XrdOucString fLocalroot; // Local root prefix (directive oss.localroot)
144  XrdOucString fDataDir; // Directory under which to create the sub-dirs for users data
145  XrdOucString fDataDirOpts; // String specifying options for fDataDir handling
146  XrdOucString fDataDirUrlOpts; // String specifying URL type options for fDataDir
147  XrdOucString fDataSetExp; // List of local dataset repositories to be asserted
148  XrdOucString fStageReqRepo; // Directive for staging requests
149 
150 
151  XrdOucString fRootdExe; // Path to 'rootd' to be use for protocol 'rootd://'
152  std::list<XrdOucString> fRootdArgs;// Rootd arguments
153  const char **fRootdArgsPtrs; // Null terminated array of arguments to execv 'rootd'
154  std::list<XrdOucString> fRootdAllow;// Host allowed to open files via 'rootd'
155  rpdunixsrv *fRootdUnixSrv; // Unix socket for rootd callbacks
156  bool fRootdFork; // If true use fork to start rootd
157 
158  // Services
159  XrdProofdClientMgr *fClientMgr; // Client manager
160  XrdProofGroupMgr *fGroupsMgr; // Groups manager
161  XrdProofSched *fProofSched; // Instance of the PROOF scheduler
162  XrdProofdProofServMgr *fSessionMgr; // Proof session manager
163  XrdProofdNetMgr *fNetMgr; // Proof network manager
164  XrdProofdAdmin *fAdmin; // Admin services
165  XrdROOTMgr *fROOTMgr; // ROOT versions manager
166  XrdProofdPriorityMgr *fPriorityMgr;// Priority manager
167 
168  XrdScheduler *fSched; // System scheduler
169 
170  XrdOucString fSuperUsers; // ':' separated list of privileged users
171  //
172  int fOperationMode; // Operation mode
173  XrdOucHash<int> fAllowedUsers; // UNIX users allowed in controlled mode
174  XrdOucHash<int> fAllowedGroups; // UNIX groups allowed in controlled mode
175  bool fMultiUser; // Allow/disallow multi-user mode
176  bool fChangeOwn; // TRUE is ownership has to be changed
177 
178  // Lib paths for proofserv
179  bool fRemoveROOTLibPaths; // If true the existing ROOT lib paths are removed
180  XrdOucHash<XrdOucString> fLibPathsToRemove; // Additional paths to be removed
181 
182  //
183  // Lists
184  std::list<XrdOucString *> fMastersAllowed; // list of master (domains) allowed
185  std::list<XrdProofdDSInfo *> fDataSetSrcs; // sources of dataset info
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 
203  bool ValidateLocalDataSetSrc(XrdOucString &url, bool &local);
204 
205  // Scheduling service
207 };
208 
209 // Aux structures
210 typedef struct {
215 
216 #endif
XrdProofdProofServMgr * fSessionMgr
bool ChangeOwn() const
int DoDirectiveRootdAllow(char *, XrdOucStream *, bool)
Process 'rootdallow' 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 'filterlibpaths' 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 'role' 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
XrdScheduler * fSched
XrdSysRecMutex fMutex
XrdProofdPriorityMgr * fPriorityMgr
int DoDirectiveRootd(char *, XrdOucStream *, bool)
Process 'rootd' 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
int d
Definition: tornado.py:11
XrdOucString fEffectiveUser
XrdOucString fStageReqRepo
XrdProofdClientMgr * fClientMgr
XrdProofdManager(XrdProtocol_Config *pi, XrdSysError *edest)
Constructor.
int DoDirectiveAllowedGroups(char *, XrdOucStream *, bool)
Process 'allowedgroups' directive.
XrdOucString fMUWorkDir
XrdProofSched * ProofSched() const
int DoDirectiveTrace(char *, XrdOucStream *, bool)
Scan the config file for tracing settings.
int DoDirectiveDataDir(char *, XrdOucStream *, bool)
Process 'datadir' directive.
XrdProofSched * fProofSched
bool CheckMaster(const char *m)
Check if master 'm' 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 'allow' directive.
const char * Image() const
std::list< XrdProofdDSInfo * > fDataSetSrcs
XrdSysRecMutex * Mutex()
std::list< XrdOucString > fRootdArgs
bool IsRootdAllowed(const char *host)
Check if 'host' 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
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 's' for client 'pcl'.
XrdOucString fDataSetExp
std::list< XrdOucString > fRootdAllow
XrdOucHash< XrdOucString > fLibPathsToRemove
const char * Host() const
XrdOucString fDataDirOpts
XrdProofdNetMgr * fNetMgr
XrdProofdAdmin * fAdmin
int DoDirectiveGroupfile(char *, XrdOucStream *, bool)
Process 'groupfile' directive.
const char * LocalROOT() const
int DoDirectivePort(char *, XrdOucStream *, bool)
Process 'xrd.protocol' directive to find the port.
XrdProofdPriorityMgr * PriorityMgr() const
int DoDirectiveMultiUser(char *, XrdOucStream *, bool)
Process 'multiuser' 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 'datasetsrc' directive.
int DoDirectiveMaxOldLogs(char *, XrdOucStream *, bool)
Process 'maxoldlogs' 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 'allowedusers' directive.
XrdOucString fTMPdir
const char * WorkDir() const