Package ganeti :: Package server :: Module masterd
[hide private]
[frames] | no frames]

Module masterd

source code

Master daemon program.

Some classes deviates from the standard style guide since the inheritance from parent classes requires it.

Classes [hide private]
  ClientRequestWorker
  MasterClientHandler
Handler for master peers.
  _MasterShutdownCheck
Logic for master daemon shutdown.
  MasterServer
Master Server.
  ClientOps
Class holding high-level client operations.
  GanetiContext
Context common to all ganeti threads.
Functions [hide private]
 
_LogNewJob(status, info, ops)
Log information about a recently submitted job.
source code
 
_SetWatcherPause(context, until)
Creates or removes the watcher pause file.
source code
 
CheckAgreement()
Check the agreement on who is the master.
source code
 
ActivateMasterIP() source code
 
CheckMasterd(options, args)
Initial checks whether to run or exit with a failure.
source code
 
PrepMasterd(options, _)
Prep master daemon function, executed with the PID file held.
source code
 
ExecMasterd(options, args, prep_data)
Main master daemon function, executed with the PID file held.
source code
 
Main()
Main function
source code
Variables [hide private]
  CLIENT_REQUEST_WORKERS = 16
  EXIT_NOTMASTER = constants.EXIT_NOTMASTER
  EXIT_NODESETUP_ERROR = constants.EXIT_NODESETUP_ERROR

Imports: grp, os, pwd, sys, socket, time, tempfile, logging, OptionParser, config, constants, daemon, mcpu, opcodes, jqueue, locking, luxi, rpcerr, utils, errors, ssconf, workerpool, rpc, rpccl, bootstrap, netutils, objects, query, runtime, pathutils, ht, version


Function Details [hide private]

_SetWatcherPause(context, until)

source code 

Creates or removes the watcher pause file.

Parameters:
  • context (GanetiContext) - Global Ganeti context
  • until (None or int) - Unix timestamp saying until when the watcher shouldn't run

CheckAgreement()

source code 

Check the agreement on who is the master.

The function uses a very simple algorithm: we must get more positive than negative answers. Since in most of the cases we are the master, we'll use our own config file for getting the node list. In the future we could collect the current node list from our (possibly obsolete) known nodes.

In order to account for cold-start of all nodes, we retry for up to a minute until we get a real answer as the top-voted one. If the nodes are more out-of-sync, for now manual startup of the master should be attempted.

Note that for a even number of nodes cluster, we need at least half of the nodes (beside ourselves) to vote for us. This creates a problem on two-node clusters, since in this case we require the other node to be up too to confirm our status.

Decorators:
  • @rpc.RunWithRPC

ActivateMasterIP()

source code 
Decorators:
  • @rpc.RunWithRPC