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

Module jstore

source code

Module implementing the job queue handling.

Functions [hide private]
None or int
_ReadNumericFile(file_name)
Reads a file containing a number.
source code
 
ReadSerial()
Read the serial file.
source code
 
ReadVersion()
Read the queue version.
source code
utils.FileLock
InitAndVerifyQueue(must_lock)
Open and lock job queue.
source code
boolean
CheckDrainFlag()
Check if the queue is marked to be drained.
source code
 
SetDrainFlag(drain_flag)
Sets the drain flag for the queue.
source code

Imports: errno, os, constants, errors, runtime, utils


Function Details [hide private]

_ReadNumericFile(file_name)

source code 

Reads a file containing a number.

Returns: None or int
None if file is not found, otherwise number

ReadSerial()

source code 

Read the serial file.

The queue should be locked while this function is called.

ReadVersion()

source code 

Read the queue version.

The queue should be locked while this function is called.

InitAndVerifyQueue(must_lock)

source code 

Open and lock job queue.

If necessary, the queue is automatically initialized.

Parameters:
  • must_lock (bool) - Whether an exclusive lock must be held.
Returns: utils.FileLock
Lock object for the queue. This can be used to change the locking mode.

CheckDrainFlag()

source code 

Check if the queue is marked to be drained.

This currently uses the queue drain file, which makes it a per-node flag. In the future this can be moved to the config file.

Returns: boolean
True if the job queue is marked drained

SetDrainFlag(drain_flag)

source code 

Sets the drain flag for the queue.

Parameters:
  • drain_flag (boolean) - Whether to set or unset the drain flag

Attention: This function should only called the current holder of the queue lock