Revision 670e954a
b/.gitignore | ||
---|---|---|
124 | 124 |
/src/mon-collector |
125 | 125 |
/src/htools |
126 | 126 |
/src/hconfd |
127 |
/src/hqueryd |
|
127 | 128 |
/src/ganeti-confd |
129 |
/src/ganeti-queryd |
|
128 | 130 |
/src/ganeti-mond |
129 | 131 |
/src/rpc-test |
130 | 132 |
|
b/Makefile.am | ||
---|---|---|
201 | 201 |
$(HS_ALL_PROGS) $(HS_BUILT_SRCS) \ |
202 | 202 |
$(HS_BUILT_TEST_HELPERS) \ |
203 | 203 |
src/ganeti-confd \ |
204 |
src/ganeti-queryd \ |
|
204 | 205 |
src/ganeti-mond \ |
205 | 206 |
.hpc/*.mix src/*.tix test/hs/*.tix \ |
206 | 207 |
doc/hs-lint.html |
... | ... | |
214 | 215 |
if WANT_HTOOLS |
215 | 216 |
HS_GENERATED_FILES += $(HS_PROGS) |
216 | 217 |
if ENABLE_CONFD |
217 |
HS_GENERATED_FILES += src/hconfd src/ganeti-confd |
|
218 |
HS_GENERATED_FILES += src/hconfd src/ganeti-confd src/hqueryd src/ganeti-queryd
|
|
218 | 219 |
endif |
219 | 220 |
|
220 | 221 |
if ENABLE_MOND |
... | ... | |
478 | 479 |
HS_COMPILE_PROGS= \ |
479 | 480 |
src/ganeti-mond \ |
480 | 481 |
src/hconfd \ |
482 |
src/hqueryd \ |
|
481 | 483 |
src/rpc-test |
482 | 484 |
|
483 | 485 |
# All Haskell non-test programs to be compiled but not automatically installed |
... | ... | |
868 | 870 |
src/ganeti-confd: src/hconfd |
869 | 871 |
cp -f $< $@ |
870 | 872 |
|
873 |
src/ganeti-queryd: src/hqueryd |
|
874 |
cp -f $< $@ |
|
875 |
|
|
871 | 876 |
nodist_sbin_SCRIPTS += src/ganeti-confd |
877 |
nodist_sbin_SCRIPTS += src/ganeti-queryd |
|
872 | 878 |
endif |
873 | 879 |
|
874 | 880 |
if ENABLE_MOND |
... | ... | |
1532 | 1538 |
echo "RAPI_GROUP = '$(RAPI_GROUP)'"; \ |
1533 | 1539 |
echo "CONFD_USER = '$(CONFD_USER)'"; \ |
1534 | 1540 |
echo "CONFD_GROUP = '$(CONFD_GROUP)'"; \ |
1541 |
echo "QUERYD_USER = '$(QUERYD_USER)'"; \ |
|
1542 |
echo "QUERYD_GROUP = '$(QUERYD_GROUP)'"; \ |
|
1535 | 1543 |
echo "NODED_USER = '$(NODED_USER)'"; \ |
1536 | 1544 |
echo "NODED_GROUP = '$(NODED_GROUP)'"; \ |
1537 | 1545 |
echo "MOND_USER = '$(MOND_USER)'"; \ |
... | ... | |
1613 | 1621 |
echo 's#@''GNTMASTERUSER@#$(MASTERD_USER)#g'; \ |
1614 | 1622 |
echo 's#@''GNTRAPIUSER@#$(RAPI_USER)#g'; \ |
1615 | 1623 |
echo 's#@''GNTCONFDUSER@#$(CONFD_USER)#g'; \ |
1624 |
echo 's#@''GNTQUERYDUSER@#$(QUERY_USER)#g'; \ |
|
1616 | 1625 |
echo 's#@''GNTNODEDUSER@#$(NODED_USER)#g'; \ |
1617 | 1626 |
echo 's#@''GNTMONDUSER@#$(MOND_USER)#g'; \ |
1618 | 1627 |
echo 's#@''GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \ |
1619 | 1628 |
echo 's#@''GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \ |
1620 | 1629 |
echo 's#@''GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \ |
1630 |
echo 's#@''GNTQUERYDGROUP@#$(QUERYD_GROUP)#g'; \ |
|
1621 | 1631 |
echo 's#@''GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \ |
1622 | 1632 |
echo 's#@''GNTMONDGROUP@#$(MOND_GROUP)#g'; \ |
1623 | 1633 |
echo 's#@''GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \ |
b/configure.ac | ||
---|---|---|
243 | 243 |
[user_masterd="${withval}masterd"; |
244 | 244 |
user_rapi="${withval}rapi"; |
245 | 245 |
user_confd="${withval}confd"; |
246 |
user_queryd="${withval}queryd"; |
|
246 | 247 |
user_noded="$user_default"; |
247 | 248 |
user_mond="${withval}mond"], |
248 | 249 |
[user_masterd="$user_default"; |
249 | 250 |
user_rapi="$user_default"; |
250 | 251 |
user_confd="$user_default"; |
252 |
user_queryd="$user_default"; |
|
251 | 253 |
user_noded="$user_default"; |
252 | 254 |
user_mond="$user_default"]) |
253 | 255 |
AC_SUBST(MASTERD_USER, $user_masterd) |
254 | 256 |
AC_SUBST(RAPI_USER, $user_rapi) |
255 | 257 |
AC_SUBST(CONFD_USER, $user_confd) |
258 |
AC_SUBST(QUERYD_USER, $user_queryd) |
|
256 | 259 |
AC_SUBST(NODED_USER, $user_noded) |
257 | 260 |
AC_SUBST(MOND_USER, $user_mond) |
258 | 261 |
|
... | ... | |
266 | 269 |
[group_rapi="${withval}rapi"; |
267 | 270 |
group_admin="${withval}admin"; |
268 | 271 |
group_confd="${withval}confd"; |
272 |
group_queryd="${withval}queryd"; |
|
269 | 273 |
group_masterd="${withval}masterd"; |
270 | 274 |
group_noded="$group_default"; |
271 | 275 |
group_daemons="${withval}daemons"; |
... | ... | |
273 | 277 |
[group_rapi="$group_default"; |
274 | 278 |
group_admin="$group_default"; |
275 | 279 |
group_confd="$group_default"; |
280 |
group_queryd="$group_default"; |
|
276 | 281 |
group_masterd="$group_default"; |
277 | 282 |
group_noded="$group_default"; |
278 | 283 |
group_daemons="$group_default"; |
... | ... | |
280 | 285 |
AC_SUBST(RAPI_GROUP, $group_rapi) |
281 | 286 |
AC_SUBST(ADMIN_GROUP, $group_admin) |
282 | 287 |
AC_SUBST(CONFD_GROUP, $group_confd) |
288 |
AC_SUBST(QUERYD_GROUP, $group_queryd) |
|
283 | 289 |
AC_SUBST(MASTERD_GROUP, $group_masterd) |
284 | 290 |
AC_SUBST(NODED_GROUP, $group_noded) |
285 | 291 |
AC_SUBST(DAEMONS_GROUP, $group_daemons) |
... | ... | |
289 | 295 |
AC_MSG_NOTICE([Running ganeti-masterd as $group_masterd:$group_masterd]) |
290 | 296 |
AC_MSG_NOTICE([Running ganeti-rapi as $user_rapi:$group_rapi]) |
291 | 297 |
AC_MSG_NOTICE([Running ganeti-confd as $user_confd:$group_confd]) |
298 |
AC_MSG_NOTICE([Running ganeti-queryd as $user_queryd:$group_queryd]) |
|
292 | 299 |
AC_MSG_NOTICE([Group for daemons is $group_daemons]) |
293 | 300 |
AC_MSG_NOTICE([Group for clients is $group_admin]) |
294 | 301 |
|
b/daemons/daemon-util.in | ||
---|---|---|
39 | 39 |
|
40 | 40 |
if _confd_enabled; then |
41 | 41 |
DAEMONS+=( ganeti-confd ) |
42 |
DAEMONS+=( ganeti-queryd ) |
|
42 | 43 |
fi |
43 | 44 |
|
44 | 45 |
_mond_enabled() { |
... | ... | |
52 | 53 |
NODED_ARGS= |
53 | 54 |
MASTERD_ARGS= |
54 | 55 |
CONFD_ARGS= |
56 |
QUERYD_ARGS= |
|
55 | 57 |
RAPI_ARGS= |
56 | 58 |
MOND_ARGS= |
57 | 59 |
|
... | ... | |
82 | 84 |
confd) |
83 | 85 |
echo "@GNTCONFDUSER@:@GNTDAEMONSGROUP@" |
84 | 86 |
;; |
87 |
queryd) |
|
88 |
echo "@GNTQUERYDUSER@:@GNTQUERYDGROUP@" |
|
89 |
;; |
|
85 | 90 |
rapi) |
86 | 91 |
echo "@GNTRAPIUSER@:@GNTRAPIGROUP@" |
87 | 92 |
;; |
... | ... | |
228 | 233 |
local usergroup=$(_daemon_usergroup $plain_name) |
229 | 234 |
local daemonexec=$(_daemon_executable $name) |
230 | 235 |
|
231 |
if [[ "$name" == ganeti-confd ]] && ! _confd_enabled; then |
|
236 |
if ( [[ "$name" == ganeti-confd ]] || [[ "$name" == ganeti-queryd ]] ) \ |
|
237 |
&& ! _confd_enabled; then |
|
232 | 238 |
echo 'ganeti-confd disabled at build time' >&2 |
233 | 239 |
return 1 |
234 | 240 |
fi |
b/lib/constants.py | ||
---|---|---|
104 | 104 |
RAPI_GROUP = _autoconf.RAPI_GROUP |
105 | 105 |
CONFD_USER = _autoconf.CONFD_USER |
106 | 106 |
CONFD_GROUP = _autoconf.CONFD_GROUP |
107 |
QUERYD_USER = _autoconf.QUERYD_USER |
|
108 |
QUERYD_GROUP = _autoconf.QUERYD_GROUP |
|
107 | 109 |
NODED_USER = _autoconf.NODED_USER |
108 | 110 |
NODED_GROUP = _autoconf.NODED_GROUP |
109 | 111 |
MOND_USER = _autoconf.MOND_USER |
... | ... | |
156 | 158 |
|
157 | 159 |
NODED = "ganeti-noded" |
158 | 160 |
CONFD = "ganeti-confd" |
161 |
QUERYD = "ganeti-queryd" |
|
159 | 162 |
RAPI = "ganeti-rapi" |
160 | 163 |
MASTERD = "ganeti-masterd" |
161 | 164 |
MOND = "ganeti-mond" |
... | ... | |
163 | 166 |
DAEMONS = compat.UniqueFrozenset([ |
164 | 167 |
NODED, |
165 | 168 |
CONFD, |
169 |
QUERYD, |
|
166 | 170 |
RAPI, |
167 | 171 |
MASTERD, |
168 | 172 |
MOND, |
... | ... | |
188 | 192 |
DAEMONS_LOGBASE = { |
189 | 193 |
NODED: "node-daemon", |
190 | 194 |
CONFD: "conf-daemon", |
195 |
QUERYD: "query-daemon", |
|
191 | 196 |
RAPI: "rapi-daemon", |
192 | 197 |
MASTERD: "master-daemon", |
193 | 198 |
MOND: "monitoring-daemon", |
b/lib/runtime.py | ||
---|---|---|
75 | 75 |
@ivar masterd_gid: The resolved gid of the masterd group |
76 | 76 |
@ivar confd_uid: The resolved uid of the confd user |
77 | 77 |
@ivar confd_gid: The resolved gid of the confd group |
78 |
@ivar queryd_uid: The resolved uid of the queryd user |
|
79 |
@ivar queyrd_gid: The resolved gid of the queyrd group |
|
78 | 80 |
@ivar rapi_uid: The resolved uid of the rapi user |
79 | 81 |
@ivar rapi_gid: The resolved gid of the rapi group |
80 | 82 |
@ivar noded_uid: The resolved uid of the noded user |
... | ... | |
93 | 95 |
self.confd_uid = GetUid(constants.CONFD_USER, _getpwnam) |
94 | 96 |
self.confd_gid = GetGid(constants.CONFD_GROUP, _getgrnam) |
95 | 97 |
|
98 |
self.queryd_uid = GetUid(constants.QUERYD_USER, _getpwnam) |
|
99 |
self.queryd_gid = GetGid(constants.QUERYD_GROUP, _getgrnam) |
|
100 |
|
|
96 | 101 |
self.rapi_uid = GetUid(constants.RAPI_USER, _getpwnam) |
97 | 102 |
self.rapi_gid = GetGid(constants.RAPI_GROUP, _getgrnam) |
98 | 103 |
|
... | ... | |
106 | 111 |
self._uid2user = { |
107 | 112 |
self.masterd_uid: constants.MASTERD_USER, |
108 | 113 |
self.confd_uid: constants.CONFD_USER, |
114 |
self.queryd_uid: constants.QUERYD_USER, |
|
109 | 115 |
self.rapi_uid: constants.RAPI_USER, |
110 | 116 |
self.noded_uid: constants.NODED_USER, |
111 | 117 |
} |
... | ... | |
113 | 119 |
self._gid2group = { |
114 | 120 |
self.masterd_gid: constants.MASTERD_GROUP, |
115 | 121 |
self.confd_gid: constants.CONFD_GROUP, |
122 |
self.queryd_gid: constants.QUERYD_GROUP, |
|
116 | 123 |
self.rapi_gid: constants.RAPI_GROUP, |
117 | 124 |
self.noded_gid: constants.NODED_GROUP, |
118 | 125 |
self.daemons_gid: constants.DAEMONS_GROUP, |
b/lib/tools/ensure_dirs.py | ||
---|---|---|
180 | 180 |
(pathutils.MASTER_SOCKET, FILE, 0660, |
181 | 181 |
getent.masterd_uid, getent.daemons_gid, False), |
182 | 182 |
(pathutils.QUERY_SOCKET, FILE, 0660, |
183 |
getent.confd_uid, getent.daemons_gid, False),
|
|
183 |
getent.queryd_uid, getent.daemons_gid, False),
|
|
184 | 184 |
(pathutils.BDEV_CACHE_DIR, DIR, 0755, |
185 | 185 |
getent.noded_uid, getent.masterd_gid), |
186 | 186 |
(pathutils.UIDPOOL_LOCKDIR, DIR, 0750, |
b/src/Ganeti/Confd/Server.hs | ||
---|---|---|
52 | 52 |
import Ganeti.Hash |
53 | 53 |
import Ganeti.Logging |
54 | 54 |
import qualified Ganeti.Constants as C |
55 |
import Ganeti.Query.Server (prepQueryD, runQueryD) |
|
56 | 55 |
import Ganeti.Utils |
57 | 56 |
|
58 | 57 |
-- * Types and constants definitions |
... | ... | |
250 | 249 |
else logDebug "Invalid magic code!" >> return () |
251 | 250 |
return () |
252 | 251 |
|
253 |
-- | Extract the configuration from our IORef. |
|
254 |
configReader :: CRef -> ConfigReader |
|
255 |
configReader cref = do |
|
256 |
cdata <- readIORef cref |
|
257 |
return $ liftM fst cdata |
|
258 |
|
|
259 | 252 |
-- | Type alias for prepMain results |
260 |
type PrepResult = (S.Socket, (FilePath, S.Socket), |
|
261 |
IORef (Result (ConfigData, LinkIpMap))) |
|
253 |
type PrepResult = (S.Socket, IORef (Result (ConfigData, LinkIpMap))) |
|
262 | 254 |
|
263 | 255 |
-- | Check function for confd. |
264 | 256 |
checkMain :: CheckFn (S.Family, S.SockAddr) |
... | ... | |
275 | 267 |
prepMain _ (af_family, bindaddr) = do |
276 | 268 |
s <- S.socket af_family S.Datagram S.defaultProtocol |
277 | 269 |
S.bindSocket s bindaddr |
278 |
-- prepare the queryd listener |
|
279 |
query_data <- prepQueryD Nothing |
|
280 | 270 |
cref <- newIORef (Bad "Configuration not yet loaded") |
281 |
return (s, query_data, cref)
|
|
271 |
return (s, cref) |
|
282 | 272 |
|
283 | 273 |
-- | Main function. |
284 | 274 |
main :: MainFn (S.Family, S.SockAddr) PrepResult |
285 |
main _ _ (s, query_data, cref) = do
|
|
275 |
main _ _ (s, cref) = do |
|
286 | 276 |
let cfg_transform :: Result ConfigData -> Result (ConfigData, LinkIpMap) |
287 | 277 |
cfg_transform = liftM (\cfg -> (cfg, buildLinkIpInstnameMap cfg)) |
288 | 278 |
initConfigReader cfg_transform cref |
289 | 279 |
|
290 | 280 |
hmac <- getClusterHmac |
291 |
-- launch the queryd listener |
|
292 |
_ <- forkIO $ runQueryD query_data (configReader cref) |
|
293 |
-- and finally enter the responder loop |
|
281 |
-- enter the responder loop |
|
294 | 282 |
forever $ listener s hmac (responder cref) |
b/src/Ganeti/Daemon.hs | ||
---|---|---|
50 | 50 |
import Data.Maybe (fromMaybe) |
51 | 51 |
import Data.Word |
52 | 52 |
import GHC.IO.Handle (hDuplicateTo) |
53 |
import Network.BSD (getHostName) |
|
53 | 54 |
import qualified Network.Socket as Socket |
54 | 55 |
import System.Console.GetOpt |
55 | 56 |
import System.Exit |
... | ... | |
291 | 292 |
(resolveAddr port saddr) |
292 | 293 |
(ioErrorToResult $ "Invalid address " ++ saddr) |
293 | 294 |
|
295 |
-- | Environment variable to override the assumed host name of the |
|
296 |
-- current node. |
|
297 |
vClusterHostNameEnvVar :: String |
|
298 |
vClusterHostNameEnvVar = "GANETI_HOSTNAME" |
|
299 |
|
|
300 |
-- | Returns if the current node is the master node. |
|
301 |
isMaster :: IO Bool |
|
302 |
isMaster = do |
|
303 |
let ioErrorToNothing :: IOError -> IO (Maybe String) |
|
304 |
ioErrorToNothing _ = return Nothing |
|
305 |
vcluster_node <- Control.Exception.catch |
|
306 |
(liftM Just (getEnv vClusterHostNameEnvVar)) |
|
307 |
ioErrorToNothing |
|
308 |
curNode <- case vcluster_node of |
|
309 |
Just node_name -> return node_name |
|
310 |
Nothing -> getHostName |
|
311 |
masterNode <- Ssconf.getMasterNode Nothing |
|
312 |
case masterNode of |
|
313 |
Ok n -> return (curNode == n) |
|
314 |
Bad _ -> return False |
|
315 |
|
|
316 |
-- | Ensures that the daemon runs on the right node (and exits |
|
317 |
-- gracefully if it doesnt) |
|
318 |
ensureNode :: GanetiDaemon -> IO () |
|
319 |
ensureNode daemon = do |
|
320 |
is_master <- isMaster |
|
321 |
when (daemonOnlyOnMaster daemon && not is_master) $ do |
|
322 |
putStrLn "Not master, exiting." |
|
323 |
exitWith (ExitFailure C.exitNotmaster) |
|
324 |
|
|
294 | 325 |
-- | Run an I\/O action that might throw an I\/O error, under a |
295 | 326 |
-- handler that will simply annotate and re-throw the exception. |
296 | 327 |
describeError :: String -> Maybe Handle -> Maybe FilePath -> IO a -> IO a |
... | ... | |
337 | 368 |
-> IO () |
338 | 369 |
genericMain daemon options check_fn prep_fn exec_fn = do |
339 | 370 |
let progname = daemonName daemon |
371 |
|
|
340 | 372 |
(opts, args) <- parseArgs progname options |
341 | 373 |
|
374 |
ensureNode daemon |
|
375 |
|
|
342 | 376 |
exitUnless (null args) "This program doesn't take any arguments" |
343 | 377 |
|
344 | 378 |
unless (optNoUserChecks opts) $ do |
b/src/Ganeti/Query/Server.hs | ||
---|---|---|
26 | 26 |
-} |
27 | 27 |
|
28 | 28 |
module Ganeti.Query.Server |
29 |
( prepQueryD |
|
30 |
, runQueryD |
|
29 |
( main |
|
30 |
, checkMain |
|
31 |
, prepMain |
|
31 | 32 |
) where |
32 | 33 |
|
33 | 34 |
import Control.Applicative |
34 | 35 |
import Control.Concurrent |
35 | 36 |
import Control.Exception |
37 |
import Control.Monad (forever) |
|
36 | 38 |
import Data.Bits (bitSize) |
37 |
import Data.Maybe
|
|
39 |
import Data.IORef
|
|
38 | 40 |
import qualified Network.Socket as S |
39 | 41 |
import qualified Text.JSON as J |
40 | 42 |
import Text.JSON (showJSON, JSValue(..)) |
... | ... | |
226 | 228 |
then clientLoop client creader |
227 | 229 |
else closeClient client |
228 | 230 |
|
229 |
-- | Main loop: accepts clients, forks an I/O thread to handle that
|
|
230 |
-- client, and then restarts.
|
|
231 |
mainLoop :: ConfigReader -> S.Socket -> IO ()
|
|
232 |
mainLoop creader socket = do
|
|
231 |
-- | Main listener loop: accepts clients, forks an I/O thread to handle
|
|
232 |
-- that client.
|
|
233 |
listener :: ConfigReader -> S.Socket -> IO ()
|
|
234 |
listener creader socket = do
|
|
233 | 235 |
client <- acceptClient socket |
234 | 236 |
_ <- forkIO $ clientLoop client creader |
235 |
mainLoop creader socket
|
|
237 |
return ()
|
|
236 | 238 |
|
237 |
-- | Function that prepares the server socket. |
|
238 |
prepQueryD :: Maybe FilePath -> IO (FilePath, S.Socket) |
|
239 |
prepQueryD fpath = do |
|
240 |
def_socket <- Path.defaultQuerySocket |
|
241 |
let socket_path = fromMaybe def_socket fpath |
|
239 |
-- | Type alias for prepMain results |
|
240 |
type PrepResult = (FilePath, S.Socket, IORef (Result ConfigData)) |
|
241 |
|
|
242 |
-- | Check function for queryd. |
|
243 |
checkMain :: CheckFn () |
|
244 |
checkMain _ = return $ Right () |
|
245 |
|
|
246 |
-- | Prepare function for queryd. |
|
247 |
prepMain :: PrepFn () PrepResult |
|
248 |
prepMain _ _ = do |
|
249 |
socket_path <- Path.defaultQuerySocket |
|
242 | 250 |
cleanupSocket socket_path |
243 | 251 |
s <- describeError "binding to the Luxi socket" |
244 | 252 |
Nothing (Just socket_path) $ getServer socket_path |
245 |
return (socket_path, s) |
|
253 |
cref <- newIORef (Bad "Configuration not yet loaded") |
|
254 |
return (socket_path, s, cref) |
|
255 |
|
|
256 |
-- | Main function. |
|
257 |
main :: MainFn () PrepResult |
|
258 |
main _ _ (socket_path, server, cref) = do |
|
259 |
initConfigReader id cref |
|
260 |
let creader = readIORef cref |
|
246 | 261 |
|
247 |
-- | Main function that runs the query endpoint. |
|
248 |
runQueryD :: (FilePath, S.Socket) -> ConfigReader -> IO () |
|
249 |
runQueryD (socket_path, server) creader = |
|
250 | 262 |
finally |
251 |
(mainLoop creader server)
|
|
263 |
(forever $ listener creader server)
|
|
252 | 264 |
(closeServer socket_path server) |
b/src/Ganeti/Runtime.hs | ||
---|---|---|
29 | 29 |
, GanetiGroup(..) |
30 | 30 |
, RuntimeEnts |
31 | 31 |
, daemonName |
32 |
, daemonOnlyOnMaster |
|
32 | 33 |
, daemonUser |
33 | 34 |
, daemonGroup |
34 | 35 |
, daemonLogFile |
... | ... | |
56 | 57 |
| GanetiNoded |
57 | 58 |
| GanetiRapi |
58 | 59 |
| GanetiConfd |
60 |
| GanetiQueryd |
|
59 | 61 |
| GanetiMond |
60 | 62 |
deriving (Show, Enum, Bounded, Eq, Ord) |
61 | 63 |
|
... | ... | |
75 | 77 |
daemonName GanetiNoded = C.noded |
76 | 78 |
daemonName GanetiRapi = C.rapi |
77 | 79 |
daemonName GanetiConfd = C.confd |
80 |
daemonName GanetiQueryd = C.queryd |
|
78 | 81 |
daemonName GanetiMond = C.mond |
79 | 82 |
|
83 |
-- | Returns whether the daemon only runs on the master node. |
|
84 |
daemonOnlyOnMaster :: GanetiDaemon -> Bool |
|
85 |
daemonOnlyOnMaster GanetiMasterd = True |
|
86 |
daemonOnlyOnMaster GanetiNoded = False |
|
87 |
daemonOnlyOnMaster GanetiRapi = False |
|
88 |
daemonOnlyOnMaster GanetiConfd = False |
|
89 |
daemonOnlyOnMaster GanetiQueryd = True |
|
90 |
daemonOnlyOnMaster GanetiMond = False |
|
91 |
|
|
80 | 92 |
-- | Returns the log file base for a daemon. |
81 | 93 |
daemonLogBase :: GanetiDaemon -> String |
82 | 94 |
daemonLogBase GanetiMasterd = C.daemonsLogbaseGanetiMasterd |
83 | 95 |
daemonLogBase GanetiNoded = C.daemonsLogbaseGanetiNoded |
84 | 96 |
daemonLogBase GanetiRapi = C.daemonsLogbaseGanetiRapi |
85 | 97 |
daemonLogBase GanetiConfd = C.daemonsLogbaseGanetiConfd |
98 |
daemonLogBase GanetiQueryd = C.daemonsLogbaseGanetiQueryd |
|
86 | 99 |
daemonLogBase GanetiMond = C.daemonsLogbaseGanetiMond |
87 | 100 |
|
88 | 101 |
-- | Returns the configured user name for a daemon. |
... | ... | |
91 | 104 |
daemonUser GanetiNoded = C.nodedUser |
92 | 105 |
daemonUser GanetiRapi = C.rapiUser |
93 | 106 |
daemonUser GanetiConfd = C.confdUser |
107 |
daemonUser GanetiQueryd = C.querydUser |
|
94 | 108 |
daemonUser GanetiMond = C.mondUser |
95 | 109 |
|
96 | 110 |
-- | Returns the configured group for a daemon. |
... | ... | |
99 | 113 |
daemonGroup (DaemonGroup GanetiNoded) = C.nodedGroup |
100 | 114 |
daemonGroup (DaemonGroup GanetiRapi) = C.rapiGroup |
101 | 115 |
daemonGroup (DaemonGroup GanetiConfd) = C.confdGroup |
116 |
daemonGroup (DaemonGroup GanetiQueryd) = C.querydGroup |
|
102 | 117 |
daemonGroup (DaemonGroup GanetiMond) = C.mondGroup |
103 | 118 |
daemonGroup (ExtraGroup DaemonsGroup) = C.daemonsGroup |
104 | 119 |
daemonGroup (ExtraGroup AdminGroup) = C.adminGroup |
b/src/Ganeti/Ssconf.hs | ||
---|---|---|
31 | 31 |
, sSKeyFromRaw |
32 | 32 |
, getPrimaryIPFamily |
33 | 33 |
, getMasterCandidatesIps |
34 |
, getMasterNode |
|
34 | 35 |
, keyToFilename |
35 | 36 |
, sSFilePrefix |
36 | 37 |
) where |
... | ... | |
134 | 135 |
getMasterCandidatesIps optPath = do |
135 | 136 |
result <- readSSConfFile optPath Nothing SSMasterCandidatesIps |
136 | 137 |
return $ liftM lines result |
138 |
|
|
139 |
-- | Read the name of the master node. |
|
140 |
getMasterNode :: Maybe FilePath -> IO (Result String) |
|
141 |
getMasterNode optPath = do |
|
142 |
result <- readSSConfFile optPath Nothing SSMasterNode |
|
143 |
return (liftM rStripSpace result) |
b/src/hqueryd.hs | ||
---|---|---|
1 |
{-| Ganeti query daemon |
|
2 |
|
|
3 |
-} |
|
4 |
|
|
5 |
{- |
|
6 |
|
|
7 |
Copyright (C) 2009, 2011, 2012, 2013 Google Inc. |
|
8 |
|
|
9 |
This program is free software; you can redistribute it and/or modify |
|
10 |
it under the terms of the GNU General Public License as published by |
|
11 |
the Free Software Foundation; either version 2 of the License, or |
|
12 |
(at your option) any later version. |
|
13 |
|
|
14 |
This program is distributed in the hope that it will be useful, but |
|
15 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
17 |
General Public License for more details. |
|
18 |
|
|
19 |
You should have received a copy of the GNU General Public License |
|
20 |
along with this program; if not, write to the Free Software |
|
21 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
22 |
02110-1301, USA. |
|
23 |
|
|
24 |
-} |
|
25 |
|
|
26 |
module Main (main) where |
|
27 |
|
|
28 |
import qualified Ganeti.Query.Server |
|
29 |
import Ganeti.Daemon |
|
30 |
import Ganeti.Runtime |
|
31 |
|
|
32 |
-- | Options list and functions. |
|
33 |
options :: [OptType] |
|
34 |
options = |
|
35 |
[ oNoDaemonize |
|
36 |
, oNoUserChecks |
|
37 |
, oDebug |
|
38 |
, oSyslogUsage |
|
39 |
] |
|
40 |
|
|
41 |
-- | Main function. |
|
42 |
main :: IO () |
|
43 |
main = |
|
44 |
genericMain GanetiQueryd options |
|
45 |
Ganeti.Query.Server.checkMain |
|
46 |
Ganeti.Query.Server.prepMain |
|
47 |
Ganeti.Query.Server.main |
b/test/hs/Test/Ganeti/Runtime.hs | ||
---|---|---|
83 | 83 |
\ constants.NODED_USER,\n\ |
84 | 84 |
\ constants.RAPI_USER,\n\ |
85 | 85 |
\ constants.CONFD_USER,\n\ |
86 |
\ constants.QUERYD_USER,\n\ |
|
86 | 87 |
\ constants.MOND_USER,\n\ |
87 | 88 |
\ ]\n\ |
88 | 89 |
\groups = [constants.MASTERD_GROUP,\n\ |
89 | 90 |
\ constants.NODED_GROUP,\n\ |
90 | 91 |
\ constants.RAPI_GROUP,\n\ |
91 | 92 |
\ constants.CONFD_GROUP,\n\ |
93 |
\ constants.QUERYD_GROUP,\n\ |
|
92 | 94 |
\ constants.MOND_GROUP,\n\ |
93 | 95 |
\ constants.DAEMONS_GROUP,\n\ |
94 | 96 |
\ constants.ADMIN_GROUP,\n\ |
b/test/py/daemon-util_unittest.bash | ||
---|---|---|
40 | 40 |
STOPDAEMONS_LIST="rapi masterd noded" |
41 | 41 |
|
42 | 42 |
if grep -q '^ENABLE_CONFD = True' lib/_autoconf.py; then |
43 |
DAEMONS_LIST="$DAEMONS_LIST confd" |
|
44 |
STOPDAEMONS_LIST="confd $STOPDAEMONS_LIST" |
|
43 |
DAEMONS_LIST="$DAEMONS_LIST confd queryd"
|
|
44 |
STOPDAEMONS_LIST="queryd confd $STOPDAEMONS_LIST"
|
|
45 | 45 |
fi |
46 | 46 |
|
47 | 47 |
if grep -q '^ENABLE_MOND = True' lib/_autoconf.py; then |
b/tools/users-setup.in | ||
---|---|---|
7 | 7 |
addgroup --system @GNTMASTERUSER@ |
8 | 8 |
addgroup --system @GNTRAPIUSER@ |
9 | 9 |
addgroup --system @GNTCONFDUSER@ |
10 |
addgroup --system @GNTQUERYDUSER@ |
|
10 | 11 |
addgroup --system @GNTMONDUSER@ |
11 | 12 |
|
12 | 13 |
#Create users |
13 | 14 |
adduser --system --ingroup @GNTMASTERDGROUP@ @GNTMASTERUSER@ |
14 | 15 |
adduser --system --ingroup @GNTRAPIGROUP@ @GNTRAPIUSER@ |
15 | 16 |
adduser --system --ingroup @GNTCONFDGROUP@ @GNTCONFDUSER@ |
17 |
adduser --system --ingroup @GNTQUERYDGROUP@ @GNTQUERYDUSER@ |
|
16 | 18 |
adduser --system --ingroup @GNTMONDGROUP@ @GNTMONDUSER@ |
17 | 19 |
adduser --system @GNTNODEDUSER@ |
18 | 20 |
|
19 | 21 |
#Add users to extra groups |
20 |
for u in @GNTMASTERUSER@ @GNTCONFDUSER@ @GNTRAPIUSER@ @GNTMONDUSER@ |
|
22 |
for u in @GNTMASTERUSER@ @GNTCONFDUSER@ @GNTQUERYDUSER@ @GNTRAPIUSER@ @GNTMONDUSER@
|
|
21 | 23 |
do |
22 | 24 |
adduser $u @GNTDAEMONSGROUP@ |
23 | 25 |
done |
... | ... | |
29 | 31 |
|
30 | 32 |
adduser @GNTMASTERUSER@ @GNTCONFDGROUP@ |
31 | 33 |
adduser @GNTMONDUSER@ @GNTMASTERDGROUP@ |
32 |
adduser @GNTCONFDUSER@ @GNTMASTERDGROUP@ |
|
34 |
adduser @GNTQUERYDUSER@ @GNTMASTERDGROUP@ |
|
35 |
adduser @GNTQUERYDUSER@ @GNTCONFDGROUP@ |
b/tools/vcluster-setup.in | ||
---|---|---|
203 | 203 |
MASTERD_ARGS='' |
204 | 204 |
RAPI_ARGS='$daemon_args' |
205 | 205 |
CONFD_ARGS='$daemon_args' |
206 |
QUERYD_ARGS='' |
|
206 | 207 |
|
207 | 208 |
export GANETI_ROOTDIR='$nodedir' |
208 | 209 |
export GANETI_HOSTNAME='$(node_hostname $number)' |
Also available in: Unified diff