1 # ihm-application.tcl --
2 #
3 # Application object for Host Manager (hm)
4 #
5 # Copyright (c) 1996-2002 The Regents of the University of California.
6 # All rights reserved.
7 #
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions are met:
10 #
11 # A. Redistributions of source code must retain the above copyright notice,
12 # this list of conditions and the following disclaimer.
13 # B. Redistributions in binary form must reproduce the above copyright notice,
14 # this list of conditions and the following disclaimer in the documentation
15 # and/or other materials provided with the distribution.
16 # C. Neither the names of the copyright holders nor the names of its
17 # contributors may be used to endorse or promote products derived from this
18 # software without specific prior written permission.
19 #
20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
21 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
24 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #
31 # @(#) $Header: /usr/mash/src/repository/mash/mash-1/tcl/indiva/ihm/ihm-application.tcl,v 1.4 2002/07/11 19:25:43 weitsang Exp $
32
33 import ActiveServiceApplication
34 import IHMAgent
35 import MashLog
36
37 #--------------------------------------------------------------------------
38 # Class:
39 # IndivaHostManager
40 # Description:
41 # Main application object for host manager (hm). It is responsible
42 # for parsing command lines arguments, initializing user-defined
43 # resources and commands, and creating an HMAgent. The intelligence
44 # of the application lies in HMAgent.
45 # See Also:
46 # HMAgent
47 #--------------------------------------------------------------------------
48 Class IndivaHostManager -superclass { ActiveServiceApplication }
49
50 #--------------------------------------------------------------------------
51 # Method:
52 # IndivaHostManager init
53 # Description:
54 # Initialize default values for command line arguments, parse
55 # command line arguments, and load user hooks. Finally, create
56 # an HM agent and run user hooks.
57 #--------------------------------------------------------------------------
58 IndivaHostManager public init argv {
59 $self next $argv hm
60 set o [$self options]
61 $self init_args $o
62 $self init_resources $o
63 $self init_as_args $o
64 $self init_as_resources $o
65 $o parse_args $argv
66
67 # Source the user's hook file if it exists. The function
68 # user_hook, which may be defined in this file, will be
69 # called at the end of init.
70 if {[$o get_option userhookFile] != ""} {
71 if {[file isfile [$o get_option userhookFile]] && \
72 [file readable [$o get_option userhookFile]]} {
73 source [$o get_option userhookFile]
74 } else {
75 puts stderr "Unable to source \"[$o get_option userhookFile]\". Not a file or not readable."
76 }
77 }
78
79 $self init_local
80
81 # FIXME closing stdout causes any puts statements to crash
82 # hm if it's started in fork mode.
83 if {[$self get_option noLog] != ""} {
84 MashLog off
85 }
86 MashLog timestamp all on
87 MashLog pid all on
88 MashLog file "all" [$self get_option logFile]
89
90 $self add_option execArgs $argv
91 new IHMAgent $self
92
93 $self user_hook
94 }
95
96
97 IndivaHostManager private init_args o {
98 $o register_option -u userhookFile
99
100 $o register_boolean_option -lb loadBalance
101 $o register_boolean_option -fork doFork
102 $o register_boolean_option -glunix glunix
103 $o register_boolean_option -noload noLoad
104 $o register_boolean_option -nolog noLog
105
106 $o register_option -target targetNum
107 $o register_option -int checkInterval
108 $o register_option -path execPath
109 $o register_option -l logFile
110 $o register_option -log logFile
111 $o register_option -rcmd execCmd
112 $o register_option -conffile megaConfFile
113 $o register_option -scriptdir scriptDir
114
115 $o register_option -hm_ctrl_spec hm_ctrl_spec
116 }
117
118
119 IndivaHostManager private init_resources o {
120
121 $o add_default scriptDir /var/tmp
122
123 $o add_default unicastOutput 1
124
125 $o add_default lambda 5.0
126 $o add_default maxWait 15000
127 $o add_default maxPending 5
128
129 $o add_default minPort 10000
130 $o add_default maxPorts 10000
131
132 $o add_default checkFactor 2
133
134 $o add_default checkInterval 20000
135 $o add_default deathInterval 10000
136 $o add_default minDeathWait 60000
137
138 $o add_default highLoad 1.00
139 $o add_default lowLoad 0.05
140 $o add_default noLoad yes
141 $o add_default execPath [pwd]
142 $o add_default execCmd "ssh -n"
143 $o add_default minHmNum 1
144 $o add_default loadSamples 2
145 $o add_default logFile stdout
146 $o add_default megaConfFile mega.conf
147 $o add_default link no
148
149 $o add_default allow_distrib no
150 $o add_default glob_chan 224.4.5.28/55000/15
151 $o add_default hm_ctrl_spec 224.4.5.28/55000/15
152 }
153
154 # vim:ts=8:sw=4:expandtab
155
156
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.