Package ganeti :: Module runtime
[hide private]
[frames] | no frames]

Module runtime

source code

Module implementing configuration details at runtime.

Classes [hide private]
  GetentResolver
Resolves Ganeti uids and gids by name.
Functions [hide private]
 
GetUid(user, _getpwnam)
Retrieve the uid from the database.
source code
 
GetGid(group, _getgrnam)
Retrieve the gid from the database.
source code
 
GetEnts(resolver=GetentResolver)
Singleton wrapper around resolver instance.
source code
 
InitArchInfo()
Initialize architecture information.
source code
 
GetArchInfo()
Returns previsouly initialized architecture information.
source code
 
GetClient(query=True)
Connects to the a luxi socket and returns a client.
source code
Variables [hide private]
  _priv = None
  _priv_lock = threading.Lock()
  _arch = None
Architecture information

Imports: grp, pwd, threading, os, platform, constants, errors, luxi, NoMasterError, pathutils, ssconf, utils


Function Details [hide private]

GetUid(user, _getpwnam)

source code 

Retrieve the uid from the database.

Parameters:
  • user (string) - The username to retrieve
Returns:
The resolved uid

GetGid(group, _getgrnam)

source code 

Retrieve the gid from the database.

Parameters:
  • group (string) - The group name to retrieve
Returns:
The resolved gid

GetEnts(resolver=GetentResolver)

source code 

Singleton wrapper around resolver instance.

As this method is accessed by multiple threads at the same time we need to take thread-safety carefully.

InitArchInfo()

source code 

Initialize architecture information.

We can assume this information never changes during the lifetime of a process, therefore the information can easily be cached.

Note: This function uses platform.architecture to retrieve the Python binary architecture and does so by forking to run file (see Python documentation for more information). Therefore it must not be used in a multi-threaded environment.

GetClient(query=True)

source code 

Connects to the a luxi socket and returns a client.

Parameters:
  • query (boolean) - this signifies that the client will only be used for queries; if the build-time parameter enable-split-queries is enabled, then the client will be connected to the query socket instead of the masterd socket