ganeti :: watcher :: state :: WatcherState :: Class WatcherState
[hide private]
[frames] | no frames]

Class WatcherState

source code


Interface to a state file recording restart attempts.

Instance Methods [hide private]
 
__init__(self, statefile)
Open, lock, read and parse the file.
source code
 
Save(self, filename)
Save state to file, then unlock and close it.
source code
 
Close(self)
Unlock configuration file and close it.
source code
 
GetNodeBootID(self, name)
Returns the last boot ID of a node or None.
source code
 
SetNodeBootID(self, name, bootid)
Sets the boot ID of a node.
source code
 
NumberOfRestartAttempts(self, instance_name)
Returns number of previous restart attempts.
source code
 
NumberOfCleanupAttempts(self, instance_name)
Returns number of previous cleanup attempts.
source code
 
MaintainInstanceList(self, instances)
Perform maintenance on the recorded instances.
source code
 
RecordRestartAttempt(self, instance_name)
Record a restart attempt.
source code
 
RecordCleanupAttempt(self, instance_name)
Record a cleanup attempt.
source code
 
RemoveInstance(self, instance_name)
Update state to reflect that a machine is running.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
 
_RecordAttempt(instances, instance_name, key_when, key_count)
Record an event.
source code
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, statefile)
(Constructor)

source code 

Open, lock, read and parse the file.

Parameters:
  • statefile (file) - State file object
Overrides: object.__init__

NumberOfRestartAttempts(self, instance_name)

source code 

Returns number of previous restart attempts.

Parameters:
  • instance_name (string) - the name of the instance to look up

NumberOfCleanupAttempts(self, instance_name)

source code 

Returns number of previous cleanup attempts.

Parameters:
  • instance_name (string) - the name of the instance to look up

MaintainInstanceList(self, instances)

source code 

Perform maintenance on the recorded instances.

Parameters:
  • instances (list of string) - the list of currently existing instances

_RecordAttempt(instances, instance_name, key_when, key_count)
Static Method

source code 

Record an event.

Parameters:
  • instances (dict) - contains instance data indexed by instance_name
  • instance_name (string) - name of the instance involved in the event
  • key_when () - dict key for the information for when the event occurred
  • key_count (int) - dict key for the information for how many times the event occurred

RecordRestartAttempt(self, instance_name)

source code 

Record a restart attempt.

Parameters:
  • instance_name (string) - the name of the instance being restarted

RecordCleanupAttempt(self, instance_name)

source code 

Record a cleanup attempt.

Parameters:
  • instance_name (string) - the name of the instance being cleaned up

RemoveInstance(self, instance_name)

source code 

Update state to reflect that a machine is running.

This method removes the record for a named instance (as we only track down instances).

Parameters:
  • instance_name (string) - the name of the instance to remove from books